xref: /linux/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml (revision a1ff5a7d78a036d6c2178ee5acd6ba4946243800)
1# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2# Copyright 2023 Analog Devices Inc.
3%YAML 1.2
4---
5$id: http://devicetree.org/schemas/iio/adc/adi,ad7173.yaml#
6$schema: http://devicetree.org/meta-schemas/core.yaml#
7
8title: Analog Devices AD7173 ADC
9
10maintainers:
11  - Ceclan Dumitru <dumitru.ceclan@analog.com>
12
13description: |
14  Analog Devices AD717x ADC's:
15  The AD717x family offer a complete integrated Sigma-Delta ADC solution which
16  can be used in high precision, low noise single channel applications
17  (Life Science measurements) or higher speed multiplexed applications
18  (Factory Automation PLC Input modules). The Sigma-Delta ADC is intended
19  primarily for measurement of signals close to DC but also delivers
20  outstanding performance with input bandwidths out to ~10kHz.
21
22  Analog Devices AD411x ADC's:
23  The AD411X family encompasses a series of low power, low noise, 24-bit,
24  sigma-delta analog-to-digital converters that offer a versatile range of
25  specifications. They integrate an analog front end suitable for processing
26  fully differential/single-ended and bipolar voltage inputs.
27
28  Datasheets for supported chips:
29    https://www.analog.com/media/en/technical-documentation/data-sheets/AD4111.pdf
30    https://www.analog.com/media/en/technical-documentation/data-sheets/AD4112.pdf
31    https://www.analog.com/media/en/technical-documentation/data-sheets/AD4114.pdf
32    https://www.analog.com/media/en/technical-documentation/data-sheets/AD4115.pdf
33    https://www.analog.com/media/en/technical-documentation/data-sheets/AD4116.pdf
34    https://www.analog.com/media/en/technical-documentation/data-sheets/AD7172-2.pdf
35    https://www.analog.com/media/en/technical-documentation/data-sheets/AD7172-4.pdf
36    https://www.analog.com/media/en/technical-documentation/data-sheets/AD7173-8.pdf
37    https://www.analog.com/media/en/technical-documentation/data-sheets/AD7175-2.pdf
38    https://www.analog.com/media/en/technical-documentation/data-sheets/AD7175-8.pdf
39    https://www.analog.com/media/en/technical-documentation/data-sheets/AD7176-2.pdf
40    https://www.analog.com/media/en/technical-documentation/data-sheets/AD7177-2.pdf
41
42properties:
43  compatible:
44    enum:
45      - adi,ad4111
46      - adi,ad4112
47      - adi,ad4114
48      - adi,ad4115
49      - adi,ad4116
50      - adi,ad7172-2
51      - adi,ad7172-4
52      - adi,ad7173-8
53      - adi,ad7175-2
54      - adi,ad7175-8
55      - adi,ad7176-2
56      - adi,ad7177-2
57
58  reg:
59    maxItems: 1
60
61  interrupts:
62    minItems: 1
63    items:
64      - description: |
65          Ready: multiplexed with SPI data out. While SPI CS is low,
66          can be used to indicate the completion of a conversion.
67
68      - description: |
69          Error: The three error bits in the status register (ADC_ERROR, CRC_ERROR,
70          and REG_ERROR) are OR'ed, inverted, and mapped to the ERROR pin.
71          Therefore, the ERROR pin indicates that an error has occurred.
72
73  interrupt-names:
74    minItems: 1
75    items:
76      - const: rdy
77      - const: err
78
79  '#address-cells':
80    const: 1
81
82  '#size-cells':
83    const: 0
84
85  spi-max-frequency:
86    maximum: 20000000
87
88  gpio-controller:
89    description: Marks the device node as a GPIO controller.
90
91  '#gpio-cells':
92    const: 2
93    description:
94      The first cell is the GPIO number and the second cell specifies
95      GPIO flags, as defined in <dt-bindings/gpio/gpio.h>.
96
97  vref-supply:
98    description: |
99      Differential external reference supply used for conversion. The reference
100      voltage (Vref) specified here must be the voltage difference between the
101      REF+ and REF- pins: Vref = (REF+) - (REF-).
102
103  vref2-supply:
104    description: |
105      Differential external reference supply used for conversion. The reference
106      voltage (Vref2) specified here must be the voltage difference between the
107      REF2+ and REF2- pins: Vref2 = (REF2+) - (REF2-).
108
109  avdd-supply:
110    description: Avdd supply, can be used as reference for conversion.
111                 This supply is referenced to AVSS, voltage specified here
112                 represents (AVDD1 - AVSS).
113
114  avdd2-supply:
115    description: Avdd2 supply, used as the input to the internal voltage regulator.
116                 This supply is referenced to AVSS, voltage specified here
117                 represents (AVDD2 - AVSS).
118
119  iovdd-supply:
120    description: iovdd supply, used for the chip digital interface.
121
122  clocks:
123    maxItems: 1
124    description: |
125      Optional external clock source. Can include one clock source: external
126      clock or external crystal.
127
128  clock-names:
129    enum:
130      - ext-clk
131      - xtal
132
133  '#clock-cells':
134    const: 0
135
136patternProperties:
137  "^channel@[0-9a-f]$":
138    type: object
139    $ref: adc.yaml
140    unevaluatedProperties: false
141
142    properties:
143      reg:
144        minimum: 0
145        maximum: 15
146
147      diff-channels:
148        description: |
149          This property is used for defining the inputs of a differential
150          voltage channel. The first value is the positive input and the second
151          value is the negative input of the channel.
152
153          Family AD411x supports a dedicated VINCOM voltage input.
154          To select it set the second channel to 16.
155            (VIN2, VINCOM) -> diff-channels = <2 16>
156
157          There are special values that can be selected besides the voltage
158          analog inputs:
159            21: REF+
160            22: REF−
161
162          Supported only by AD7172-2, AD7172-4, AD7175-2, AD7175-8, AD7177-2,
163          must be paired together and can be used to monitor the power supply
164          of the ADC:
165            19: ((AVDD1 − AVSS)/5)+
166            20: ((AVDD1 − AVSS)/5)−
167
168        items:
169          minimum: 0
170          maximum: 31
171
172      single-channel:
173        description: |
174          This property is used for defining a current channel or the positive
175          input of a voltage channel (single-ended or pseudo-differential).
176
177          Models AD4111 and AD4112 support current channels.
178            Example: (IIN2+, IIN2−) -> single-channel = <2>
179          To correctly configure a current channel set the "adi,current-channel"
180          property to true.
181
182          To configure a single-ended/pseudo-differential channel set the
183          "common-mode-channel" property to the desired negative voltage input.
184
185          When used as a voltage channel, special inputs are valid as well.
186        minimum: 0
187        maximum: 31
188
189      common-mode-channel:
190        description:
191          This property is used for defining the negative input of a
192          single-ended or pseudo-differential voltage channel.
193
194          Special inputs are valid as well.
195        minimum: 0
196        maximum: 31
197
198      adi,reference-select:
199        description: |
200          Select the reference source to use when converting on
201          the specific channel. Valid values are:
202          vref       : REF+  /REF−
203          vref2      : REF2+ /REF2−
204          refout-avss: REFOUT/AVSS (Internal reference)
205          avdd       : AVDD  /AVSS
206
207          External reference ref2 only available on ad7173-8 and ad7172-4.
208          Internal reference refout-avss not available on ad7172-4.
209
210          If not specified, internal reference used (if available).
211        $ref: /schemas/types.yaml#/definitions/string
212        enum:
213          - vref
214          - vref2
215          - refout-avss
216          - avdd
217        default: refout-avss
218
219      adi,current-channel:
220        $ref: /schemas/types.yaml#/definitions/flag
221        description: |
222          Signal that the selected inputs are current channels.
223          Only available on AD4111 and AD4112.
224
225    required:
226      - reg
227
228    allOf:
229      - oneOf:
230          - required: [single-channel]
231            properties:
232              diff-channels: false
233          - required: [diff-channels]
234            properties:
235              single-channel: false
236              adi,current-channel: false
237              common-mode-channel: false
238
239      - if:
240          required: [common-mode-channel]
241        then:
242          properties:
243            adi,current-channel: false
244
245required:
246  - compatible
247  - reg
248
249allOf:
250  - $ref: /schemas/spi/spi-peripheral-props.yaml#
251
252  # Only ad7172-4, ad7173-8 and ad7175-8 support vref2
253  - if:
254      properties:
255        compatible:
256          not:
257            contains:
258              enum:
259                - adi,ad7172-4
260                - adi,ad7173-8
261                - adi,ad7175-8
262    then:
263      properties:
264        vref2-supply: false
265      patternProperties:
266        "^channel@[0-9a-f]$":
267          properties:
268            adi,reference-select:
269              enum:
270                - vref
271                - refout-avss
272                - avdd
273
274  - if:
275      properties:
276        compatible:
277          contains:
278            enum:
279              - adi,ad4114
280              - adi,ad4115
281              - adi,ad4116
282              - adi,ad7173-8
283              - adi,ad7175-8
284    then:
285      patternProperties:
286        "^channel@[0-9a-f]$":
287          properties:
288            reg:
289              maximum: 15
290
291  - if:
292      properties:
293        compatible:
294          contains:
295            enum:
296              - adi,ad7172-2
297              - adi,ad7175-2
298              - adi,ad7176-2
299              - adi,ad7177-2
300    then:
301      patternProperties:
302        "^channel@[0-9a-f]$":
303          properties:
304            reg:
305              maximum: 3
306
307  # Model ad7172-4 does not support internal reference
308  - if:
309      properties:
310        compatible:
311          contains:
312            const: adi,ad7172-4
313    then:
314      patternProperties:
315        "^channel@[0-9a-f]$":
316          properties:
317            reg:
318              maximum: 7
319            adi,reference-select:
320              enum:
321                - vref
322                - vref2
323                - avdd
324          required:
325            - adi,reference-select
326
327  - if:
328      properties:
329        compatible:
330          contains:
331            enum:
332              - adi,ad4111
333              - adi,ad4112
334              - adi,ad4114
335              - adi,ad4115
336              - adi,ad4116
337    then:
338      properties:
339        avdd2-supply: false
340
341  - if:
342      properties:
343        compatible:
344          not:
345            contains:
346              enum:
347                - adi,ad4111
348                - adi,ad4112
349    then:
350      patternProperties:
351        "^channel@[0-9a-f]$":
352          properties:
353            adi,current-channel: false
354
355  - if:
356      anyOf:
357        - required: [clock-names]
358        - required: [clocks]
359    then:
360      properties:
361        '#clock-cells': false
362
363unevaluatedProperties: false
364
365examples:
366  # Example AD7173-8 with external reference connected to REF+/REF-:
367  - |
368    #include <dt-bindings/gpio/gpio.h>
369    #include <dt-bindings/interrupt-controller/irq.h>
370
371    spi {
372      #address-cells = <1>;
373      #size-cells = <0>;
374
375      adc@0 {
376        compatible = "adi,ad7173-8";
377        reg = <0>;
378
379        #address-cells = <1>;
380        #size-cells = <0>;
381
382        interrupts = <25 IRQ_TYPE_EDGE_FALLING>;
383        interrupt-names = "rdy";
384        interrupt-parent = <&gpio>;
385        spi-max-frequency = <5000000>;
386        gpio-controller;
387        #gpio-cells = <2>;
388        #clock-cells = <0>;
389
390        vref-supply = <&dummy_regulator>;
391
392        channel@0 {
393          reg = <0>;
394          bipolar;
395          diff-channels = <0 1>;
396          adi,reference-select = "vref";
397        };
398
399        channel@1 {
400          reg = <1>;
401          diff-channels = <2 3>;
402        };
403
404        channel@2 {
405          reg = <2>;
406          bipolar;
407          diff-channels = <4 5>;
408        };
409
410        channel@3 {
411          reg = <3>;
412          bipolar;
413          diff-channels = <6 7>;
414        };
415
416        channel@4 {
417          reg = <4>;
418          diff-channels = <8 9>;
419          adi,reference-select = "avdd";
420        };
421      };
422    };
423
424  # Example AD4111 with current channel and single-ended channel:
425  - |
426    #include <dt-bindings/gpio/gpio.h>
427    #include <dt-bindings/interrupt-controller/irq.h>
428
429    spi {
430      #address-cells = <1>;
431      #size-cells = <0>;
432
433       adc@0 {
434        compatible = "adi,ad4111";
435        reg = <0>;
436
437        #address-cells = <1>;
438        #size-cells = <0>;
439
440        interrupts = <25 IRQ_TYPE_EDGE_FALLING>;
441        interrupt-names = "rdy";
442        interrupt-parent = <&gpio>;
443        spi-max-frequency = <5000000>;
444        gpio-controller;
445        #gpio-cells = <2>;
446        #clock-cells = <0>;
447
448        channel@0 {
449          reg = <0>;
450          bipolar;
451          diff-channels = <4 5>;
452        };
453
454        // Single ended channel VIN2/VINCOM
455        channel@1 {
456          reg = <1>;
457          bipolar;
458          single-channel = <2>;
459          common-mode-channel = <16>;
460        };
461
462        // Current channel IN2+/IN2-
463        channel@2 {
464          reg = <2>;
465          single-channel = <2>;
466          adi,current-channel;
467        };
468      };
469    };
470