GNU Linux-libre 6.8.9-gnu
[releases.git] / Documentation / devicetree / bindings / iio / addac / adi,ad74413r.yaml
1 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2 %YAML 1.2
3 ---
4 $id: http://devicetree.org/schemas/iio/addac/adi,ad74413r.yaml#
5 $schema: http://devicetree.org/meta-schemas/core.yaml#
6
7 title: Analog Devices AD74412R/AD74413R device
8
9 maintainers:
10   - Cosmin Tanislav <cosmin.tanislav@analog.com>
11
12 description: |
13   The AD74412R and AD74413R are quad-channel software configurable input/output
14   solutions for building and process control applications. They contain
15   functionality for analog output, analog input, digital input, resistance
16   temperature detector, and thermocouple measurements integrated
17   into a single chip solution with an SPI interface.
18   The devices feature a 16-bit ADC and four configurable 13-bit DACs to provide
19   four configurable input/output channels and a suite of diagnostic functions.
20   The AD74413R differentiates itself from the AD74412R by being HART-compatible.
21     https://www.analog.com/en/products/ad74412r.html
22     https://www.analog.com/en/products/ad74413r.html
23
24 properties:
25   compatible:
26     enum:
27       - adi,ad74412r
28       - adi,ad74413r
29
30   reg:
31     maxItems: 1
32
33   '#address-cells':
34     const: 1
35
36   '#size-cells':
37     const: 0
38
39   spi-max-frequency:
40     maximum: 1000000
41
42   spi-cpol: true
43
44   interrupts:
45     maxItems: 1
46
47   refin-supply: true
48
49   shunt-resistor-micro-ohms:
50     description:
51       Shunt (sense) resistor value in micro-Ohms.
52     default: 100000000
53
54   reset-gpios:
55     maxItems: 1
56
57 required:
58   - compatible
59   - reg
60   - spi-max-frequency
61   - spi-cpol
62   - refin-supply
63
64 patternProperties:
65   "^channel@[0-3]$":
66     type: object
67     additionalProperties: false
68     description: Represents the external channels which are connected to the device.
69
70     properties:
71       reg:
72         description: |
73           The channel number. It can have up to 4 channels numbered from 0 to 3.
74         minimum: 0
75         maximum: 3
76
77       adi,ch-func:
78         $ref: /schemas/types.yaml#/definitions/uint32
79         description: |
80           Channel function.
81           HART functions are not supported on AD74412R.
82           0 - CH_FUNC_HIGH_IMPEDANCE
83           1 - CH_FUNC_VOLTAGE_OUTPUT
84           2 - CH_FUNC_CURRENT_OUTPUT
85           3 - CH_FUNC_VOLTAGE_INPUT
86           4 - CH_FUNC_CURRENT_INPUT_EXT_POWER
87           5 - CH_FUNC_CURRENT_INPUT_LOOP_POWER
88           6 - CH_FUNC_RESISTANCE_INPUT
89           7 - CH_FUNC_DIGITAL_INPUT_LOGIC
90           8 - CH_FUNC_DIGITAL_INPUT_LOOP_POWER
91           9 - CH_FUNC_CURRENT_INPUT_EXT_POWER_HART
92           10 - CH_FUNC_CURRENT_INPUT_LOOP_POWER_HART
93         minimum: 0
94         maximum: 10
95         default: 0
96
97       adi,gpo-comparator:
98         type: boolean
99         description: |
100           Whether to configure GPO as a comparator or not.
101           When not configured as a comparator, the GPO will be treated as an
102           output-only GPIO.
103
104       drive-strength-microamp:
105         description: |
106           For channels configured as digital input, this configures the sink
107           current.
108         minimum: 0
109         maximum: 1800
110         default: 0
111         multipleOf: 120
112
113     required:
114       - reg
115
116 allOf:
117   - $ref: /schemas/spi/spi-peripheral-props.yaml#
118
119 unevaluatedProperties: false
120
121 examples:
122   - |
123     #include <dt-bindings/gpio/gpio.h>
124     #include <dt-bindings/interrupt-controller/irq.h>
125     #include <dt-bindings/iio/addac/adi,ad74413r.h>
126
127     spi {
128       #address-cells = <1>;
129       #size-cells = <0>;
130
131       addac@0 {
132         compatible = "adi,ad74413r";
133         reg = <0>;
134         spi-max-frequency = <1000000>;
135         spi-cpol;
136
137         #address-cells = <1>;
138         #size-cells = <0>;
139
140         interrupt-parent = <&gpio>;
141         interrupts = <26 IRQ_TYPE_EDGE_FALLING>;
142
143         refin-supply = <&ad74413r_refin>;
144         reset-gpios = <&gpio2 6 GPIO_ACTIVE_LOW>;
145
146         channel@0 {
147           reg = <0>;
148
149           adi,ch-func = <CH_FUNC_VOLTAGE_OUTPUT>;
150         };
151
152         channel@1 {
153           reg = <1>;
154
155           adi,ch-func = <CH_FUNC_CURRENT_OUTPUT>;
156         };
157
158         channel@2 {
159           reg = <2>;
160
161           adi,ch-func = <CH_FUNC_DIGITAL_INPUT_LOGIC>;
162           adi,gpo-comparator;
163         };
164
165         channel@3 {
166           reg = <3>;
167
168           adi,ch-func = <CH_FUNC_CURRENT_INPUT_EXT_POWER>;
169         };
170       };
171     };
172 ...