1# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2# Copyright 2019 Analog Devices Inc.
3%YAML 1.2
4---
5$id: http://devicetree.org/schemas/iio/adc/adi,ad7124.yaml#
6$schema: http://devicetree.org/meta-schemas/core.yaml#
7
8title: Analog Devices AD7124 ADC device driver
9
10maintainers:
11  - Stefan Popa <[email protected]>
12
13description: |
14  Bindings for the Analog Devices AD7124 ADC device. Datasheet can be
15  found here:
16    https://www.analog.com/media/en/technical-documentation/data-sheets/AD7124-8.pdf
17
18properties:
19  compatible:
20    enum:
21      - adi,ad7124-4
22      - adi,ad7124-8
23
24  reg:
25    description: SPI chip select number for the device
26    maxItems: 1
27
28  clocks:
29    maxItems: 1
30    description: phandle to the master clock (mclk)
31
32  clock-names:
33    items:
34      - const: mclk
35
36  interrupts:
37    description: IRQ line for the ADC
38    maxItems: 1
39
40  rdy-gpios:
41    description:
42      GPIO reading the R̅D̅Y̅ line. Having such a GPIO is technically optional but
43      highly recommended because DOUT/R̅D̅Y̅ toggles during SPI transfers (in its
44      DOUT aka MISO role) and so usually triggers a spurious interrupt. The
45      distinction between such a spurious event and a real one can only be done
46      by reading such a GPIO. (There is a register telling the same
47      information, but accessing that one needs a SPI transfer which then
48      triggers another interrupt event.)
49    maxItems: 1
50
51  '#address-cells':
52    const: 1
53
54  '#size-cells':
55    const: 0
56
57  refin1-supply:
58    description: refin1 supply can be used as reference for conversion.
59
60  refin2-supply:
61    description: refin2 supply can be used as reference for conversion.
62
63  avdd-supply:
64    description: avdd supply can be used as reference for conversion.
65
66required:
67  - compatible
68  - reg
69  - clocks
70  - clock-names
71  - interrupts
72
73patternProperties:
74  "^channel@([0-9]|1[0-5])$":
75    $ref: adc.yaml
76    type: object
77    description: |
78      Represents the external channels which are connected to the ADC.
79
80    properties:
81      reg:
82        description: |
83          The channel number. It can have up to 8 channels on ad7124-4
84          and 16 channels on ad7124-8, numbered from 0 to 15.
85        items:
86          minimum: 0
87          maximum: 15
88
89      adi,reference-select:
90        description: |
91          Select the reference source to use when converting on
92          the specific channel. Valid values are:
93          0: REFIN1(+)/REFIN1(−).
94          1: REFIN2(+)/REFIN2(−).
95          3: AVDD
96          If this field is left empty, internal reference is selected.
97        $ref: /schemas/types.yaml#/definitions/uint32
98        enum: [0, 1, 3]
99
100      diff-channels: true
101
102      bipolar: true
103
104      adi,buffered-positive:
105        description: Enable buffered mode for positive input.
106        type: boolean
107
108      adi,buffered-negative:
109        description: Enable buffered mode for negative input.
110        type: boolean
111
112    required:
113      - reg
114      - diff-channels
115
116    additionalProperties: false
117
118allOf:
119  - $ref: /schemas/spi/spi-peripheral-props.yaml#
120
121unevaluatedProperties: false
122
123examples:
124  - |
125    #include <dt-bindings/gpio/gpio.h>
126    spi {
127      #address-cells = <1>;
128      #size-cells = <0>;
129
130      adc@0 {
131        compatible = "adi,ad7124-4";
132        reg = <0>;
133        spi-max-frequency = <5000000>;
134        interrupts = <25 2>;
135        interrupt-parent = <&gpio>;
136        rdy-gpios = <&gpio 25 GPIO_ACTIVE_LOW>;
137        refin1-supply = <&adc_vref>;
138        clocks = <&ad7124_mclk>;
139        clock-names = "mclk";
140
141        #address-cells = <1>;
142        #size-cells = <0>;
143
144        channel@0 {
145          reg = <0>;
146          diff-channels = <0 1>;
147          adi,reference-select = <0>;
148          adi,buffered-positive;
149        };
150
151        channel@1 {
152          reg = <1>;
153          bipolar;
154          diff-channels = <2 3>;
155          adi,reference-select = <0>;
156          adi,buffered-positive;
157          adi,buffered-negative;
158        };
159
160        channel@2 {
161          reg = <2>;
162          diff-channels = <4 5>;
163        };
164
165        channel@3 {
166          reg = <3>;
167          diff-channels = <6 7>;
168        };
169      };
170    };
171