xref: /linux/Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml (revision 2eff01ee2881becc9daaa0d53477ec202136b1f4)
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    items:
150      - const: convst1
151      - const: convst2
152
153  io-backends:
154    description:
155      A reference to the iio-backend, which is responsible handling the BUSY
156      pin's falling edge and communication.
157      An example of backend can be found at
158      http://analogdevicesinc.github.io/hdl/library/axi_ad7606x/index.html
159
160
161patternProperties:
162  "^channel@[1-8]$":
163    type: object
164    $ref: adc.yaml
165    unevaluatedProperties: false
166
167    properties:
168      reg:
169        description:
170          The channel number, as specified in the datasheet (from 1 to 8).
171        minimum: 1
172        maximum: 8
173
174      diff-channels:
175        description:
176          Each channel can be configured as a bipolar differential channel.
177          The ADC uses the same positive and negative inputs for this.
178          This property must be specified as 'reg' (or the channel number) for
179          both positive and negative inputs (i.e. diff-channels = <reg reg>).
180          Since the configuration is bipolar differential, the 'bipolar'
181          property is required.
182        items:
183          minimum: 1
184          maximum: 8
185
186      bipolar:
187        description:
188          The ADC channels can be configured as
189             * Bipolar single-ended
190             * Unipolar single-ended
191             * Bipolar differential
192          Therefore in the DT, if no channel node is specified, it is considered
193          'unipolar single-ended'. So for the other configurations the 'bipolar'
194          property must be specified. If 'diff-channels' is specified, it is
195          considered a bipolar differential channel. Otherwise it is bipolar
196          single-ended.
197
198    required:
199      - reg
200      - bipolar
201
202required:
203  - compatible
204  - reg
205  - avcc-supply
206  - vdrive-supply
207
208allOf:
209  - $ref: /schemas/spi/spi-peripheral-props.yaml#
210
211  - oneOf:
212      - required:
213          - adi,conversion-start-gpios
214      - required:
215          - pwms
216
217  - oneOf:
218      - required:
219          - interrupts
220      - required:
221          - io-backends
222
223  - if:
224      properties:
225        compatible:
226          contains:
227            const: adi,ad7616
228    then:
229      properties:
230        adi,first-data-gpios: false
231        standby-gpios: false
232        adi,range-gpios:
233          maxItems: 2
234    else:
235      properties:
236        adi,range-gpios:
237          maxItems: 1
238
239  - if:
240      properties:
241        compatible:
242          contains:
243            enum:
244              - adi,ad7605-4
245              - adi,ad7616
246    then:
247      properties:
248        adi,oversampling-ratio-gpios: false
249
250  - if:
251      properties:
252        compatible:
253          contains:
254            enum:
255              - adi,ad7605-4
256              - adi,ad7606-4
257              - adi,ad7606-6
258              - adi,ad7606-8
259              - adi,ad7607
260              - adi,ad7608
261              - adi,ad7609
262    then:
263      properties:
264        adi,sw-mode: false
265    else:
266      properties:
267        pwms:
268          maxItems: 1
269        pwm-names:
270          maxItems: 1
271        adi,conversion-start-gpios:
272          maxItems: 1
273
274  - if:
275      not:
276        required:
277          - adi,sw-mode
278    then:
279      patternProperties:
280        "^channel@[1-8]$": false
281
282  - if:
283      not:
284        properties:
285          compatible:
286            enum:
287              - adi,ad7606c-16
288              - adi,ad7606c-18
289    then:
290      patternProperties:
291        "^channel@[1-8]$": false
292
293unevaluatedProperties: false
294
295examples:
296  - |
297    #include <dt-bindings/gpio/gpio.h>
298    iio-backend {
299        #address-cells = <1>;
300        #size-cells = <0>;
301        adi_adc@0 {
302            compatible = "adi,ad7606b";
303            reg = <0>;
304            pwms = <&axi_pwm_gen 0 0>;
305
306            avcc-supply = <&adc_vref>;
307            vdrive-supply = <&vdd_supply>;
308
309            reset-gpios = <&gpio0 91 GPIO_ACTIVE_HIGH>;
310            standby-gpios = <&gpio0 90 GPIO_ACTIVE_LOW>;
311            adi,range-gpios = <&gpio0 89 GPIO_ACTIVE_HIGH>;
312            adi,oversampling-ratio-gpios = <&gpio0 88 GPIO_ACTIVE_HIGH
313                                            &gpio0 87 GPIO_ACTIVE_HIGH
314                                            &gpio0 86 GPIO_ACTIVE_HIGH>;
315            io-backends = <&iio_backend>;
316        };
317    };
318
319  - |
320    #include <dt-bindings/gpio/gpio.h>
321    #include <dt-bindings/interrupt-controller/irq.h>
322    spi {
323        #address-cells = <1>;
324        #size-cells = <0>;
325
326        adc@0 {
327            compatible = "adi,ad7606-8";
328            reg = <0>;
329            spi-max-frequency = <1000000>;
330            spi-cpol;
331
332            avcc-supply = <&adc_vref>;
333            vdrive-supply = <&vdd_supply>;
334
335            interrupts = <25 IRQ_TYPE_EDGE_FALLING>;
336            interrupt-parent = <&gpio>;
337
338            adi,conversion-start-gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
339            reset-gpios = <&gpio 27 GPIO_ACTIVE_HIGH>;
340            adi,first-data-gpios = <&gpio 22 GPIO_ACTIVE_HIGH>;
341            adi,oversampling-ratio-gpios = <&gpio 18 GPIO_ACTIVE_HIGH>,
342                                           <&gpio 23 GPIO_ACTIVE_HIGH>,
343                                           <&gpio 26 GPIO_ACTIVE_HIGH>;
344            standby-gpios = <&gpio 24 GPIO_ACTIVE_LOW>;
345        };
346    };
347  - |
348    #include <dt-bindings/gpio/gpio.h>
349    #include <dt-bindings/interrupt-controller/irq.h>
350    spi {
351        #address-cells = <1>;
352        #size-cells = <0>;
353
354        adc@0 {
355            compatible = "adi,ad7606c-18";
356            reg = <0>;
357
358            #address-cells = <1>;
359            #size-cells = <0>;
360
361            spi-max-frequency = <1000000>;
362            spi-cpol;
363
364            avcc-supply = <&adc_vref>;
365            vdrive-supply = <&vdd_supply>;
366
367            interrupts = <25 IRQ_TYPE_EDGE_FALLING>;
368            interrupt-parent = <&gpio>;
369
370            adi,conversion-start-gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
371            reset-gpios = <&gpio 27 GPIO_ACTIVE_HIGH>;
372            adi,first-data-gpios = <&gpio 22 GPIO_ACTIVE_HIGH>;
373            standby-gpios = <&gpio 24 GPIO_ACTIVE_LOW>;
374
375            adi,sw-mode;
376
377            channel@1 {
378                reg = <1>;
379                diff-channels = <1 1>;
380                bipolar;
381            };
382
383            channel@3 {
384                reg = <3>;
385                bipolar;
386            };
387
388            channel@8 {
389                reg = <8>;
390                diff-channels = <8 8>;
391                bipolar;
392            };
393
394        };
395    };
396...
397