summaryrefslogtreecommitdiffstats
path: root/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml
blob: baa65a521bad5b2cf533061ee331e023eb62bdd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/iio/addac/adi,ad74413r.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Analog Devices AD74412R/AD74413R device

maintainers:
  - Cosmin Tanislav <cosmin.tanislav@analog.com>

description: |
  The AD74412R and AD74413R are quad-channel software configurable input/output
  solutions for building and process control applications. They contain
  functionality for analog output, analog input, digital input, resistance
  temperature detector, and thermocouple measurements integrated
  into a single chip solution with an SPI interface.
  The devices feature a 16-bit ADC and four configurable 13-bit DACs to provide
  four configurable input/output channels and a suite of diagnostic functions.
  The AD74413R differentiates itself from the AD74412R by being HART-compatible.
    https://www.analog.com/en/products/ad74412r.html
    https://www.analog.com/en/products/ad74413r.html

properties:
  compatible:
    enum:
      - adi,ad74412r
      - adi,ad74413r

  reg:
    maxItems: 1

  '#address-cells':
    const: 1

  '#size-cells':
    const: 0

  spi-max-frequency:
    maximum: 1000000

  spi-cpol: true

  interrupts:
    maxItems: 1

  refin-supply: true

  shunt-resistor-micro-ohms:
    description:
      Shunt (sense) resistor value in micro-Ohms.
    default: 100000000

required:
  - compatible
  - reg
  - spi-max-frequency
  - spi-cpol
  - refin-supply

additionalProperties: false

patternProperties:
  "^channel@[0-3]$":
    type: object
    description: Represents the external channels which are connected to the device.

    properties:
      reg:
        description: |
          The channel number. It can have up to 4 channels numbered from 0 to 3.
        minimum: 0
        maximum: 3

      adi,ch-func:
        $ref: /schemas/types.yaml#/definitions/uint32
        description: |
          Channel function.
          HART functions are not supported on AD74412R.
          0 - CH_FUNC_HIGH_IMPEDANCE
          1 - CH_FUNC_VOLTAGE_OUTPUT
          2 - CH_FUNC_CURRENT_OUTPUT
          3 - CH_FUNC_VOLTAGE_INPUT
          4 - CH_FUNC_CURRENT_INPUT_EXT_POWER
          5 - CH_FUNC_CURRENT_INPUT_LOOP_POWER
          6 - CH_FUNC_RESISTANCE_INPUT
          7 - CH_FUNC_DIGITAL_INPUT_LOGIC
          8 - CH_FUNC_DIGITAL_INPUT_LOOP_POWER
          9 - CH_FUNC_CURRENT_INPUT_EXT_POWER_HART
          10 - CH_FUNC_CURRENT_INPUT_LOOP_POWER_HART
        minimum: 0
        maximum: 10
        default: 0

      adi,gpo-comparator:
        type: boolean
        description: |
          Whether to configure GPO as a comparator or not.
          When not configured as a comparator, the GPO will be treated as an
          output-only GPIO.

    required:
      - reg

examples:
  - |
    #include <dt-bindings/gpio/gpio.h>
    #include <dt-bindings/interrupt-controller/irq.h>
    #include <dt-bindings/iio/addac/adi,ad74413r.h>

    spi {
      #address-cells = <1>;
      #size-cells = <0>;

      cs-gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
      status = "okay";

      ad74413r@0 {
        compatible = "adi,ad74413r";
        reg = <0>;
        spi-max-frequency = <1000000>;
        spi-cpol;

        #address-cells = <1>;
        #size-cells = <0>;

        interrupt-parent = <&gpio>;
        interrupts = <26 IRQ_TYPE_EDGE_FALLING>;

        refin-supply = <&ad74413r_refin>;

        channel@0 {
          reg = <0>;

          adi,ch-func = <CH_FUNC_VOLTAGE_OUTPUT>;
        };

        channel@1 {
          reg = <1>;

          adi,ch-func = <CH_FUNC_CURRENT_OUTPUT>;
        };

        channel@2 {
          reg = <2>;

          adi,ch-func = <CH_FUNC_DIGITAL_INPUT_LOGIC>;
          adi,gpo-comparator;
        };

        channel@3 {
          reg = <3>;

          adi,ch-func = <CH_FUNC_CURRENT_INPUT_EXT_POWER>;
        };
      };
    };
...