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_2_7: x 2/7
45        - ADC_GAIN_1_3: x 1/3
46        - ADC_GAIN_2_5: x 2/5
47        - ADC_GAIN_1_2: x 1/2
48        - ADC_GAIN_2_3: x 2/3
49        - ADC_GAIN_4_5: x 4/5
50        - ADC_GAIN_1:   x 1
51        - ADC_GAIN_2:   x 2
52        - ADC_GAIN_3:   x 3
53        - ADC_GAIN_4:   x 4
54        - ADC_GAIN_6:   x 6
55        - ADC_GAIN_8:   x 8
56        - ADC_GAIN_12:  x 12
57        - ADC_GAIN_16:  x 16
58        - ADC_GAIN_24:  x 24
59        - ADC_GAIN_32:  x 32
60        - ADC_GAIN_64:  x 64
61        - ADC_GAIN_128: x 128
62      enum:
63        - "ADC_GAIN_1_6"
64        - "ADC_GAIN_1_5"
65        - "ADC_GAIN_1_4"
66        - "ADC_GAIN_2_7"
67        - "ADC_GAIN_1_3"
68        - "ADC_GAIN_2_5"
69        - "ADC_GAIN_1_2"
70        - "ADC_GAIN_2_3"
71        - "ADC_GAIN_4_5"
72        - "ADC_GAIN_1"
73        - "ADC_GAIN_2"
74        - "ADC_GAIN_3"
75        - "ADC_GAIN_4"
76        - "ADC_GAIN_6"
77        - "ADC_GAIN_8"
78        - "ADC_GAIN_12"
79        - "ADC_GAIN_16"
80        - "ADC_GAIN_24"
81        - "ADC_GAIN_32"
82        - "ADC_GAIN_64"
83        - "ADC_GAIN_128"
84
85    zephyr,reference:
86      type: string
87      required: true
88      description: |
89        Reference selection:
90        - ADC_REF_VDD_1:     VDD
91        - ADC_REF_VDD_1_2:   VDD/2
92        - ADC_REF_VDD_1_3:   VDD/3
93        - ADC_REF_VDD_1_4:   VDD/4
94        - ADC_REF_INTERNAL:  Internal
95        - ADC_REF_EXTERNAL0: External, input 0
96        - ADC_REF_EXTERNAL1: External, input 1
97      enum:
98        - "ADC_REF_VDD_1"
99        - "ADC_REF_VDD_1_2"
100        - "ADC_REF_VDD_1_3"
101        - "ADC_REF_VDD_1_4"
102        - "ADC_REF_INTERNAL"
103        - "ADC_REF_EXTERNAL0"
104        - "ADC_REF_EXTERNAL1"
105
106    zephyr,vref-mv:
107      type: int
108      description: |
109        This property can be used to specify the voltage (in millivolts)
110        of the reference selected for this channel, so that applications
111        can get that value if needed for some calculations.
112        For the internal reference, the voltage can be usually obtained with
113        a dedicated ADC API call, so there is no need to use this property
114        in that case, but for other references this property can be useful.
115
116    zephyr,acquisition-time:
117      type: int
118      required: true
119      description: |
120        Acquisition time.
121        Use the ADC_ACQ_TIME macro to compose the value for this property
122        or pass ADC_ACQ_TIME_DEFAULT to use the default setting for a given
123        hardware (e.g. when the hardware does not allow to configure the
124        acquisition time).
125
126    zephyr,differential:
127      type: boolean
128      description: |
129        When set, selects differential input mode for the channel. Otherwise,
130        single-ended mode is used unless the zephyr,input-negative property is
131        specified, in which case the differential mode is selected implicitly.
132
133    zephyr,input-positive:
134      type: int
135      description: |
136        Positive ADC input. Used only for drivers that select
137        the ADC_CONFIGURABLE_INPUTS Kconfig option.
138
139    zephyr,input-negative:
140      type: int
141      description: |
142        Negative ADC input. Used only for drivers that select
143        the ADC_CONFIGURABLE_INPUTS Kconfig option.
144        When specified, implies the differential input mode for the channel.
145
146    zephyr,resolution:
147      type: int
148      description: |
149        ADC resolution to be used for the channel.
150
151    zephyr,oversampling:
152      type: int
153      description: |
154        Oversampling setting to be used for the channel.
155        When specified, each sample is averaged from 2^N conversion results
156        (where N is the provided value).
157
158    zephyr,current-source-pin:
159      type: uint8-array
160      description: |
161        Output pin selection for the current sources. The actual
162        interpretation depends on the driver. This is used only for drivers
163        which select the ADC_CONFIGURABLE_EXCITATION_CURRENT_SOURCE_PIN
164        Kconfig option.
165
166    zephyr,vbias-pins:
167      type: int
168      description: |
169        Output pin selection for the bias voltage. The actual interpretation
170        depends on the driver. This is used only for drivers which select
171        the ADC_CONFIGURABLE_VBIAS_PIN Kconfig option.
172