xref: /freebsd/sys/contrib/device-tree/Bindings/iio/addac/adi,ad74413r.yaml (revision 8bab661a3316d8bd9b9fbd11a3b4371b91507bd2)
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
7title: Analog Devices AD74412R/AD74413R device
8
9maintainers:
10  - Cosmin Tanislav <cosmin.tanislav@analog.com>
11
12description: |
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
24properties:
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
57required:
58  - compatible
59  - reg
60  - spi-max-frequency
61  - spi-cpol
62  - refin-supply
63
64patternProperties:
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    required:
105      - reg
106
107allOf:
108  - $ref: /schemas/spi/spi-peripheral-props.yaml#
109
110unevaluatedProperties: false
111
112examples:
113  - |
114    #include <dt-bindings/gpio/gpio.h>
115    #include <dt-bindings/interrupt-controller/irq.h>
116    #include <dt-bindings/iio/addac/adi,ad74413r.h>
117
118    spi {
119      #address-cells = <1>;
120      #size-cells = <0>;
121
122      addac@0 {
123        compatible = "adi,ad74413r";
124        reg = <0>;
125        spi-max-frequency = <1000000>;
126        spi-cpol;
127
128        #address-cells = <1>;
129        #size-cells = <0>;
130
131        interrupt-parent = <&gpio>;
132        interrupts = <26 IRQ_TYPE_EDGE_FALLING>;
133
134        refin-supply = <&ad74413r_refin>;
135        reset-gpios = <&gpio2 6 GPIO_ACTIVE_LOW>;
136
137        channel@0 {
138          reg = <0>;
139
140          adi,ch-func = <CH_FUNC_VOLTAGE_OUTPUT>;
141        };
142
143        channel@1 {
144          reg = <1>;
145
146          adi,ch-func = <CH_FUNC_CURRENT_OUTPUT>;
147        };
148
149        channel@2 {
150          reg = <2>;
151
152          adi,ch-func = <CH_FUNC_DIGITAL_INPUT_LOGIC>;
153          adi,gpo-comparator;
154        };
155
156        channel@3 {
157          reg = <3>;
158
159          adi,ch-func = <CH_FUNC_CURRENT_INPUT_EXT_POWER>;
160        };
161      };
162    };
163...
164