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
61patternProperties:
62  "^channel@[0-3]$":
63    type: object
64    additionalProperties: false
65    description: Represents the external channels which are connected to the device.
66
67    properties:
68      reg:
69        description: |
70          The channel number. It can have up to 4 channels numbered from 0 to 3.
71        minimum: 0
72        maximum: 3
73
74      adi,ch-func:
75        $ref: /schemas/types.yaml#/definitions/uint32
76        description: |
77          Channel function.
78          HART functions are not supported on AD74412R.
79          0 - CH_FUNC_HIGH_IMPEDANCE
80          1 - CH_FUNC_VOLTAGE_OUTPUT
81          2 - CH_FUNC_CURRENT_OUTPUT
82          3 - CH_FUNC_VOLTAGE_INPUT
83          4 - CH_FUNC_CURRENT_INPUT_EXT_POWER
84          5 - CH_FUNC_CURRENT_INPUT_LOOP_POWER
85          6 - CH_FUNC_RESISTANCE_INPUT
86          7 - CH_FUNC_DIGITAL_INPUT_LOGIC
87          8 - CH_FUNC_DIGITAL_INPUT_LOOP_POWER
88          9 - CH_FUNC_CURRENT_INPUT_EXT_POWER_HART
89          10 - CH_FUNC_CURRENT_INPUT_LOOP_POWER_HART
90        minimum: 0
91        maximum: 10
92        default: 0
93
94      adi,gpo-comparator:
95        type: boolean
96        description: |
97          Whether to configure GPO as a comparator or not.
98          When not configured as a comparator, the GPO will be treated as an
99          output-only GPIO.
100
101    required:
102      - reg
103
104allOf:
105  - $ref: /schemas/spi/spi-peripheral-props.yaml#
106
107unevaluatedProperties: false
108
109examples:
110  - |
111    #include <dt-bindings/gpio/gpio.h>
112    #include <dt-bindings/interrupt-controller/irq.h>
113    #include <dt-bindings/iio/addac/adi,ad74413r.h>
114
115    spi {
116      #address-cells = <1>;
117      #size-cells = <0>;
118
119      addac@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