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