Tom Rini | 762f85b | 2024-07-20 11:15:10 -0600 | [diff] [blame] | 1 | # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) |
| 2 | # Copyright 2023 Analog Devices Inc. |
| 3 | %YAML 1.2 |
| 4 | --- |
| 5 | $id: http://devicetree.org/schemas/iio/adc/adi,ad7173.yaml# |
| 6 | $schema: http://devicetree.org/meta-schemas/core.yaml# |
| 7 | |
| 8 | title: Analog Devices AD7173 ADC |
| 9 | |
| 10 | maintainers: |
| 11 | - Ceclan Dumitru <dumitru.ceclan@analog.com> |
| 12 | |
| 13 | description: | |
| 14 | Analog Devices AD717x ADC's: |
| 15 | The AD717x family offer a complete integrated Sigma-Delta ADC solution which |
| 16 | can be used in high precision, low noise single channel applications |
| 17 | (Life Science measurements) or higher speed multiplexed applications |
| 18 | (Factory Automation PLC Input modules). The Sigma-Delta ADC is intended |
| 19 | primarily for measurement of signals close to DC but also delivers |
| 20 | outstanding performance with input bandwidths out to ~10kHz. |
| 21 | |
| 22 | Datasheets for supported chips: |
| 23 | https://www.analog.com/media/en/technical-documentation/data-sheets/AD7172-2.pdf |
| 24 | https://www.analog.com/media/en/technical-documentation/data-sheets/AD7172-4.pdf |
| 25 | https://www.analog.com/media/en/technical-documentation/data-sheets/AD7173-8.pdf |
| 26 | https://www.analog.com/media/en/technical-documentation/data-sheets/AD7175-2.pdf |
| 27 | https://www.analog.com/media/en/technical-documentation/data-sheets/AD7175-8.pdf |
| 28 | https://www.analog.com/media/en/technical-documentation/data-sheets/AD7176-2.pdf |
| 29 | https://www.analog.com/media/en/technical-documentation/data-sheets/AD7177-2.pdf |
| 30 | |
| 31 | properties: |
| 32 | compatible: |
| 33 | enum: |
| 34 | - adi,ad7172-2 |
| 35 | - adi,ad7172-4 |
| 36 | - adi,ad7173-8 |
| 37 | - adi,ad7175-2 |
| 38 | - adi,ad7175-8 |
| 39 | - adi,ad7176-2 |
| 40 | - adi,ad7177-2 |
| 41 | |
| 42 | reg: |
| 43 | maxItems: 1 |
| 44 | |
| 45 | interrupts: |
| 46 | minItems: 1 |
| 47 | items: |
| 48 | - description: | |
| 49 | Ready: multiplexed with SPI data out. While SPI CS is low, |
| 50 | can be used to indicate the completion of a conversion. |
| 51 | |
| 52 | - description: | |
| 53 | Error: The three error bits in the status register (ADC_ERROR, CRC_ERROR, |
| 54 | and REG_ERROR) are OR'ed, inverted, and mapped to the ERROR pin. |
| 55 | Therefore, the ERROR pin indicates that an error has occurred. |
| 56 | |
| 57 | interrupt-names: |
| 58 | minItems: 1 |
| 59 | items: |
| 60 | - const: rdy |
| 61 | - const: err |
| 62 | |
| 63 | '#address-cells': |
| 64 | const: 1 |
| 65 | |
| 66 | '#size-cells': |
| 67 | const: 0 |
| 68 | |
| 69 | spi-max-frequency: |
| 70 | maximum: 20000000 |
| 71 | |
| 72 | gpio-controller: |
| 73 | description: Marks the device node as a GPIO controller. |
| 74 | |
| 75 | '#gpio-cells': |
| 76 | const: 2 |
| 77 | description: |
| 78 | The first cell is the GPIO number and the second cell specifies |
| 79 | GPIO flags, as defined in <dt-bindings/gpio/gpio.h>. |
| 80 | |
| 81 | vref-supply: |
| 82 | description: | |
| 83 | Differential external reference supply used for conversion. The reference |
| 84 | voltage (Vref) specified here must be the voltage difference between the |
| 85 | REF+ and REF- pins: Vref = (REF+) - (REF-). |
| 86 | |
| 87 | vref2-supply: |
| 88 | description: | |
| 89 | Differential external reference supply used for conversion. The reference |
| 90 | voltage (Vref2) specified here must be the voltage difference between the |
| 91 | REF2+ and REF2- pins: Vref2 = (REF2+) - (REF2-). |
| 92 | |
| 93 | avdd-supply: |
| 94 | description: Avdd supply, can be used as reference for conversion. |
| 95 | This supply is referenced to AVSS, voltage specified here |
| 96 | represents (AVDD1 - AVSS). |
| 97 | |
| 98 | avdd2-supply: |
| 99 | description: Avdd2 supply, used as the input to the internal voltage regulator. |
| 100 | This supply is referenced to AVSS, voltage specified here |
| 101 | represents (AVDD2 - AVSS). |
| 102 | |
| 103 | iovdd-supply: |
| 104 | description: iovdd supply, used for the chip digital interface. |
| 105 | |
| 106 | clocks: |
| 107 | maxItems: 1 |
| 108 | description: | |
| 109 | Optional external clock source. Can include one clock source: external |
| 110 | clock or external crystal. |
| 111 | |
| 112 | clock-names: |
| 113 | enum: |
| 114 | - ext-clk |
| 115 | - xtal |
| 116 | |
| 117 | '#clock-cells': |
| 118 | const: 0 |
| 119 | |
| 120 | patternProperties: |
| 121 | "^channel@[0-9a-f]$": |
| 122 | type: object |
| 123 | $ref: adc.yaml |
| 124 | unevaluatedProperties: false |
| 125 | |
| 126 | properties: |
| 127 | reg: |
| 128 | minimum: 0 |
| 129 | maximum: 15 |
| 130 | |
| 131 | diff-channels: |
| 132 | items: |
| 133 | minimum: 0 |
| 134 | maximum: 31 |
| 135 | |
| 136 | adi,reference-select: |
| 137 | description: | |
| 138 | Select the reference source to use when converting on |
| 139 | the specific channel. Valid values are: |
| 140 | vref : REF+ /REF− |
| 141 | vref2 : REF2+ /REF2− |
| 142 | refout-avss: REFOUT/AVSS (Internal reference) |
| 143 | avdd : AVDD /AVSS |
| 144 | |
| 145 | External reference ref2 only available on ad7173-8 and ad7172-4. |
| 146 | Internal reference refout-avss not available on ad7172-4. |
| 147 | |
| 148 | If not specified, internal reference used (if available). |
| 149 | $ref: /schemas/types.yaml#/definitions/string |
| 150 | enum: |
| 151 | - vref |
| 152 | - vref2 |
| 153 | - refout-avss |
| 154 | - avdd |
| 155 | default: refout-avss |
| 156 | |
| 157 | required: |
| 158 | - reg |
| 159 | - diff-channels |
| 160 | |
| 161 | required: |
| 162 | - compatible |
| 163 | - reg |
| 164 | |
| 165 | allOf: |
| 166 | - $ref: /schemas/spi/spi-peripheral-props.yaml# |
| 167 | |
| 168 | # Only ad7172-4, ad7173-8 and ad7175-8 support vref2 |
| 169 | # Other models have [0-3] channel registers |
| 170 | - if: |
| 171 | properties: |
| 172 | compatible: |
| 173 | not: |
| 174 | contains: |
| 175 | enum: |
| 176 | - adi,ad7172-4 |
| 177 | - adi,ad7173-8 |
| 178 | - adi,ad7175-8 |
| 179 | then: |
| 180 | properties: |
| 181 | vref2-supply: false |
| 182 | patternProperties: |
| 183 | "^channel@[0-9a-f]$": |
| 184 | properties: |
| 185 | adi,reference-select: |
| 186 | enum: |
| 187 | - vref |
| 188 | - refout-avss |
| 189 | - avdd |
| 190 | reg: |
| 191 | maximum: 3 |
| 192 | |
| 193 | # Model ad7172-4 does not support internal reference |
| 194 | - if: |
| 195 | properties: |
| 196 | compatible: |
| 197 | contains: |
| 198 | const: adi,ad7172-4 |
| 199 | then: |
| 200 | patternProperties: |
| 201 | "^channel@[0-9a-f]$": |
| 202 | properties: |
| 203 | reg: |
| 204 | maximum: 7 |
| 205 | adi,reference-select: |
| 206 | enum: |
| 207 | - vref |
| 208 | - vref2 |
| 209 | - avdd |
| 210 | required: |
| 211 | - adi,reference-select |
| 212 | |
| 213 | - if: |
| 214 | anyOf: |
| 215 | - required: [clock-names] |
| 216 | - required: [clocks] |
| 217 | then: |
| 218 | properties: |
| 219 | '#clock-cells': false |
| 220 | |
| 221 | unevaluatedProperties: false |
| 222 | |
| 223 | examples: |
| 224 | - | |
| 225 | #include <dt-bindings/gpio/gpio.h> |
| 226 | #include <dt-bindings/interrupt-controller/irq.h> |
| 227 | |
| 228 | spi { |
| 229 | #address-cells = <1>; |
| 230 | #size-cells = <0>; |
| 231 | |
| 232 | adc@0 { |
| 233 | compatible = "adi,ad7173-8"; |
| 234 | reg = <0>; |
| 235 | |
| 236 | #address-cells = <1>; |
| 237 | #size-cells = <0>; |
| 238 | |
| 239 | interrupts = <25 IRQ_TYPE_EDGE_FALLING>; |
| 240 | interrupt-names = "rdy"; |
| 241 | interrupt-parent = <&gpio>; |
| 242 | spi-max-frequency = <5000000>; |
| 243 | gpio-controller; |
| 244 | #gpio-cells = <2>; |
| 245 | #clock-cells = <0>; |
| 246 | |
| 247 | vref-supply = <&dummy_regulator>; |
| 248 | |
| 249 | channel@0 { |
| 250 | reg = <0>; |
| 251 | bipolar; |
| 252 | diff-channels = <0 1>; |
| 253 | adi,reference-select = "vref"; |
| 254 | }; |
| 255 | |
| 256 | channel@1 { |
| 257 | reg = <1>; |
| 258 | diff-channels = <2 3>; |
| 259 | }; |
| 260 | |
| 261 | channel@2 { |
| 262 | reg = <2>; |
| 263 | bipolar; |
| 264 | diff-channels = <4 5>; |
| 265 | }; |
| 266 | |
| 267 | channel@3 { |
| 268 | reg = <3>; |
| 269 | bipolar; |
| 270 | diff-channels = <6 7>; |
| 271 | }; |
| 272 | |
| 273 | channel@4 { |
| 274 | reg = <4>; |
| 275 | diff-channels = <8 9>; |
| 276 | adi,reference-select = "avdd"; |
| 277 | }; |
| 278 | }; |
| 279 | }; |