xref: /freebsd/sys/contrib/device-tree/Bindings/iio/adc/adi,ad7944.yaml (revision 7d0873ebb83b19ba1e8a89e679470d885efe12e3)
1*7d0873ebSEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2*7d0873ebSEmmanuel Vadot%YAML 1.2
3*7d0873ebSEmmanuel Vadot---
4*7d0873ebSEmmanuel Vadot$id: http://devicetree.org/schemas/iio/adc/adi,ad7944.yaml#
5*7d0873ebSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
6*7d0873ebSEmmanuel Vadot
7*7d0873ebSEmmanuel Vadottitle: Analog Devices PulSAR LFCSP Analog to Digital Converters
8*7d0873ebSEmmanuel Vadot
9*7d0873ebSEmmanuel Vadotmaintainers:
10*7d0873ebSEmmanuel Vadot  - Michael Hennerich <Michael.Hennerich@analog.com>
11*7d0873ebSEmmanuel Vadot  - Nuno Sá <nuno.sa@analog.com>
12*7d0873ebSEmmanuel Vadot
13*7d0873ebSEmmanuel Vadotdescription: |
14*7d0873ebSEmmanuel Vadot  A family of pin-compatible single channel differential analog to digital
15*7d0873ebSEmmanuel Vadot  converters with SPI support in a LFCSP package.
16*7d0873ebSEmmanuel Vadot
17*7d0873ebSEmmanuel Vadot  * https://www.analog.com/en/products/ad7944.html
18*7d0873ebSEmmanuel Vadot  * https://www.analog.com/en/products/ad7985.html
19*7d0873ebSEmmanuel Vadot  * https://www.analog.com/en/products/ad7986.html
20*7d0873ebSEmmanuel Vadot
21*7d0873ebSEmmanuel Vadot$ref: /schemas/spi/spi-peripheral-props.yaml#
22*7d0873ebSEmmanuel Vadot
23*7d0873ebSEmmanuel Vadotproperties:
24*7d0873ebSEmmanuel Vadot  compatible:
25*7d0873ebSEmmanuel Vadot    enum:
26*7d0873ebSEmmanuel Vadot      - adi,ad7944
27*7d0873ebSEmmanuel Vadot      - adi,ad7985
28*7d0873ebSEmmanuel Vadot      - adi,ad7986
29*7d0873ebSEmmanuel Vadot
30*7d0873ebSEmmanuel Vadot  reg:
31*7d0873ebSEmmanuel Vadot    maxItems: 1
32*7d0873ebSEmmanuel Vadot
33*7d0873ebSEmmanuel Vadot  spi-max-frequency:
34*7d0873ebSEmmanuel Vadot    maximum: 111111111
35*7d0873ebSEmmanuel Vadot
36*7d0873ebSEmmanuel Vadot  spi-cpol: true
37*7d0873ebSEmmanuel Vadot  spi-cpha: true
38*7d0873ebSEmmanuel Vadot
39*7d0873ebSEmmanuel Vadot  adi,spi-mode:
40*7d0873ebSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/string
41*7d0873ebSEmmanuel Vadot    enum: [ single, chain ]
42*7d0873ebSEmmanuel Vadot    description: |
43*7d0873ebSEmmanuel Vadot      This property indicates the SPI wiring configuration.
44*7d0873ebSEmmanuel Vadot
45*7d0873ebSEmmanuel Vadot      When this property is omitted, it is assumed that the device is using what
46*7d0873ebSEmmanuel Vadot      the datasheet calls "4-wire mode". This is the conventional SPI mode used
47*7d0873ebSEmmanuel Vadot      when there are multiple devices on the same bus. In this mode, the CNV
48*7d0873ebSEmmanuel Vadot      line is used to initiate the conversion and the SDI line is connected to
49*7d0873ebSEmmanuel Vadot      CS on the SPI controller.
50*7d0873ebSEmmanuel Vadot
51*7d0873ebSEmmanuel Vadot      When this property is present, it indicates that the device is using one
52*7d0873ebSEmmanuel Vadot      of the following alternative wiring configurations:
53*7d0873ebSEmmanuel Vadot
54*7d0873ebSEmmanuel Vadot      * single: The datasheet calls this "3-wire mode". (NOTE: The datasheet's
55*7d0873ebSEmmanuel Vadot        definition of 3-wire mode is NOT at all related to the standard
56*7d0873ebSEmmanuel Vadot        spi-3wire property!) This mode is often used when the ADC is the only
57*7d0873ebSEmmanuel Vadot        device on the bus. In this mode, SDI is tied to VIO, and the CNV line
58*7d0873ebSEmmanuel Vadot        can be connected to the CS line of the SPI controller or to a GPIO, in
59*7d0873ebSEmmanuel Vadot        which case the CS line of the controller is unused.
60*7d0873ebSEmmanuel Vadot      * chain: The datasheet calls this "chain mode". This mode is used to save
61*7d0873ebSEmmanuel Vadot        on wiring when multiple ADCs are used. In this mode, the SDI line of
62*7d0873ebSEmmanuel Vadot        one chip is tied to the SDO of the next chip in the chain and the SDI of
63*7d0873ebSEmmanuel Vadot        the last chip in the chain is tied to GND. Only the first chip in the
64*7d0873ebSEmmanuel Vadot        chain is connected to the SPI bus. The CNV line of all chips are tied
65*7d0873ebSEmmanuel Vadot        together. The CS line of the SPI controller can be used as the CNV line
66*7d0873ebSEmmanuel Vadot        only if it is active high.
67*7d0873ebSEmmanuel Vadot
68*7d0873ebSEmmanuel Vadot  '#daisy-chained-devices': true
69*7d0873ebSEmmanuel Vadot
70*7d0873ebSEmmanuel Vadot  avdd-supply:
71*7d0873ebSEmmanuel Vadot    description: A 2.5V supply that powers the analog circuitry.
72*7d0873ebSEmmanuel Vadot
73*7d0873ebSEmmanuel Vadot  dvdd-supply:
74*7d0873ebSEmmanuel Vadot    description: A 2.5V supply that powers the digital circuitry.
75*7d0873ebSEmmanuel Vadot
76*7d0873ebSEmmanuel Vadot  vio-supply:
77*7d0873ebSEmmanuel Vadot    description:
78*7d0873ebSEmmanuel Vadot      A 1.8V to 2.7V supply for the digital inputs and outputs.
79*7d0873ebSEmmanuel Vadot
80*7d0873ebSEmmanuel Vadot  bvdd-supply:
81*7d0873ebSEmmanuel Vadot    description:
82*7d0873ebSEmmanuel Vadot      A voltage supply for the buffered power. When using an external reference
83*7d0873ebSEmmanuel Vadot      without an internal buffer (PDREF high, REFIN low), this should be
84*7d0873ebSEmmanuel Vadot      connected to the same supply as ref-supply. Otherwise, when using an
85*7d0873ebSEmmanuel Vadot      internal reference or an external reference with an internal buffer, this
86*7d0873ebSEmmanuel Vadot      is connected to a 5V supply.
87*7d0873ebSEmmanuel Vadot
88*7d0873ebSEmmanuel Vadot  ref-supply:
89*7d0873ebSEmmanuel Vadot    description:
90*7d0873ebSEmmanuel Vadot      Voltage regulator for the external reference voltage (REF). This property
91*7d0873ebSEmmanuel Vadot      is omitted when using an internal reference.
92*7d0873ebSEmmanuel Vadot
93*7d0873ebSEmmanuel Vadot  refin-supply:
94*7d0873ebSEmmanuel Vadot    description:
95*7d0873ebSEmmanuel Vadot      Voltage regulator for the reference buffer input (REFIN). When using an
96*7d0873ebSEmmanuel Vadot      external buffer with internal reference, this should be connected to a
97*7d0873ebSEmmanuel Vadot      1.2V external reference voltage supply. Otherwise, this property is
98*7d0873ebSEmmanuel Vadot      omitted.
99*7d0873ebSEmmanuel Vadot
100*7d0873ebSEmmanuel Vadot  cnv-gpios:
101*7d0873ebSEmmanuel Vadot    description:
102*7d0873ebSEmmanuel Vadot      The Convert Input (CNV). This input has multiple functions. It initiates
103*7d0873ebSEmmanuel Vadot      the conversions and selects the SPI mode of the device (chain or CS). In
104*7d0873ebSEmmanuel Vadot      'single' mode, this property is omitted if the CNV pin is connected to the
105*7d0873ebSEmmanuel Vadot      CS line of the SPI controller.
106*7d0873ebSEmmanuel Vadot    maxItems: 1
107*7d0873ebSEmmanuel Vadot
108*7d0873ebSEmmanuel Vadot  turbo-gpios:
109*7d0873ebSEmmanuel Vadot    description:
110*7d0873ebSEmmanuel Vadot      GPIO connected to the TURBO line. If omitted, it is assumed that the TURBO
111*7d0873ebSEmmanuel Vadot      line is hard-wired and the state is determined by the adi,always-turbo
112*7d0873ebSEmmanuel Vadot      property.
113*7d0873ebSEmmanuel Vadot    maxItems: 1
114*7d0873ebSEmmanuel Vadot
115*7d0873ebSEmmanuel Vadot  adi,always-turbo:
116*7d0873ebSEmmanuel Vadot    type: boolean
117*7d0873ebSEmmanuel Vadot    description:
118*7d0873ebSEmmanuel Vadot      When present, this property indicates that the TURBO line is hard-wired
119*7d0873ebSEmmanuel Vadot      and the state is always high. If neither this property nor turbo-gpios is
120*7d0873ebSEmmanuel Vadot      present, the TURBO line is assumed to be hard-wired and the state is
121*7d0873ebSEmmanuel Vadot      always low.
122*7d0873ebSEmmanuel Vadot
123*7d0873ebSEmmanuel Vadot  interrupts:
124*7d0873ebSEmmanuel Vadot    description:
125*7d0873ebSEmmanuel Vadot      The SDO pin can also function as a busy indicator. This node should be
126*7d0873ebSEmmanuel Vadot      connected to an interrupt that is triggered when the SDO line goes low
127*7d0873ebSEmmanuel Vadot      while the SDI line is high and the CNV line is low ('single' mode) or the
128*7d0873ebSEmmanuel Vadot      SDI line is low and the CNV line is high ('multi' mode); or when the SDO
129*7d0873ebSEmmanuel Vadot      line goes high while the SDI and CNV lines are high (chain mode),
130*7d0873ebSEmmanuel Vadot    maxItems: 1
131*7d0873ebSEmmanuel Vadot
132*7d0873ebSEmmanuel Vadotrequired:
133*7d0873ebSEmmanuel Vadot  - compatible
134*7d0873ebSEmmanuel Vadot  - reg
135*7d0873ebSEmmanuel Vadot  - avdd-supply
136*7d0873ebSEmmanuel Vadot  - dvdd-supply
137*7d0873ebSEmmanuel Vadot  - vio-supply
138*7d0873ebSEmmanuel Vadot  - bvdd-supply
139*7d0873ebSEmmanuel Vadot
140*7d0873ebSEmmanuel VadotallOf:
141*7d0873ebSEmmanuel Vadot  # ref-supply and refin-supply are mutually exclusive (neither is also valid)
142*7d0873ebSEmmanuel Vadot  - if:
143*7d0873ebSEmmanuel Vadot      required:
144*7d0873ebSEmmanuel Vadot        - ref-supply
145*7d0873ebSEmmanuel Vadot    then:
146*7d0873ebSEmmanuel Vadot      properties:
147*7d0873ebSEmmanuel Vadot        refin-supply: false
148*7d0873ebSEmmanuel Vadot  - if:
149*7d0873ebSEmmanuel Vadot      required:
150*7d0873ebSEmmanuel Vadot        - refin-supply
151*7d0873ebSEmmanuel Vadot    then:
152*7d0873ebSEmmanuel Vadot      properties:
153*7d0873ebSEmmanuel Vadot        ref-supply: false
154*7d0873ebSEmmanuel Vadot  # in '4-wire' mode, cnv-gpios is required, for other modes it is optional
155*7d0873ebSEmmanuel Vadot  - if:
156*7d0873ebSEmmanuel Vadot      not:
157*7d0873ebSEmmanuel Vadot        required:
158*7d0873ebSEmmanuel Vadot          - adi,spi-mode
159*7d0873ebSEmmanuel Vadot    then:
160*7d0873ebSEmmanuel Vadot      required:
161*7d0873ebSEmmanuel Vadot        - cnv-gpios
162*7d0873ebSEmmanuel Vadot  # chain mode has lower SCLK max rate and doesn't work when TURBO is enabled
163*7d0873ebSEmmanuel Vadot  - if:
164*7d0873ebSEmmanuel Vadot      required:
165*7d0873ebSEmmanuel Vadot        - adi,spi-mode
166*7d0873ebSEmmanuel Vadot      properties:
167*7d0873ebSEmmanuel Vadot        adi,spi-mode:
168*7d0873ebSEmmanuel Vadot          const: chain
169*7d0873ebSEmmanuel Vadot    then:
170*7d0873ebSEmmanuel Vadot      properties:
171*7d0873ebSEmmanuel Vadot        spi-max-frequency:
172*7d0873ebSEmmanuel Vadot          maximum: 90909090
173*7d0873ebSEmmanuel Vadot        adi,always-turbo: false
174*7d0873ebSEmmanuel Vadot      required:
175*7d0873ebSEmmanuel Vadot        - '#daisy-chained-devices'
176*7d0873ebSEmmanuel Vadot    else:
177*7d0873ebSEmmanuel Vadot      properties:
178*7d0873ebSEmmanuel Vadot        '#daisy-chained-devices': false
179*7d0873ebSEmmanuel Vadot  # turbo-gpios and adi,always-turbo are mutually exclusive
180*7d0873ebSEmmanuel Vadot  - if:
181*7d0873ebSEmmanuel Vadot      required:
182*7d0873ebSEmmanuel Vadot        - turbo-gpios
183*7d0873ebSEmmanuel Vadot    then:
184*7d0873ebSEmmanuel Vadot      properties:
185*7d0873ebSEmmanuel Vadot        adi,always-turbo: false
186*7d0873ebSEmmanuel Vadot  - if:
187*7d0873ebSEmmanuel Vadot      required:
188*7d0873ebSEmmanuel Vadot        - adi,always-turbo
189*7d0873ebSEmmanuel Vadot    then:
190*7d0873ebSEmmanuel Vadot      properties:
191*7d0873ebSEmmanuel Vadot        turbo-gpios: false
192*7d0873ebSEmmanuel Vadot
193*7d0873ebSEmmanuel VadotunevaluatedProperties: false
194*7d0873ebSEmmanuel Vadot
195*7d0873ebSEmmanuel Vadotexamples:
196*7d0873ebSEmmanuel Vadot  - |
197*7d0873ebSEmmanuel Vadot    #include <dt-bindings/gpio/gpio.h>
198*7d0873ebSEmmanuel Vadot    spi {
199*7d0873ebSEmmanuel Vadot        #address-cells = <1>;
200*7d0873ebSEmmanuel Vadot        #size-cells = <0>;
201*7d0873ebSEmmanuel Vadot        adc@0 {
202*7d0873ebSEmmanuel Vadot            compatible = "adi,ad7944";
203*7d0873ebSEmmanuel Vadot            reg = <0>;
204*7d0873ebSEmmanuel Vadot            spi-cpha;
205*7d0873ebSEmmanuel Vadot            spi-max-frequency = <111111111>;
206*7d0873ebSEmmanuel Vadot            avdd-supply = <&supply_2_5V>;
207*7d0873ebSEmmanuel Vadot            dvdd-supply = <&supply_2_5V>;
208*7d0873ebSEmmanuel Vadot            vio-supply = <&supply_1_8V>;
209*7d0873ebSEmmanuel Vadot            bvdd-supply = <&supply_5V>;
210*7d0873ebSEmmanuel Vadot            cnv-gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
211*7d0873ebSEmmanuel Vadot            turbo-gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
212*7d0873ebSEmmanuel Vadot        };
213*7d0873ebSEmmanuel Vadot    };
214