xref: /linux/Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml (revision 0d5ec7919f3747193f051036b2301734a4b5e1d6)
1# SPDX-License-Identifier: GPL-2.0
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/iio/adc/adi,ad7606.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Analog Devices AD7606 Simultaneous Sampling ADC
8
9maintainers:
10  - Michael Hennerich <michael.hennerich@analog.com>
11
12description: |
13  Analog Devices AD7606 Simultaneous Sampling ADC
14  https://www.analog.com/media/en/technical-documentation/data-sheets/AD7605-4.pdf
15  https://www.analog.com/media/en/technical-documentation/data-sheets/ad7606_7606-6_7606-4.pdf
16  https://www.analog.com/media/en/technical-documentation/data-sheets/AD7606B.pdf
17  https://www.analog.com/media/en/technical-documentation/data-sheets/ad7606c-16.pdf
18  https://www.analog.com/media/en/technical-documentation/data-sheets/ad7606c-18.pdf
19  https://www.analog.com/media/en/technical-documentation/data-sheets/ad7607.pdf
20  https://www.analog.com/media/en/technical-documentation/data-sheets/ad7608.pdf
21  https://www.analog.com/media/en/technical-documentation/data-sheets/ad7609.pdf
22  https://www.analog.com/media/en/technical-documentation/data-sheets/AD7616.pdf
23
24properties:
25  compatible:
26    enum:
27      - adi,ad7605-4
28      - adi,ad7606-4
29      - adi,ad7606-6
30      - adi,ad7606-8  # Referred to as AD7606 (without -8) in the datasheet
31      - adi,ad7606b
32      - adi,ad7606c-16
33      - adi,ad7606c-18
34      - adi,ad7607
35      - adi,ad7608
36      - adi,ad7609
37      - adi,ad7616
38
39  reg:
40    maxItems: 1
41
42  "#address-cells":
43    const: 1
44
45  "#size-cells":
46    const: 0
47
48  '#trigger-source-cells':
49    description: |
50      Cell indicates the output signal: 0 = BUSY, 1 = FIRSTDATA.
51
52      For convenience, macros for these values are available in
53      dt-bindings/iio/adc/adi,ad7606.h.
54    const: 1
55
56  # According to the datasheet, "Data is clocked in from SDI on the falling
57  # edge of SCLK, while data is clocked out on DOUTA on the rising edge of
58  # SCLK".  Also, even if not stated textually in the datasheet, it is made
59  # clear on the diagrams that sclk idles at high.  Subsequently, in case SPI
60  # interface is used, the correct way is to only set spi-cpol.
61  spi-cpha: true
62
63  spi-cpol: true
64
65  avcc-supply: true
66
67  vdrive-supply:
68    description:
69      Determines the voltage level at which the interface logic pins will
70      operate.
71
72  refin-supply:
73    description:
74      The voltage supply for optional external reference voltage.
75
76  interrupts:
77    description:
78      The BUSY pin falling edge indicates that the conversion is over, and thus
79      new data is available.
80    maxItems: 1
81
82  adi,conversion-start-gpios:
83    description:
84      Must be the device tree identifier of the CONVST pin(s). This logic input
85      is used to initiate conversions on the analog input channels. As the line
86      is active high, it should be marked GPIO_ACTIVE_HIGH.
87    minItems: 1
88    maxItems: 2
89
90  reset-gpios:
91    description:
92      Must be the device tree identifier of the RESET pin. If specified, it will
93      be asserted during driver probe. On the AD7606x, as the line is active
94      high, it should be marked GPIO_ACTIVE_HIGH. On the AD7616, as the line is
95      active low, it should be marked GPIO_ACTIVE_LOW.
96    maxItems: 1
97
98  standby-gpios:
99    description:
100      Must be the device tree identifier of the STBY pin. This pin is used to
101      place the AD7606 into one of two power-down modes, Standby mode or
102      Shutdown mode. As the line is active low, it should be marked
103      GPIO_ACTIVE_LOW.
104    maxItems: 1
105
106  adi,first-data-gpios:
107    description:
108      Must be the device tree identifier of the FRSTDATA pin. The FRSTDATA
109      output indicates when the first channel, V1, is being read back on either
110      the parallel, byte or serial interface. As the line is active high, it
111      should be marked GPIO_ACTIVE_HIGH.
112    maxItems: 1
113
114  adi,range-gpios:
115    description:
116      Must be the device tree identifier of the RANGE pin. The state on this
117      pin determines the input range of the analog input channels. If this pin
118      is tied to a logic high, the analog input range is ±10V for all channels.
119      On the AD760X, if this pin is tied to a logic low, the analog input range
120      is ±5V for all channels. As the line is active high, it should be marked
121      GPIO_ACTIVE_HIGH. On the AD7616, there are 2 pins, and if the 2 pins are
122      tied to a logic high, software mode is enabled, otherwise one of the 3
123      possible range values is selected.
124    minItems: 1
125    maxItems: 2
126
127  adi,oversampling-ratio-gpios:
128    description:
129      Must be the device tree identifier of the over-sampling mode pins. As the
130      line is active high, it should be marked GPIO_ACTIVE_HIGH. On the AD7606X
131      parts that support it, if all 3 pins are tied to a logic high, software
132      mode is enabled.
133    maxItems: 3
134
135  adi,sw-mode:
136    description:
137      Software mode of operation, so far available only for AD7616 and AD7606B.
138      It is enabled when all three oversampling mode pins are connected to high
139      level for the AD7606B, or both the range selection are connected to high
140      level for the AD7616. The device is configured by the corresponding
141      registers. If the adi,oversampling-ratio-gpios property is defined, then
142      the driver will set the oversampling gpios to high. Otherwise, it is
143      assumed that the pins are hardwired to VDD.
144    type: boolean
145
146  pwms:
147    description:
148      In case the conversion is triggered by a PWM instead of a GPIO plugged to
149      the CONVST pin, the PWM must be referenced.
150      The first is the PWM connected to CONVST or CONVST1 for the chips with the
151      2nd PWM connected to CONVST2, if CONVST2 is available and not shorted to
152      CONVST1.
153    minItems: 1
154    maxItems: 2
155
156  pwm-names:
157    minItems: 1
158    items:
159      - const: convst1
160      - const: convst2
161
162  io-backends:
163    description:
164      A reference to the iio-backend, which is responsible handling the BUSY
165      pin's falling edge and communication.
166      An example of backend can be found at
167      http://analogdevicesinc.github.io/hdl/library/axi_ad7606x/index.html
168
169
170patternProperties:
171  "^channel@[1-8]$":
172    type: object
173    $ref: adc.yaml
174    unevaluatedProperties: false
175
176    properties:
177      reg:
178        description:
179          The channel number, as specified in the datasheet (from 1 to 8).
180        minimum: 1
181        maximum: 8
182
183      diff-channels:
184        description:
185          Each channel can be configured as a bipolar differential channel.
186          The ADC uses the same positive and negative inputs for this.
187          This property must be specified as 'reg' (or the channel number) for
188          both positive and negative inputs (i.e. diff-channels = <reg reg>).
189          Since the configuration is bipolar differential, the 'bipolar'
190          property is required.
191        items:
192          minimum: 1
193          maximum: 8
194
195      bipolar:
196        description:
197          The ADC channels can be configured as
198             * Bipolar single-ended
199             * Unipolar single-ended
200             * Bipolar differential
201          Therefore in the DT, if no channel node is specified, it is considered
202          'unipolar single-ended'. So for the other configurations the 'bipolar'
203          property must be specified. If 'diff-channels' is specified, it is
204          considered a bipolar differential channel. Otherwise it is bipolar
205          single-ended.
206
207      adi,rfilter-ohms:
208        description:
209          For ADCs that supports gain calibration, this property must be set to
210          the value of the external RFilter resistor. Proper gain error
211          correction is applied based on this value.
212        default: 0
213        minimum: 0
214        maximum: 64512
215
216    required:
217      - reg
218      - bipolar
219
220required:
221  - compatible
222  - reg
223  - avcc-supply
224  - vdrive-supply
225
226allOf:
227  - $ref: /schemas/spi/spi-peripheral-props.yaml#
228
229  - oneOf:
230      - required:
231          - adi,conversion-start-gpios
232      - required:
233          - pwms
234
235  - if:
236      properties:
237        compatible:
238          contains:
239            const: adi,ad7616
240    then:
241      properties:
242        adi,first-data-gpios: false
243        standby-gpios: false
244        adi,range-gpios:
245          maxItems: 2
246    else:
247      properties:
248        adi,range-gpios:
249          maxItems: 1
250
251  - if:
252      properties:
253        compatible:
254          contains:
255            enum:
256              - adi,ad7605-4
257              - adi,ad7616
258    then:
259      properties:
260        adi,oversampling-ratio-gpios: false
261
262  - if:
263      properties:
264        compatible:
265          contains:
266            enum:
267              - adi,ad7605-4
268              - adi,ad7606-4
269              - adi,ad7606-6
270              - adi,ad7606-8
271              - adi,ad7607
272              - adi,ad7608
273              - adi,ad7609
274              - adi,ad7616
275    then:
276      patternProperties:
277        "^channel@[0-9a-f]+$":
278          properties:
279            adi,rfilter-ohms: false
280
281  - if:
282      properties:
283        compatible:
284          contains:
285            enum:
286              - adi,ad7605-4
287              - adi,ad7606-4
288              - adi,ad7606-6
289              - adi,ad7606-8
290              - adi,ad7607
291              - adi,ad7608
292              - adi,ad7609
293    then:
294      properties:
295        adi,sw-mode: false
296    else:
297      properties:
298        pwms:
299          maxItems: 1
300        pwm-names:
301          maxItems: 1
302        adi,conversion-start-gpios:
303          maxItems: 1
304
305  - if:
306      not:
307        required:
308          - adi,sw-mode
309    then:
310      patternProperties:
311        "^channel@[1-8]$": false
312
313  - if:
314      not:
315        properties:
316          compatible:
317            enum:
318              - adi,ad7606c-16
319              - adi,ad7606c-18
320    then:
321      patternProperties:
322        "^channel@[1-8]$": false
323
324unevaluatedProperties: false
325
326examples:
327  - |
328    #include <dt-bindings/gpio/gpio.h>
329    iio-backend {
330        #address-cells = <1>;
331        #size-cells = <0>;
332        adi_adc@0 {
333            compatible = "adi,ad7606b";
334            reg = <0>;
335            pwms = <&axi_pwm_gen 0 0>;
336
337            avcc-supply = <&adc_vref>;
338            vdrive-supply = <&vdd_supply>;
339
340            reset-gpios = <&gpio0 91 GPIO_ACTIVE_HIGH>;
341            standby-gpios = <&gpio0 90 GPIO_ACTIVE_LOW>;
342            adi,range-gpios = <&gpio0 89 GPIO_ACTIVE_HIGH>;
343            adi,oversampling-ratio-gpios = <&gpio0 88 GPIO_ACTIVE_HIGH
344                                            &gpio0 87 GPIO_ACTIVE_HIGH
345                                            &gpio0 86 GPIO_ACTIVE_HIGH>;
346            io-backends = <&iio_backend>;
347        };
348    };
349
350  - |
351    #include <dt-bindings/gpio/gpio.h>
352    #include <dt-bindings/interrupt-controller/irq.h>
353    spi {
354        #address-cells = <1>;
355        #size-cells = <0>;
356
357        adc@0 {
358            compatible = "adi,ad7606-8";
359            reg = <0>;
360            spi-max-frequency = <1000000>;
361            spi-cpol;
362
363            avcc-supply = <&adc_vref>;
364            vdrive-supply = <&vdd_supply>;
365
366            interrupts = <25 IRQ_TYPE_EDGE_FALLING>;
367            interrupt-parent = <&gpio>;
368
369            adi,conversion-start-gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
370            reset-gpios = <&gpio 27 GPIO_ACTIVE_HIGH>;
371            adi,first-data-gpios = <&gpio 22 GPIO_ACTIVE_HIGH>;
372            adi,oversampling-ratio-gpios = <&gpio 18 GPIO_ACTIVE_HIGH>,
373                                           <&gpio 23 GPIO_ACTIVE_HIGH>,
374                                           <&gpio 26 GPIO_ACTIVE_HIGH>;
375            standby-gpios = <&gpio 24 GPIO_ACTIVE_LOW>;
376        };
377    };
378  - |
379    #include <dt-bindings/gpio/gpio.h>
380    #include <dt-bindings/interrupt-controller/irq.h>
381    spi {
382        #address-cells = <1>;
383        #size-cells = <0>;
384
385        adc@0 {
386            compatible = "adi,ad7606c-18";
387            reg = <0>;
388
389            #address-cells = <1>;
390            #size-cells = <0>;
391
392            spi-max-frequency = <1000000>;
393            spi-cpol;
394
395            avcc-supply = <&adc_vref>;
396            vdrive-supply = <&vdd_supply>;
397
398            interrupts = <25 IRQ_TYPE_EDGE_FALLING>;
399            interrupt-parent = <&gpio>;
400
401            adi,conversion-start-gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
402            reset-gpios = <&gpio 27 GPIO_ACTIVE_HIGH>;
403            adi,first-data-gpios = <&gpio 22 GPIO_ACTIVE_HIGH>;
404            standby-gpios = <&gpio 24 GPIO_ACTIVE_LOW>;
405
406            adi,sw-mode;
407
408            channel@1 {
409                reg = <1>;
410                diff-channels = <1 1>;
411                bipolar;
412            };
413
414            channel@3 {
415                reg = <3>;
416                bipolar;
417            };
418
419            channel@8 {
420                reg = <8>;
421                diff-channels = <8 8>;
422                bipolar;
423                adi,rfilter-ohms = <2048>;
424            };
425
426        };
427    };
428...
429