xref: /linux/Documentation/devicetree/bindings/iio/adc/adi,ad4695.yaml (revision c8d430db8eec7d4fd13a6bea27b7086a54eda6da)
1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/iio/adc/adi,ad4695.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Analog Devices Easy Drive Multiplexed SAR Analog to Digital Converters
8
9maintainers:
10  - Michael Hennerich <Michael.Hennerich@analog.com>
11  - Nuno Sá <nuno.sa@analog.com>
12
13description: |
14  A family of similar multi-channel analog to digital converters with SPI bus.
15
16  * https://www.analog.com/en/products/ad4695.html
17  * https://www.analog.com/en/products/ad4696.html
18  * https://www.analog.com/en/products/ad4697.html
19  * https://www.analog.com/en/products/ad4698.html
20
21$ref: /schemas/spi/spi-peripheral-props.yaml#
22
23properties:
24  compatible:
25    enum:
26      - adi,ad4695
27      - adi,ad4696
28      - adi,ad4697
29      - adi,ad4698
30
31  reg:
32    maxItems: 1
33
34  spi-max-frequency:
35    maximum: 80000000
36
37  spi-cpol: true
38  spi-cpha: true
39
40  spi-rx-bus-width:
41    minimum: 1
42    maximum: 4
43
44  avdd-supply:
45    description: Analog power supply.
46
47  vio-supply:
48    description: I/O pin power supply.
49
50  ldo-in-supply:
51    description: Internal LDO Input. Mutually exclusive with vdd-supply.
52
53  vdd-supply:
54    description: Core power supply. Mutually exclusive with ldo-in-supply.
55
56  ref-supply:
57    description:
58      External reference voltage. Mutually exclusive with refin-supply.
59
60  refin-supply:
61    description:
62      Internal reference buffer input. Mutually exclusive with ref-supply.
63
64  com-supply:
65    description: Common voltage supply for pseudo-differential analog inputs.
66
67  adi,no-ref-current-limit:
68    $ref: /schemas/types.yaml#/definitions/flag
69    description:
70      When this flag is present, the REF Overvoltage Reduced Current protection
71      is disabled.
72
73  adi,no-ref-high-z:
74    $ref: /schemas/types.yaml#/definitions/flag
75    description:
76      Enable this flag if the ref-supply requires Reference Input High-Z Mode
77      to be disabled for proper operation.
78
79  cnv-gpios:
80    description: The Convert Input (CNV). If omitted, CNV is tied to SPI CS.
81    maxItems: 1
82
83  reset-gpios:
84    description: The Reset Input (RESET). Should be configured GPIO_ACTIVE_LOW.
85    maxItems: 1
86
87  interrupts:
88    minItems: 1
89    items:
90      - description: Signal coming from the BSY_ALT_GP0 pin (ALERT or BUSY).
91      - description: Signal coming from the GP2 pin (ALERT).
92      - description: Signal coming from the GP3 pin (BUSY).
93
94  interrupt-names:
95    minItems: 1
96    items:
97      - const: gp0
98      - const: gp2
99      - const: gp3
100
101  gpio-controller: true
102
103  "#gpio-cells":
104    const: 2
105    description: |
106      The first cell is the GPn number: 0 to 3.
107      The second cell takes standard GPIO flags.
108
109  "#address-cells":
110    const: 1
111
112  "#size-cells":
113    const: 0
114
115patternProperties:
116  "^in(?:[13579]|1[135])-supply$":
117    description:
118      Optional voltage supply for odd numbered channels when they are used as
119      the negative input for a pseudo-differential channel.
120
121  "^channel@[0-9a-f]$":
122    type: object
123    $ref: adc.yaml
124    unevaluatedProperties: false
125    description:
126      Describes each individual channel. In addition the properties defined
127      below, bipolar from adc.yaml is also supported.
128
129    properties:
130      reg:
131        maximum: 15
132
133      common-mode-channel:
134        description:
135          Describes the common mode channel for single channels. 0xFF is REFGND
136          and OxFE is COM. Macros are available for these values in
137          dt-bindings/iio/adi,ad4695.h. Values 1 to 15 correspond to INx inputs.
138          Only odd numbered INx inputs can be used as common mode channels.
139        enum: [1, 3, 5, 7, 9, 11, 13, 15, 0xFE, 0xFF]
140        default: 0xFF
141
142      adi,no-high-z:
143        $ref: /schemas/types.yaml#/definitions/flag
144        description:
145          Enable this flag if the input pin requires the Analog Input High-Z
146          Mode to be disabled for proper operation.
147
148    required:
149      - reg
150
151    allOf:
152      # bipolar mode can't be used with REFGND
153      - if:
154          properties:
155            common-mode-channel:
156              const: 0xFF
157        then:
158          properties:
159            bipolar: false
160
161required:
162  - compatible
163  - reg
164  - avdd-supply
165  - vio-supply
166
167allOf:
168  - oneOf:
169      - required:
170          - ldo-in-supply
171      - required:
172          - vdd-supply
173
174  - oneOf:
175      - required:
176          - ref-supply
177      - required:
178          - refin-supply
179
180  # the internal reference buffer always requires high-z mode
181  - if:
182      required:
183        - refin-supply
184    then:
185      properties:
186        adi,no-ref-high-z: false
187
188  # limit channels for 8-channel chips
189  - if:
190      properties:
191        compatible:
192          contains:
193            enum:
194              - adi,ad4697
195              - adi,ad4698
196    then:
197      patternProperties:
198        "^in(?:9|1[135])-supply$": false
199        "^channel@[0-7]$":
200          properties:
201            reg:
202              maximum: 7
203            common-mode-channel:
204              enum: [1, 3, 5, 7, 0xFE, 0xFF]
205        "^channel@[8-9a-f]$": false
206
207unevaluatedProperties: false
208
209examples:
210  - |
211    #include <dt-bindings/gpio/gpio.h>
212    #include <dt-bindings/iio/adi,ad4695.h>
213
214    spi {
215        #address-cells = <1>;
216        #size-cells = <0>;
217
218        adc@0 {
219            compatible = "adi,ad4695";
220            reg = <0>;
221            spi-cpol;
222            spi-cpha;
223            spi-max-frequency = <80000000>;
224            avdd-supply = <&power_supply>;
225            ldo-in-supply = <&power_supply>;
226            vio-supply = <&io_supply>;
227            refin-supply = <&supply_5V>;
228            com-supply = <&supply_2V5>;
229            in3-supply = <&supply_2V5>;
230            reset-gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
231
232            #address-cells = <1>;
233            #size-cells = <0>;
234
235            /* Pseudo-differential channel between IN0 and REFGND. */
236            channel@0 {
237                reg = <0>;
238            };
239
240            /* Pseudo-differential channel between IN1 and COM. */
241            channel@1 {
242                reg = <1>;
243                common-mode-channel = <AD4695_COMMON_MODE_COM>;
244                bipolar;
245            };
246
247            /* Pseudo-differential channel between IN2 and IN3. */
248            channel@2 {
249                reg = <2>;
250                common-mode-channel = <3>;
251                bipolar;
252            };
253        };
254    };
255