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