Skip to content

Commit e029a6c

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 0b93c2f commit e029a6c

File tree

2 files changed

+138
-0
lines changed

2 files changed

+138
-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
@@ -225,6 +225,16 @@
225225
channels = <3>;
226226
};
227227

228+
ac: ac@42002000 {
229+
compatible = "microchip,ac-g1-comparator";
230+
status = "disabled";
231+
reg = <0x42002000 0x26>;
232+
interrupts = <122 0>;
233+
clocks = <&mclkperiph CLOCK_MCHP_MCLKPERIPH_ID_APBC_AC>,
234+
<&gclkperiph CLOCK_MCHP_GCLKPERIPH_ID_AC>;
235+
clock-names = "mclk", "gclk";
236+
};
237+
228238
sercom4: sercom@43000000 {
229239
compatible = "microchip,sercom-g1";
230240
status = "disabled";
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
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+
single-shot-mode:
29+
type: boolean
30+
description: |
31+
Enable single-shot mode operation. When enabled, the comparator performs a single comparison
32+
and disables itself. This must be disabled for continuous-mode features like hysteresis.
33+
34+
positive-mux-input:
35+
type: string
36+
enum: ["pin0", "pin1", "pin2", "pin3", "vscale"]
37+
description: |
38+
Positive input source selection (MUXPOS):
39+
- pin0: I/O pin 0 (0x0)
40+
- pin1: I/O pin 1 (0x1)
41+
- pin2: I/O pin 2 (0x2)
42+
- pin3: I/O pin 3 (0x3)
43+
- vscale: VDDANA scaler (0x4)
44+
45+
negative-mux-input:
46+
type: string
47+
enum: ["pin0", "pin1", "pin2", "pin3", "gnd", "vscale", "bandgap", "dac"]
48+
description: |
49+
Negative input source selection (MUXNEG):
50+
- pin0: I/O pin 0 (0x0)
51+
- pin1: I/O pin 1 (0x1)
52+
- pin2: I/O pin 2 (0x2)
53+
- pin3: I/O pin 3 (0x3)
54+
- gnd: Ground (0x4)
55+
- vscale: VDDANA scaler (0x5)
56+
- bandgap: Internal bandgap voltage (0x6)
57+
- dac: DAC output (0x7)
58+
59+
vddana-scale-value:
60+
type: int
61+
default: 0
62+
description: |
63+
VSCALE = (VDDANA * (value + 1)) / 64
64+
Only used when either positive or negative input is configured as "vscale".
65+
Valid range: 0 to 63
66+
67+
output-mode:
68+
type: string
69+
enum: ["off", "async", "sync"]
70+
default: "off"
71+
description: |
72+
Comparator output routing mode:
73+
- off: Output is not routed to COMPn I/O pin (0x0)
74+
- async: Asynchronous output is routed (0x1)
75+
- sync: Synchronous filtered output is routed (0x2)
76+
77+
run-standby:
78+
type: boolean
79+
description: |
80+
Keep the comparator running in standby mode (when the core is sleeping).
81+
82+
hysteresis-enable:
83+
type: boolean
84+
description: |
85+
Enable hysteresis on comparator output.
86+
This is only valid when single-shot mode is disabled (i.e., in continuous mode).
87+
88+
hysteresis-level:
89+
type: string
90+
enum: ["hyst50", "hyst100", "hyst150"]
91+
default: "hyst50"
92+
description: |
93+
Hysteresis voltage level to apply when hysteresis is enabled:
94+
- hyst50: 50 mV (0x0)
95+
- hyst100: 100 mV (0x1)
96+
- hyst150: 150 mV (0x2)
97+
98+
This setting is effective only if hysteresis is enabled and single-shot mode is disabled.
99+
100+
filter-length:
101+
type: string
102+
enum: ["off", "maj3", "maj5"]
103+
default: "off"
104+
description: |
105+
Output filtering (debounce) mode:
106+
- off: No filtering (0x0)
107+
- maj3: 3-bit majority filter (2 of 3) (0x1)
108+
- maj5: 5-bit majority filter (3 of 5) (0x2)
109+
110+
swap-inputs:
111+
type: boolean
112+
description: |
113+
Swap the comparator inputs and invert the output:
114+
- false: MUXPOS → positive input, MUXNEG → negative input
115+
- true: MUXNEG → positive input, MUXPOS → negative input (output inverted)
116+
117+
This can be used for offset cancellation.
118+
It must be configured before enabling the comparator.
119+
120+
event-input-enable:
121+
type: boolean
122+
description: |
123+
Enable the event input path for the comparator.
124+
125+
event-output-enable:
126+
type: boolean
127+
description: |
128+
Enable the event output path for the comparator.

0 commit comments

Comments
 (0)