1# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2# Copyright 2020 Analog Devices Inc.
3%YAML 1.2
4---
5$id: http://devicetree.org/schemas/iio/dac/adi,ad3552r.yaml#
6$schema: http://devicetree.org/meta-schemas/core.yaml#
7
8title: Analog Devices AD2552R DAC device driver
9
10maintainers:
11  - Nuno Sá <nuno.sa@analog.com>
12
13description: |
14  Bindings for the Analog Devices AD3552R DAC device and similar.
15  Datasheet can be found here:
16    https://www.analog.com/media/en/technical-documentation/data-sheets/ad3542r.pdf
17    https://www.analog.com/media/en/technical-documentation/data-sheets/ad3552r.pdf
18
19properties:
20  compatible:
21    enum:
22      - adi,ad3542r
23      - adi,ad3552r
24
25  reg:
26    maxItems: 1
27
28  spi-max-frequency:
29    maximum: 30000000
30
31  reset-gpios:
32    maxItems: 1
33
34  ldac-gpios:
35    description: |
36      LDAC pin to be used as a hardware trigger to update the DAC channels.
37    maxItems: 1
38
39  vref-supply:
40    description:
41      The regulator to use as an external reference. If it does not exists the
42      internal reference will be used. External reference must be 2.5V
43
44  adi,vref-out-en:
45    description: Vref I/O driven by internal vref to 2.5V. If not set, Vref pin
46      will be floating.
47    type: boolean
48
49  adi,sdo-drive-strength:
50    description: |
51      Configure SDIO0 and SDIO1 strength levels:
52        - 0: low SDO drive strength.
53        - 1: medium low SDO drive strength.
54        - 2: medium high SDO drive strength.
55        - 3: high SDO drive strength
56    $ref: /schemas/types.yaml#/definitions/uint32
57    enum: [0, 1, 2, 3]
58
59  '#address-cells':
60    const: 1
61
62  '#size-cells':
63    const: 0
64
65patternProperties:
66  "^channel@([0-1])$":
67    type: object
68    description: Configurations of the DAC Channels
69
70    additionalProperties: false
71
72    properties:
73      reg:
74        description: Channel number
75        enum: [0, 1]
76
77      adi,output-range-microvolt: true
78
79      custom-output-range-config:
80        type: object
81        additionalProperties: false
82        description: Configuration of custom range when
83          adi,output-range-microvolt is not present.
84          The formulas for calculation the output voltages are
85            Vout_fs = 2.5 + [(GainN + Offset/1024) * 2.5 * Rfbx * 1.03]
86            Vout_zs = 2.5 - [(GainP + Offset/1024) * 2.5 * Rfbx * 1.03]
87
88        properties:
89          adi,gain-offset:
90            description: Gain offset used in the above formula
91            $ref: /schemas/types.yaml#/definitions/int32
92            maximum: 511
93            minimum: -511
94
95          adi,gain-scaling-p-inv-log2:
96            description: GainP = 1 / ( 2 ^ adi,gain-scaling-p-inv-log2)
97            $ref: /schemas/types.yaml#/definitions/uint32
98            enum: [0, 1, 2, 3]
99
100          adi,gain-scaling-n-inv-log2:
101            description: GainN = 1 / ( 2 ^ adi,gain-scaling-n-inv-log2)
102            $ref: /schemas/types.yaml#/definitions/uint32
103            enum: [0, 1, 2, 3]
104
105          adi,rfb-ohms:
106            description: Feedback Resistor
107
108        required:
109          - adi,gain-offset
110          - adi,gain-scaling-p-inv-log2
111          - adi,gain-scaling-n-inv-log2
112          - adi,rfb-ohms
113
114    required:
115      - reg
116
117    oneOf:
118      # If adi,output-range-microvolt is missing,
119      # custom-output-range-config must be used
120      - required:
121          - adi,output-range-microvolt
122
123      - required:
124          - custom-output-range-config
125
126allOf:
127  - if:
128      properties:
129        compatible:
130          contains:
131            const: adi,ad3542r
132    then:
133      patternProperties:
134        "^channel@([0-1])$":
135          type: object
136          properties:
137            adi,output-range-microvolt:
138              description: |
139                Voltage output range of the channel as <minimum, maximum>
140                Required connections:
141                  Rfb1x for: 0 to 2.5 V; 0 to 3V; 0 to 5 V;
142                  Rfb2x for: 0 to 10 V; 2.5 to 7.5V; -5 to 5 V;
143              oneOf:
144                - items:
145                    - const: 0
146                    - enum: [2500000, 3000000, 5000000, 10000000]
147                - items:
148                    - const: -2500000
149                    - const: 7500000
150                - items:
151                    - const: -5000000
152                    - const: 5000000
153
154          required:
155            - adi,output-range-microvolt
156
157  - if:
158      properties:
159        compatible:
160          contains:
161            const: adi,ad3552r
162    then:
163      patternProperties:
164        "^channel@([0-1])$":
165          type: object
166          properties:
167            adi,output-range-microvolt:
168              description: |
169                Voltage output range of the channel as <minimum, maximum>
170                Required connections:
171                  Rfb1x for: 0 to 2.5 V; 0 to 5 V;
172                  Rfb2x for: 0 to 10 V; -5 to 5 V;
173                  Rfb4x for: -10 to 10V
174              oneOf:
175                - items:
176                    - const: 0
177                    - enum: [2500000, 5000000, 10000000]
178                - items:
179                    - const: -5000000
180                    - const: 5000000
181                - items:
182                    - const: -10000000
183                    - const: 10000000
184
185required:
186  - compatible
187  - reg
188  - spi-max-frequency
189
190additionalProperties: false
191
192examples:
193  - |
194    spi {
195      #address-cells = <1>;
196      #size-cells = <0>;
197      ad3552r@0 {
198              compatible = "adi,ad3552r";
199              reg = <0>;
200              spi-max-frequency = <20000000>;
201              #address-cells = <1>;
202              #size-cells = <0>;
203              channel@0 {
204                      reg = <0>;
205                      adi,output-range-microvolt = <0 10000000>;
206              };
207              channel@1 {
208                      reg = <1>;
209                      custom-output-range-config {
210                              adi,gain-offset = <5>;
211                              adi,gain-scaling-p-inv-log2 = <1>;
212                              adi,gain-scaling-n-inv-log2 = <2>;
213                              adi,rfb-ohms = <1>;
214                      };
215            };
216        };
217    };
218...
219