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 <stefan.popa@analog.com>
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  '#address-cells':
41    const: 1
42
43  '#size-cells':
44    const: 0
45
46  refin1-supply:
47    description: refin1 supply can be used as reference for conversion.
48
49  refin2-supply:
50    description: refin2 supply can be used as reference for conversion.
51
52  avdd-supply:
53    description: avdd supply can be used as reference for conversion.
54
55required:
56  - compatible
57  - reg
58  - clocks
59  - clock-names
60  - interrupts
61
62patternProperties:
63  "^channel@([0-9]|1[0-5])$":
64    type: object
65    description: |
66      Represents the external channels which are connected to the ADC.
67      See Documentation/devicetree/bindings/iio/adc/adc.txt.
68
69    properties:
70      reg:
71        description: |
72          The channel number. It can have up to 8 channels on ad7124-4
73          and 16 channels on ad7124-8, numbered from 0 to 15.
74        items:
75          minimum: 0
76          maximum: 15
77
78      adi,reference-select:
79        description: |
80          Select the reference source to use when converting on
81          the specific channel. Valid values are:
82          0: REFIN1(+)/REFIN1(−).
83          1: REFIN2(+)/REFIN2(−).
84          3: AVDD
85          If this field is left empty, internal reference is selected.
86        $ref: /schemas/types.yaml#/definitions/uint32
87        enum: [0, 1, 3]
88
89      diff-channels:
90        description: see Documentation/devicetree/bindings/iio/adc/adc.txt
91        items:
92          minimum: 0
93          maximum: 15
94
95      bipolar:
96        description: see Documentation/devicetree/bindings/iio/adc/adc.txt
97        type: boolean
98
99      adi,buffered-positive:
100        description: Enable buffered mode for positive input.
101        type: boolean
102
103      adi,buffered-negative:
104        description: Enable buffered mode for negative input.
105        type: boolean
106
107    required:
108      - reg
109      - diff-channels
110
111examples:
112  - |
113    spi {
114      #address-cells = <1>;
115      #size-cells = <0>;
116
117      adc@0 {
118        compatible = "adi,ad7124-4";
119        reg = <0>;
120        spi-max-frequency = <5000000>;
121        interrupts = <25 2>;
122        interrupt-parent = <&gpio>;
123        refin1-supply = <&adc_vref>;
124        clocks = <&ad7124_mclk>;
125        clock-names = "mclk";
126
127        #address-cells = <1>;
128        #size-cells = <0>;
129
130        channel@0 {
131          reg = <0>;
132          diff-channels = <0 1>;
133          adi,reference-select = <0>;
134          adi,buffered-positive;
135        };
136
137        channel@1 {
138          reg = <1>;
139          bipolar;
140          diff-channels = <2 3>;
141          adi,reference-select = <0>;
142          adi,buffered-positive;
143          adi,buffered-negative;
144        };
145
146        channel@2 {
147          reg = <2>;
148          diff-channels = <4 5>;
149        };
150
151        channel@3 {
152          reg = <3>;
153          diff-channels = <6 7>;
154        };
155      };
156    };
157