Skip to content

Commit 1f5175b

Browse files
committed
dts: arm: microchip: add dts node and binding file for comparator g1
Add the device tree node and the binding file for microchip comparator G1 Peripheral. Signed-off-by: Arunprasath P <arunprasath.p@microchip.com>
1 parent 869881e commit 1f5175b

File tree

2 files changed

+154
-0
lines changed

2 files changed

+154
-0
lines changed

dts/arm/microchip/sam/sam_d5x_e5x/common/samd5xe5x.dtsi

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,16 @@
214214
channels = <3>;
215215
};
216216

217+
ac: ac@42002000 {
218+
compatible = "microchip,ac-g1-comparator";
219+
status = "disabled";
220+
reg = <0x42002000 0x26>;
221+
interrupts = <122 0>;
222+
clocks = <&mclkperiph CLOCK_MCHP_MCLKPERIPH_ID_APBC_AC>,
223+
<&gclkperiph CLOCK_MCHP_GCLKPERIPH_ID_AC>;
224+
clock-names = "mclk", "gclk";
225+
};
226+
217227
sercom4: sercom@43000000 {
218228
compatible = "microchip,sercom-g1";
219229
status = "disabled";
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# Copyright (c) 2025 Microchip Technology Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
title: Microchip G1 Analog Comparator
5+
6+
description: |
7+
Binding for the Microchip Comparator driver supporting AC G1 peripherals.
8+
9+
compatible: "microchip,ac-g1-comparator"
10+
11+
include:
12+
- name: base.yaml
13+
- name: pinctrl-device.yaml
14+
15+
properties:
16+
reg:
17+
required: true
18+
description: |
19+
Base address of AC peripheral and its size
20+
21+
comparator-channel:
22+
required: true
23+
type: int
24+
enum: [0, 1]
25+
description: |
26+
Comparator channel index (0 or 1).
27+
28+
interrupt-enable:
29+
type: boolean
30+
description: |
31+
Enable interrupt generation for the comparator channel.
32+
33+
single-shot-mode:
34+
type: boolean
35+
description: |
36+
Enable single-shot mode operation. When enabled, the comparator performs a single comparison
37+
and disables itself. This must be disabled for continuous-mode features like hysteresis.
38+
39+
positive-mux-input:
40+
type: string
41+
enum: ["pin0", "pin1", "pin2", "pin3", "vscale"]
42+
description: |
43+
Positive input source selection (MUXPOS):
44+
- pin0: I/O pin 0 (0x0)
45+
- pin1: I/O pin 1 (0x1)
46+
- pin2: I/O pin 2 (0x2)
47+
- pin3: I/O pin 3 (0x3)
48+
- vscale: VDDANA scaler (0x4)
49+
50+
negative-mux-input:
51+
type: string
52+
enum: ["pin0", "pin1", "pin2", "pin3", "gnd", "vscale", "bandgap", "dac"]
53+
description: |
54+
Negative input source selection (MUXNEG):
55+
- pin0: I/O pin 0 (0x0)
56+
- pin1: I/O pin 1 (0x1)
57+
- pin2: I/O pin 2 (0x2)
58+
- pin3: I/O pin 3 (0x3)
59+
- gnd: Ground (0x4)
60+
- vscale: VDDANA scaler (0x5)
61+
- bandgap: Internal bandgap voltage (0x6)
62+
- dac: DAC output (0x7)
63+
64+
vddana-scale-value:
65+
type: int
66+
default: 0
67+
description: |
68+
VSCALE = (VDDANA * (value + 1)) / 64
69+
Only used when either positive or negative input is configured as "vscale".
70+
Valid range: 0 to 63
71+
72+
output-mode:
73+
type: string
74+
enum: ["off", "async", "sync"]
75+
default: "off"
76+
description: |
77+
Comparator output routing mode:
78+
- off: Output is not routed to COMPn I/O pin (0x0)
79+
- async: Asynchronous output is routed (0x1)
80+
- sync: Synchronous filtered output is routed (0x2)
81+
82+
interrupt-selection:
83+
type: string
84+
enum: ["toggle", "rising", "falling", "eoc"]
85+
default: "toggle"
86+
description: |
87+
Interrupt generation condition:
88+
- toggle: Interrupt on any toggle of the comparator output (0x0)
89+
- rising: Interrupt on rising edge of the comparator output (0x1)
90+
- falling: Interrupt on falling edge of the comparator output (0x2)
91+
- eoc: Interrupt on end of comparison (valid only in single-shot mode) (0x3)
92+
93+
run-standby:
94+
type: boolean
95+
description: |
96+
Keep the comparator running in standby mode (when the core is sleeping).
97+
98+
hysteresis-enable:
99+
type: boolean
100+
description: |
101+
Enable hysteresis on comparator output.
102+
This is only valid when single-shot mode is disabled (i.e., in continuous mode).
103+
104+
hysteresis-level:
105+
type: string
106+
enum: ["hyst50", "hyst100", "hyst150"]
107+
default: "hyst50"
108+
description: |
109+
Hysteresis voltage level to apply when hysteresis is enabled:
110+
- hyst50: 50 mV (0x0)
111+
- hyst100: 100 mV (0x1)
112+
- hyst150: 150 mV (0x2)
113+
114+
This setting is effective only if hysteresis is enabled and single-shot mode is disabled.
115+
116+
filter-length:
117+
type: string
118+
enum: ["off", "maj3", "maj5"]
119+
default: "off"
120+
description: |
121+
Output filtering (debounce) mode:
122+
- off: No filtering (0x0)
123+
- maj3: 3-bit majority filter (2 of 3) (0x1)
124+
- maj5: 5-bit majority filter (3 of 5) (0x2)
125+
126+
swap-inputs:
127+
type: boolean
128+
description: |
129+
Swap the comparator inputs and invert the output:
130+
- false: MUXPOS → positive input, MUXNEG → negative input
131+
- true: MUXNEG → positive input, MUXPOS → negative input (output inverted)
132+
133+
This can be used for offset cancellation.
134+
It must be configured before enabling the comparator.
135+
136+
event-input-enable:
137+
type: boolean
138+
description: |
139+
Enable the event input path for the comparator.
140+
141+
event-output-enable:
142+
type: boolean
143+
description: |
144+
Enable the event output path for the comparator.

0 commit comments

Comments
 (0)