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
54required:
55  - compatible
56  - reg
57  - spi-max-frequency
58  - spi-cpol
59  - refin-supply
60
61additionalProperties: false
62
63patternProperties:
64  "^channel@[0-3]$":
65    type: object
66    additionalProperties: false
67    description: Represents the external channels which are connected to the device.
68
69    properties:
70      reg:
71        description: |
72          The channel number. It can have up to 4 channels numbered from 0 to 3.
73        minimum: 0
74        maximum: 3
75
76      adi,ch-func:
77        $ref: /schemas/types.yaml#/definitions/uint32
78        description: |
79          Channel function.
80          HART functions are not supported on AD74412R.
81          0 - CH_FUNC_HIGH_IMPEDANCE
82          1 - CH_FUNC_VOLTAGE_OUTPUT
83          2 - CH_FUNC_CURRENT_OUTPUT
84          3 - CH_FUNC_VOLTAGE_INPUT
85          4 - CH_FUNC_CURRENT_INPUT_EXT_POWER
86          5 - CH_FUNC_CURRENT_INPUT_LOOP_POWER
87          6 - CH_FUNC_RESISTANCE_INPUT
88          7 - CH_FUNC_DIGITAL_INPUT_LOGIC
89          8 - CH_FUNC_DIGITAL_INPUT_LOOP_POWER
90          9 - CH_FUNC_CURRENT_INPUT_EXT_POWER_HART
91          10 - CH_FUNC_CURRENT_INPUT_LOOP_POWER_HART
92        minimum: 0
93        maximum: 10
94        default: 0
95
96      adi,gpo-comparator:
97        type: boolean
98        description: |
99          Whether to configure GPO as a comparator or not.
100          When not configured as a comparator, the GPO will be treated as an
101          output-only GPIO.
102
103    required:
104      - reg
105
106examples:
107  - |
108    #include <dt-bindings/gpio/gpio.h>
109    #include <dt-bindings/interrupt-controller/irq.h>
110    #include <dt-bindings/iio/addac/adi,ad74413r.h>
111
112    spi {
113      #address-cells = <1>;
114      #size-cells = <0>;
115
116      cs-gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
117      status = "okay";
118
119      ad74413r@0 {
120        compatible = "adi,ad74413r";
121        reg = <0>;
122        spi-max-frequency = <1000000>;
123        spi-cpol;
124
125        #address-cells = <1>;
126        #size-cells = <0>;
127
128        interrupt-parent = <&gpio>;
129        interrupts = <26 IRQ_TYPE_EDGE_FALLING>;
130
131        refin-supply = <&ad74413r_refin>;
132
133        channel@0 {
134          reg = <0>;
135
136          adi,ch-func = <CH_FUNC_VOLTAGE_OUTPUT>;
137        };
138
139        channel@1 {
140          reg = <1>;
141
142          adi,ch-func = <CH_FUNC_CURRENT_OUTPUT>;
143        };
144
145        channel@2 {
146          reg = <2>;
147
148          adi,ch-func = <CH_FUNC_DIGITAL_INPUT_LOGIC>;
149          adi,gpo-comparator;
150        };
151
152        channel@3 {
153          reg = <3>;
154
155          adi,ch-func = <CH_FUNC_CURRENT_INPUT_EXT_POWER>;
156        };
157      };
158    };
159...
160