Skip to content

Commit 8ca23ff

Browse files
ananglmbolivar-nordic
authored andcommitted
dts: Add ADC controller child binding for channel configuration
Extend the common ADC controller binding with a child binding that allows specifying configuration of ADC channels. Signed-off-by: Andrzej Głąbek <[email protected]>
1 parent 0380f11 commit 8ca23ff

File tree

1 file changed

+144
-0
lines changed

1 file changed

+144
-0
lines changed

dts/bindings/adc/adc-controller.yaml

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Copyright (c) 2017, NXP
2+
# Copyright (c) 2022, Nordic Semiconductor ASA
23
# SPDX-License-Identifier: Apache-2.0
34

45
# Common fields for ADC controllers
@@ -12,3 +13,146 @@ properties:
1213
"#io-channel-cells":
1314
type: int
1415
required: true
16+
17+
"#address-cells":
18+
required: false
19+
const: 1
20+
21+
"#size-cells":
22+
required: false
23+
const: 0
24+
25+
child-binding:
26+
description: |
27+
Channel configuration.
28+
29+
All nodes using this binding must be named "channel", otherwise their
30+
data will not be accessible for the ADC API macros.
31+
32+
This is based on Linux, documentation:
33+
https://www.kernel.org/doc/Documentation/devicetree/bindings/iio/adc/adc.yaml
34+
35+
properties:
36+
reg:
37+
type: array
38+
required: true
39+
description: Channel identifier.
40+
41+
zephyr,gain:
42+
type: string
43+
required: true
44+
description: |
45+
Gain selection:
46+
- ADC_GAIN_1_6: x 1/6
47+
- ADC_GAIN_1_5: x 1/5
48+
- ADC_GAIN_1_4: x 1/4
49+
- ADC_GAIN_1_3: x 1/3
50+
- ADC_GAIN_2_5: x 2/5
51+
- ADC_GAIN_1_2: x 1/2
52+
- ADC_GAIN_2_3: x 2/3
53+
- ADC_GAIN_4_5: x 4/5
54+
- ADC_GAIN_1: x 1
55+
- ADC_GAIN_2: x 2
56+
- ADC_GAIN_3: x 3
57+
- ADC_GAIN_4: x 4
58+
- ADC_GAIN_6: x 6
59+
- ADC_GAIN_8: x 8
60+
- ADC_GAIN_12: x 12
61+
- ADC_GAIN_16: x 16
62+
- ADC_GAIN_24: x 24
63+
- ADC_GAIN_32: x 32
64+
- ADC_GAIN_64: x 64
65+
- ADC_GAIN_128: x 128
66+
enum:
67+
- "ADC_GAIN_1_6"
68+
- "ADC_GAIN_1_5"
69+
- "ADC_GAIN_1_4"
70+
- "ADC_GAIN_1_3"
71+
- "ADC_GAIN_2_5"
72+
- "ADC_GAIN_1_2"
73+
- "ADC_GAIN_2_3"
74+
- "ADC_GAIN_4_5"
75+
- "ADC_GAIN_1"
76+
- "ADC_GAIN_2"
77+
- "ADC_GAIN_3"
78+
- "ADC_GAIN_4"
79+
- "ADC_GAIN_6"
80+
- "ADC_GAIN_8"
81+
- "ADC_GAIN_12"
82+
- "ADC_GAIN_16"
83+
- "ADC_GAIN_24"
84+
- "ADC_GAIN_32"
85+
- "ADC_GAIN_64"
86+
- "ADC_GAIN_128"
87+
88+
zephyr,reference:
89+
type: string
90+
required: true
91+
description: |
92+
Reference selection:
93+
- ADC_REF_VDD_1: VDD
94+
- ADC_REF_VDD_1_2: VDD/2
95+
- ADC_REF_VDD_1_3: VDD/3
96+
- ADC_REF_VDD_1_4: VDD/4
97+
- ADC_REF_INTERNAL: Internal
98+
- ADC_REF_EXTERNAL0: External, input 0
99+
- ADC_REF_EXTERNAL1: External, input 1
100+
enum:
101+
- "ADC_REF_VDD_1"
102+
- "ADC_REF_VDD_1_2"
103+
- "ADC_REF_VDD_1_3"
104+
- "ADC_REF_VDD_1_4"
105+
- "ADC_REF_INTERNAL"
106+
- "ADC_REF_EXTERNAL0"
107+
- "ADC_REF_EXTERNAL1"
108+
109+
zephyr,vref-mv:
110+
type: int
111+
required: false
112+
description: |
113+
This property can be used to specify the voltage (in millivolts)
114+
of the reference selected for this channel, so that applications
115+
can get that value if needed for some calculations.
116+
For the internal reference, the voltage can be usually obtained with
117+
a dedicated ADC API call, so there is no need to use this property
118+
in that case, but for other references this property can be useful.
119+
120+
zephyr,acquisition-time:
121+
type: int
122+
required: true
123+
description: |
124+
Acquisition time.
125+
Use the ADC_ACQ_TIME macro to compose the value for this property
126+
or pass ADC_ACQ_TIME_DEFAULT to use the default setting for a given
127+
hardware (e.g. when the hardware does not allow to configure the
128+
acquisition time).
129+
130+
zephyr,input-positive:
131+
type: int
132+
required: false
133+
description: |
134+
Positive ADC input. Used only for drivers that select
135+
the ADC_CONFIGURABLE_INPUTS Kconfig option.
136+
137+
zephyr,input-negative:
138+
type: int
139+
required: false
140+
description: |
141+
Negative ADC input. Used only for drivers that select
142+
the ADC_CONFIGURABLE_INPUTS Kconfig option.
143+
When specified, the channel is to be used in differential input mode,
144+
otherwise, single-ended mode is used.
145+
146+
zephyr,resolution:
147+
type: int
148+
required: false
149+
description: |
150+
ADC resolution to be used for the channel.
151+
152+
zephyr,oversampling:
153+
type: int
154+
required: false
155+
description: |
156+
Oversampling setting to be used for the channel.
157+
When specified, each sample is averaged from 2^N conversion results
158+
(where N is the provided value).

0 commit comments

Comments
 (0)