summaryrefslogtreecommitdiffstats
path: root/Documentation/devicetree/bindings/iio/dac/adi,ad5592r.yaml
blob: 30194880f45702e0e2e9714f6d3c8b91efc04b4a (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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/iio/dac/adi,ad5592r.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Analog Devices AD5592R/AD5593R DAC/ADC

maintainers:
  - Michael Hennerich <michael.hennerich@analog.com>

properties:
  compatible:
    enum:
      - adi,ad5592r
      - adi,ad5593r

  reg:
    maxItems: 1

  spi-max-frequency:
    maximum: 30000000

  spi-cpol: true

  "#address-cells":
    const: 1

  "#size-cells":
    const: 0

  "#io-channel-cells":
    const: 1

  vref-supply:
    description: If not set internal 2.5V reference used.

  reset-gpios:
    maxItems: 1

  gpio-controller:
    description: Marks the device node as a GPIO controller.

  "#gpio-cells":
    const: 2
    description:
      The first cell is the GPIO number and the second cell specifies
      GPIO flags, as defined in <dt-bindings/gpio/gpio.h>.

required:
  - compatible
  - reg
  - "#address-cells"
  - "#size-cells"

allOf:
  - if:
      properties:
        compatible:
          contains:
            const: adi,ad5592r
    then:
      required:
        - spi-cpol
    else:
      properties:
        spi-cpol: false

additionalProperties: false

patternProperties:
  "^(channel@)[0-7]$":
    type: object
    description: Child node to describe a channel
    properties:
      reg:
        minimum: 0
        maximum: 7

      adi,mode:
        $ref: /schemas/types.yaml#/definitions/uint32
        enum: [0, 1, 2, 3, 8]
        description: |
          Mode or function of this channel.
          Macros specifying the valid values can be found in
          <dt-bindings/iio/adi,ad5592r.h>.

          The following values are currently supported:
          * CH_MODE_UNUSED (the pin is unused)
          * CH_MODE_ADC (the pin is ADC input)
          * CH_MODE_DAC (the pin is DAC output)
          * CH_MODE_DAC_AND_ADC (the pin is DAC output but can be monitored
            by an ADC, since there is no disadvantage this should be
            considered as the preferred DAC mode)
          * CH_MODE_GPIO (the pin is registered with GPIOLIB)

      adi,off-state:
        $ref: /schemas/types.yaml#/definitions/uint32
        enum: [0, 1, 2, 3]
        description: |
          State of this channel when unused or the device gets removed.
          Macros specifying the  valid values can be found in
          <dt-bindings/iio/adi,ad5592r.h>.
          * CH_OFFSTATE_PULLDOWN (the pin is pulled down)
          * CH_OFFSTATE_OUT_LOW  (the pin is output low)
          * CH_OFFSTATE_OUT_HIGH (the pin is output high)
          * CH_OFFSTATE_OUT_TRISTATE (the pin is tristated output)

    required:
      - reg
      - adi,mode

    additionalProperties: false

examples:
  - |
    #include <dt-bindings/iio/adi,ad5592r.h>
    spi {
        #address-cells = <1>;
        #size-cells = <0>;

        addac@0 {
            compatible = "adi,ad5592r";
            #size-cells = <0>;
            #address-cells = <1>;
            #gpio-cells = <2>;
            reg = <0>;

            spi-max-frequency = <1000000>;
            spi-cpol;

            vref-supply = <&vref>;
            reset-gpios = <&gpio0 86 0>;
            gpio-controller;

            channel@0 {
                reg = <0>;
                adi,mode = <CH_MODE_DAC>;
            };
            channel@1 {
                reg = <1>;
                adi,mode = <CH_MODE_ADC>;
            };
            channel@2 {
                reg = <2>;
                adi,mode = <CH_MODE_DAC_AND_ADC>;
            };
            channel@3 {
                reg = <3>;
                adi,mode = <CH_MODE_DAC_AND_ADC>;
                adi,off-state = <CH_OFFSTATE_PULLDOWN>;
            };
            channel@4 {
                reg = <4>;
                adi,mode = <CH_MODE_UNUSED>;
                adi,off-state = <CH_OFFSTATE_PULLDOWN>;
            };
            channel@5 {
                reg = <5>;
                adi,mode = <CH_MODE_GPIO>;
                adi,off-state = <CH_OFFSTATE_PULLDOWN>;
            };
            channel@6 {
                reg = <6>;
                adi,mode = <CH_MODE_GPIO>;
                adi,off-state = <CH_OFFSTATE_PULLDOWN>;
            };
            channel@7 {
                reg = <7>;
                adi,mode = <CH_MODE_GPIO>;
                adi,off-state = <CH_OFFSTATE_PULLDOWN>;
            };
        };
        ad5593r@10 {
            compatible = "adi,ad5593r";
            #size-cells = <0>;
            #address-cells = <1>;
            #gpio-cells = <2>;
            reg = <0x10>;
            gpio-controller;

            channel@0 {
                reg = <0>;
                adi,mode = <CH_MODE_DAC>;
                adi,off-state = <CH_OFFSTATE_PULLDOWN>;
            };
            channel@1 {
                reg = <1>;
                adi,mode = <CH_MODE_ADC>;
                adi,off-state = <CH_OFFSTATE_PULLDOWN>;
            };
            channel@2 {
                reg = <2>;
                adi,mode = <CH_MODE_DAC_AND_ADC>;
                adi,off-state = <CH_OFFSTATE_PULLDOWN>;
            };
            channel@6 {
                reg = <6>;
                adi,mode = <CH_MODE_GPIO>;
                adi,off-state = <CH_OFFSTATE_PULLDOWN>;
            };
        };
    };
...