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