xref: /linux/Documentation/devicetree/bindings/iio/dac/adi,ad3552r.yaml (revision a4eb44a6435d6d8f9e642407a4a06f65eb90ca04)
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  - Mihail Chindris <mihail.chindris@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        description: Configuration of custom range when
82          adi,output-range-microvolt is not present.
83          The formulas for calculation the output voltages are
84            Vout_fs = 2.5 + [(GainN + Offset/1024) * 2.5 * Rfbx * 1.03]
85            Vout_zs = 2.5 - [(GainP + Offset/1024) * 2.5 * Rfbx * 1.03]
86
87        properties:
88          adi,gain-offset:
89            description: Gain offset used in the above formula
90            $ref: /schemas/types.yaml#/definitions/int32
91            maximum: 511
92            minimum: -511
93
94          adi,gain-scaling-p-inv-log2:
95            description: GainP = 1 / ( 2 ^ adi,gain-scaling-p-inv-log2)
96            $ref: /schemas/types.yaml#/definitions/uint32
97            enum: [0, 1, 2, 3]
98
99          adi,gain-scaling-n-inv-log2:
100            description: GainN = 1 / ( 2 ^ adi,gain-scaling-n-inv-log2)
101            $ref: /schemas/types.yaml#/definitions/uint32
102            enum: [0, 1, 2, 3]
103
104          adi,rfb-ohms:
105            description: Feedback Resistor
106
107        required:
108          - adi,gain-offset
109          - adi,gain-scaling-p-inv-log2
110          - adi,gain-scaling-n-inv-log2
111          - adi,rfb-ohms
112
113    required:
114      - reg
115
116    oneOf:
117      # If adi,output-range-microvolt is missing,
118      # custom-output-range-config must be used
119      - required:
120          - adi,output-range-microvolt
121
122      - required:
123          - custom-output-range-config
124
125allOf:
126  - if:
127      properties:
128        compatible:
129          contains:
130            const: adi,ad3542r
131    then:
132      patternProperties:
133        "^channel@([0-1])$":
134          type: object
135          properties:
136            adi,output-range-microvolt:
137              description: |
138                Voltage output range of the channel as <minimum, maximum>
139                Required connections:
140                  Rfb1x for: 0 to 2.5 V; 0 to 3V; 0 to 5 V;
141                  Rfb2x for: 0 to 10 V; 2.5 to 7.5V; -5 to 5 V;
142              oneOf:
143                - items:
144                    - const: 0
145                    - enum: [2500000, 3000000, 5000000, 10000000]
146                - items:
147                    - const: -2500000
148                    - const: 7500000
149                - items:
150                    - const: -5000000
151                    - const: 5000000
152
153          required:
154            - adi,output-range-microvolt
155
156  - if:
157      properties:
158        compatible:
159          contains:
160            const: adi,ad3552r
161    then:
162      patternProperties:
163        "^channel@([0-1])$":
164          type: object
165          properties:
166            adi,output-range-microvolt:
167              description: |
168                Voltage output range of the channel as <minimum, maximum>
169                Required connections:
170                  Rfb1x for: 0 to 2.5 V; 0 to 5 V;
171                  Rfb2x for: 0 to 10 V; -5 to 5 V;
172                  Rfb4x for: -10 to 10V
173              oneOf:
174                - items:
175                    - const: 0
176                    - enum: [2500000, 5000000, 10000000]
177                - items:
178                    - const: -5000000
179                    - const: 5000000
180                - items:
181                    - const: -10000000
182                    - const: 10000000
183
184required:
185  - compatible
186  - reg
187  - spi-max-frequency
188
189additionalProperties: false
190
191examples:
192  - |
193    spi {
194      #address-cells = <1>;
195      #size-cells = <0>;
196      ad3552r@0 {
197              compatible = "adi,ad3552r";
198              reg = <0>;
199              spi-max-frequency = <20000000>;
200              #address-cells = <1>;
201              #size-cells = <0>;
202              channel@0 {
203                      reg = <0>;
204                      adi,output-range-microvolt = <0 10000000>;
205              };
206              channel@1 {
207                      reg = <1>;
208                      custom-output-range-config {
209                              adi,gain-offset = <5>;
210                              adi,gain-scaling-p-inv-log2 = <1>;
211                              adi,gain-scaling-n-inv-log2 = <2>;
212                              adi,rfb-ohms = <1>;
213                      };
214            };
215        };
216    };
217...
218