Skip to content

Commit d7f92d0

Browse files
hfakkizoknshn
authored andcommitted
dts: arm: adi: Add ADC inside devicetree
Add ADC peripheral definiton inside device tree file Add devicetree bindings for MAX32 ADC driver. Signed-off-by: Furkan Akkiz <[email protected]> Co-authored-by: Okan Sahin <[email protected]>
1 parent 11a172a commit d7f92d0

File tree

7 files changed

+147
-0
lines changed

7 files changed

+147
-0
lines changed

dts/arm/adi/max32/max32662.dtsi

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@
2222

2323
/delete-node/ &uart2;
2424

25+
&adc {
26+
compatible = "adi,max32-adc-sar", "adi,max32-adc";
27+
clock-source = <ADI_MAX32_PRPH_CLK_SRC_PCLK>;
28+
clock-divider = <16>;
29+
channel-count = <19>;
30+
track-count = <4>;
31+
idle-count = <0>;
32+
vref-mv = <1250>;
33+
resolution = <12>;
34+
};
35+
2536
/* MAX32662 extra peripherals. */
2637
/ {
2738
soc {

dts/arm/adi/max32/max32672.dtsi

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@
2222

2323
/delete-node/ &clk_iso;
2424

25+
&adc {
26+
compatible = "adi,max32-adc-sar", "adi,max32-adc";
27+
clock-source = <ADI_MAX32_PRPH_CLK_SRC_PCLK>;
28+
clock-divider = <16>;
29+
channel-count = <16>;
30+
track-count = <4>;
31+
idle-count = <0>;
32+
vref-mv = <1250>;
33+
resolution = <12>;
34+
};
35+
2536
/* MAX32672 extra peripherals. */
2637
/ {
2738
soc {

dts/arm/adi/max32/max32690.dtsi

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,17 @@
5454
};
5555
};
5656

57+
&adc {
58+
compatible = "adi,max32-adc-sar", "adi,max32-adc";
59+
clock-source = <ADI_MAX32_PRPH_CLK_SRC_PCLK>;
60+
clock-divider = <16>;
61+
channel-count = <21>;
62+
track-count = <4>;
63+
idle-count = <5>;
64+
vref-mv = <1250>;
65+
resolution = <12>;
66+
};
67+
5768
/* MAX32690 extra peripherals. */
5869
/ {
5970
soc {

dts/arm/adi/max32/max32xxx.dtsi

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <zephyr/dt-bindings/gpio/gpio.h>
99
#include <zephyr/dt-bindings/clock/adi_max32_clock.h>
1010
#include <zephyr/dt-bindings/i2c/i2c.h>
11+
#include <zephyr/dt-bindings/adc/adc.h>
1112

1213
#include <freq.h>
1314

@@ -205,6 +206,18 @@
205206
clock-source = <ADI_MAX32_PRPH_CLK_SRC_PCLK>;
206207
status = "disabled";
207208
};
209+
210+
adc: adc@40034000 {
211+
compatible = "adi,max32-adc-10b", "adi,max32-adc";
212+
reg = <0x40034000 0x1000>;
213+
clocks = <&gcr ADI_MAX32_CLOCK_BUS0 23>;
214+
channel-count = <17>;
215+
#io-channel-cells = <1>;
216+
interrupts = <20 0>;
217+
resolution = <10>;
218+
vref-mv = <1220>;
219+
status = "disabled";
220+
};
208221
};
209222
};
210223

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright (c) 2023-2024 Analog Devices, Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
description: ADI MAX32 ADC 10-Bits
5+
6+
compatible: "adi,max32-adc-10b"
7+
8+
include:
9+
- name: adi,max32-adc.yaml
10+
property-blocklist:
11+
- clock-source
12+
- clock-divider
13+
- track-count
14+
- idle-count
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (c) 2023-2024 Analog Devices, Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
description: ADI MAX32 ADC SAR
5+
6+
compatible: "adi,max32-adc-sar"
7+
8+
include: adi,max32-adc.yaml

dts/bindings/adc/adi,max32-adc.yaml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Copyright (c) 2023-2024 Analog Devices, Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
description: ADI MAX32 ADC
5+
6+
compatible: "adi,max32-adc"
7+
8+
include: [adc-controller.yaml, pinctrl-device.yaml]
9+
10+
properties:
11+
reg:
12+
required: true
13+
14+
interrupts:
15+
required: true
16+
17+
clocks:
18+
required: true
19+
20+
pinctrl-0:
21+
required: true
22+
23+
pinctrl-names:
24+
required: true
25+
26+
channel-count:
27+
type: int
28+
required: true
29+
description: The maximum channels supported on each unit.
30+
31+
vref-mv:
32+
type: int
33+
required: true
34+
description: Indicates the reference voltage of the ADC in mV (on the target board).
35+
36+
resolution:
37+
type: int
38+
required: true
39+
description: Indicates the resolution supported by the ADC instance.
40+
41+
clock-source:
42+
required: true
43+
type: int
44+
enum: [0, 1, 2, 3]
45+
description: |
46+
Clock source to be used by the ADC peripheral. The following options
47+
are available:
48+
- 0: "ADI_MAX32_PRPH_CLK_SRC_PCLK" Peripheral clock
49+
- 1: "ADI_MAX32_PRPH_CLK_SRC_EXTCLK" External Clock
50+
- 2: "ADI_MAX32_PRPH_CLK_SRC_IBRO" Internal Baud Rate Oscillator
51+
- 3: "ADI_MAX32_PRPH_CLK_SRC_ERFO" External Radio Frequency Oscillator
52+
The target device might not support every option please take a look on
53+
target device user guide
54+
55+
clock-divider:
56+
required: true
57+
type: int
58+
enum: [1, 2, 4, 8, 16]
59+
description: |
60+
The clock divider divides the ADC source clock to set the ADC clock frequency as follows:
61+
F_sar_clk = F_clock_source / clock divider
62+
63+
track-count:
64+
required: true
65+
type: int
66+
description: |
67+
The number of cycles to add to the minimum track time.
68+
69+
idle-count:
70+
required: true
71+
type: int
72+
description: |
73+
The number of cycles to add to the minimum hold time.
74+
75+
"#io-channel-cells":
76+
const: 1
77+
78+
io-channel-cells:
79+
- input

0 commit comments

Comments
 (0)