1# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/iio/adc/microchip,mcp3564.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Microchip MCP346X and MCP356X ADC Family
8
9maintainers:
10  - Marius Cristea <marius.cristea@microchip.com>
11
12description: |
13  Bindings for the Microchip family of 153.6 ksps, Low-Noise 16/24-Bit
14  Delta-Sigma ADCs with an SPI interface. Datasheet can be found here:
15  Datasheet for MCP3561, MCP3562, MCP3564 can be found here:
16    https://ww1.microchip.com/downloads/aemDocuments/documents/MSLD/ProductDocuments/DataSheets/MCP3561-2-4-Family-Data-Sheet-DS20006181C.pdf
17  Datasheet for MCP3561R, MCP3562R, MCP3564R can be found here:
18    https://ww1.microchip.com/downloads/aemDocuments/documents/APID/ProductDocuments/DataSheets/MCP3561_2_4R-Data-Sheet-DS200006391C.pdf
19  Datasheet for MCP3461, MCP3462, MCP3464 can be found here:
20    https://ww1.microchip.com/downloads/aemDocuments/documents/APID/ProductDocuments/DataSheets/MCP3461-2-4-Two-Four-Eight-Channel-153.6-ksps-Low-Noise-16-Bit-Delta-Sigma-ADC-Data-Sheet-20006180D.pdf
21  Datasheet for MCP3461R, MCP3462R, MCP3464R can be found here:
22    https://ww1.microchip.com/downloads/aemDocuments/documents/APID/ProductDocuments/DataSheets/MCP3461-2-4R-Family-Data-Sheet-DS20006404C.pdf
23
24properties:
25  compatible:
26    enum:
27      - microchip,mcp3461
28      - microchip,mcp3462
29      - microchip,mcp3464
30      - microchip,mcp3461r
31      - microchip,mcp3462r
32      - microchip,mcp3464r
33      - microchip,mcp3561
34      - microchip,mcp3562
35      - microchip,mcp3564
36      - microchip,mcp3561r
37      - microchip,mcp3562r
38      - microchip,mcp3564r
39
40  reg:
41    maxItems: 1
42
43  spi-max-frequency:
44    maximum: 20000000
45
46  spi-cpha: true
47
48  spi-cpol: true
49
50  vdd-supply: true
51
52  avdd-supply: true
53
54  clocks:
55    description:
56      Phandle and clock identifier for external sampling clock.
57      If not specified, the internal crystal oscillator will be used.
58    maxItems: 1
59
60  interrupts:
61    description: IRQ line of the ADC
62    maxItems: 1
63
64  drive-open-drain:
65    description:
66      Whether to drive the IRQ signal as push-pull (default) or open-drain. Note
67      that the device requires this pin to become "high", otherwise it will stop
68      converting.
69    type: boolean
70
71  vref-supply:
72    description:
73      Some devices have a specific reference voltage supplied on a different
74      pin to the other supplies. Needed to be able to establish channel scaling
75      unless there is also an internal reference available (e.g. mcp3564r). In
76      case of "r" devices (e. g. mcp3564r), if it does not exists the internal
77      reference will be used.
78
79  microchip,hw-device-address:
80    $ref: /schemas/types.yaml#/definitions/uint32
81    minimum: 0
82    maximum: 3
83    description:
84      The address is set on a per-device basis by fuses in the factory,
85      configured on request. If not requested, the fuses are set for 0x1.
86      The device address is part of the device markings to avoid
87      potential confusion. This address is coded on two bits, so four possible
88      addresses are available when multiple devices are present on the same
89      SPI bus with only one Chip Select line for all devices.
90      Each device communication starts by a CS falling edge, followed by the
91      clocking of the device address (BITS[7:6] - top two bits of COMMAND BYTE
92      which is first one on the wire).
93
94  "#io-channel-cells":
95    const: 1
96
97  "#address-cells":
98    const: 1
99
100  "#size-cells":
101    const: 0
102
103patternProperties:
104  "^channel@([0-9]|([1-7][0-9]))$":
105    $ref: adc.yaml
106    type: object
107    unevaluatedProperties: false
108    description: Represents the external channels which are connected to the ADC.
109
110    properties:
111      reg:
112        description: The channel number in single-ended and differential mode.
113        minimum: 0
114        maximum: 79
115
116    required:
117      - reg
118
119dependencies:
120  spi-cpol: [ spi-cpha ]
121  spi-cpha: [ spi-cpol ]
122
123required:
124  - compatible
125  - reg
126  - microchip,hw-device-address
127  - spi-max-frequency
128
129allOf:
130  - $ref: /schemas/spi/spi-peripheral-props.yaml#
131  - # External vref, no internal reference
132    if:
133      properties:
134        compatible:
135          contains:
136            enum:
137              - microchip,mcp3461
138              - microchip,mcp3462
139              - microchip,mcp3464
140              - microchip,mcp3561
141              - microchip,mcp3562
142              - microchip,mcp3564
143    then:
144      required:
145        - vref-supply
146
147unevaluatedProperties: false
148
149examples:
150  - |
151    spi {
152        #address-cells = <1>;
153        #size-cells = <0>;
154
155        adc@0 {
156            compatible = "microchip,mcp3564r";
157            reg = <0>;
158            vref-supply = <&vref_reg>;
159            spi-cpha;
160            spi-cpol;
161            spi-max-frequency = <10000000>;
162            microchip,hw-device-address = <1>;
163
164            #address-cells = <1>;
165            #size-cells = <0>;
166
167            channel@0 {
168                /* CH0 to AGND */
169                reg = <0>;
170                label = "CH0";
171            };
172
173            channel@1 {
174                /* CH1 to AGND */
175                reg = <1>;
176                label = "CH1";
177            };
178
179            /* diff-channels */
180            channel@11 {
181                reg = <11>;
182
183                /* CN0, CN1 */
184                diff-channels = <0 1>;
185                label = "CH0_CH1";
186            };
187
188            channel@22 {
189                reg = <0x22>;
190
191                /* CN1, CN2 */
192                diff-channels = <1 2>;
193                label = "CH1_CH3";
194            };
195
196            channel@23 {
197                reg = <0x23>;
198
199                /* CN1, CN3 */
200                diff-channels = <1 3>;
201                label = "CH1_CH3";
202            };
203        };
204    };
205...
206