1# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2# Copyright 2022 Analog Devices Inc.
3%YAML 1.2
4---
5$id: http://devicetree.org/schemas/iio/adc/adi,ad4130.yaml#
6$schema: http://devicetree.org/meta-schemas/core.yaml#
7
8title: Analog Devices AD4130 ADC device driver
9
10maintainers:
11  - Cosmin Tanislav <cosmin.tanislav@analog.com>
12
13description: |
14  Bindings for the Analog Devices AD4130 ADC. Datasheet can be found here:
15    https://www.analog.com/media/en/technical-documentation/data-sheets/AD4130-8.pdf
16
17properties:
18  compatible:
19    enum:
20      - adi,ad4130
21
22  reg:
23    maxItems: 1
24
25  clocks:
26    maxItems: 1
27    description: phandle to the master clock (mclk)
28
29  clock-names:
30    items:
31      - const: mclk
32
33  interrupts:
34    maxItems: 1
35
36  interrupt-names:
37    description: |
38      Specify which interrupt pin should be configured as Data Ready / FIFO
39      interrupt.
40      Default if not supplied is int.
41    enum:
42      - int
43      - clk
44      - p2
45      - dout
46
47  '#address-cells':
48    const: 1
49
50  '#size-cells':
51    const: 0
52
53  '#clock-cells':
54    const: 0
55
56  clock-output-names:
57    maxItems: 1
58
59  refin1-supply:
60    description: refin1 supply. Can be used as reference for conversion.
61
62  refin2-supply:
63    description: refin2 supply. Can be used as reference for conversion.
64
65  avdd-supply:
66    description: AVDD voltage supply. Can be used as reference for conversion.
67
68  iovdd-supply:
69    description: IOVDD voltage supply. Used for the chip interface.
70
71  spi-max-frequency:
72    maximum: 5000000
73
74  adi,ext-clk-freq-hz:
75    description: Specify the frequency of the external clock.
76    enum: [76800, 153600]
77    default: 76800
78
79  adi,bipolar:
80    description: Specify if the device should be used in bipolar mode.
81    type: boolean
82
83  adi,vbias-pins:
84    description: Analog inputs to apply a voltage bias of (AVDD − AVSS) / 2 to.
85    $ref: /schemas/types.yaml#/definitions/uint32-array
86    minItems: 1
87    maxItems: 16
88    items:
89      minimum: 0
90      maximum: 15
91
92required:
93  - compatible
94  - reg
95  - interrupts
96
97patternProperties:
98  "^channel@([0-9a-f])$":
99    type: object
100    $ref: adc.yaml
101    unevaluatedProperties: false
102
103    properties:
104      reg:
105        description: The channel number.
106        minimum: 0
107        maximum: 15
108
109      diff-channels:
110        description: |
111          Besides the analog inputs available, internal inputs can be used.
112          16: Internal temperature sensor.
113          17: AVSS
114          18: Internal reference
115          19: DGND
116          20: (AVDD − AVSS)/6+
117          21: (AVDD − AVSS)/6-
118          22: (IOVDD − DGND)/6+
119          23: (IOVDD − DGND)/6-
120          24: (ALDO − AVSS)/6+
121          25: (ALDO − AVSS)/6-
122          26: (DLDO − DGND)/6+
123          27: (DLDO − DGND)/6-
124          28: V_MV_P
125          29: V_MV_M
126        items:
127          minimum: 0
128          maximum: 29
129
130      adi,reference-select:
131        description: |
132          Select the reference source to use when converting on the
133          specific channel. Valid values are:
134          0: REFIN1(+)/REFIN1(−)
135          1: REFIN2(+)/REFIN2(−)
136          2: REFOUT/AVSS (Internal reference)
137          3: AVDD/AVSS
138          If not specified, REFIN1 is used.
139        $ref: /schemas/types.yaml#/definitions/uint32
140        enum: [0, 1, 2, 3]
141        default: 0
142
143      adi,excitation-pin-0:
144        description: |
145          Analog input to apply excitation current to while the channel
146          is active.
147        $ref: /schemas/types.yaml#/definitions/uint32
148        minimum: 0
149        maximum: 15
150        default: 0
151
152      adi,excitation-pin-1:
153        description: |
154          Analog input to apply excitation current to while this channel
155          is active.
156        $ref: /schemas/types.yaml#/definitions/uint32
157        minimum: 0
158        maximum: 15
159        default: 0
160
161      adi,excitation-current-0-nanoamp:
162        description: |
163          Excitation current in nanoamps to be applied to pin specified in
164          adi,excitation-pin-0 while this channel is active.
165        enum: [0, 100, 10000, 20000, 50000, 100000, 150000, 200000]
166        default: 0
167
168      adi,excitation-current-1-nanoamp:
169        description: |
170          Excitation current in nanoamps to be applied to pin specified in
171          adi,excitation-pin-1 while this channel is active.
172        enum: [0, 100, 10000, 20000, 50000, 100000, 150000, 200000]
173        default: 0
174
175      adi,burnout-current-nanoamp:
176        description: |
177          Burnout current in nanoamps to be applied for this channel.
178        enum: [0, 500, 2000, 4000]
179        default: 0
180
181      adi,buffered-positive:
182        description: Enable buffered mode for positive input.
183        type: boolean
184
185      adi,buffered-negative:
186        description: Enable buffered mode for negative input.
187        type: boolean
188
189    required:
190      - reg
191      - diff-channels
192
193allOf:
194  - $ref: /schemas/spi/spi-peripheral-props.yaml#
195
196unevaluatedProperties: false
197
198examples:
199  - |
200    #include <dt-bindings/interrupt-controller/irq.h>
201
202    spi {
203      #address-cells = <1>;
204      #size-cells = <0>;
205
206      adc@0 {
207        compatible = "adi,ad4130";
208        reg = <0>;
209
210        #address-cells = <1>;
211        #size-cells = <0>;
212
213        spi-max-frequency = <5000000>;
214        interrupts = <27 IRQ_TYPE_EDGE_FALLING>;
215        interrupt-parent = <&gpio>;
216
217        channel@0 {
218          reg = <0>;
219
220          adi,reference-select = <2>;
221
222          /* AIN8, AIN9 */
223          diff-channels = <8 9>;
224        };
225
226        channel@1 {
227          reg = <1>;
228
229          adi,reference-select = <2>;
230
231          /* AIN10, AIN11 */
232          diff-channels = <10 11>;
233        };
234
235        channel@2 {
236          reg = <2>;
237
238          adi,reference-select = <2>;
239
240          /* Temperature Sensor, DGND */
241          diff-channels = <16 19>;
242        };
243
244        channel@3 {
245          reg = <3>;
246
247          adi,reference-select = <2>;
248
249          /* Internal reference, DGND */
250          diff-channels = <18 19>;
251        };
252
253        channel@4 {
254          reg = <4>;
255
256          adi,reference-select = <2>;
257
258          /* DGND, DGND */
259          diff-channels = <19 19>;
260        };
261      };
262    };
263