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