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