1# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/mfd/cirrus,madera.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Cirrus Logic Madera class audio CODECs Multi-Functional Device
8
9maintainers:
10  - patches@opensource.cirrus.com
11
12description: |
13  These devices are audio SoCs with extensive digital capabilities and a range
14  of analogue I/O.
15
16  See also the child driver bindings in:
17
18    bindings/pinctrl/cirrus,madera.yaml
19    bindings/regulator/wlf,arizona.yaml
20    bindings/sound/cirrus,madera.yaml
21
22allOf:
23  - $ref: /schemas/pinctrl/cirrus,madera.yaml#
24  - $ref: /schemas/regulator/wlf,arizona.yaml#
25  - $ref: /schemas/sound/cirrus,madera.yaml#
26  - if:
27      properties:
28        compatible:
29          contains:
30            enum:
31              - cirrus,cs47l85
32              - wlf,wm1840
33    then:
34      properties:
35        SPKVDDL-supply:
36          description:
37            Left speaker driver power supply.
38
39        SPKVDDR-supply:
40          description:
41            Right speaker driver power supply.
42
43      required:
44        - SPKVDDL-supply
45        - SPKVDDR-supply
46    else:
47      required:
48        - DCVDD-supply
49  - if:
50      properties:
51        compatible:
52          contains:
53            enum:
54              - cirrus,cs47l15
55              - cirrus,cs47l35
56    then:
57      properties:
58        SPKVDD-supply:
59          description:
60            Mono speaker driver power supply.
61
62      required:
63        - SPKVDD-supply
64  - if:
65      properties:
66        compatible:
67          contains:
68            enum:
69              - cirrus,cs47l35
70              - cirrus,cs47l85
71              - cirrus,cs47l90
72              - cirrus,cs47l91
73              - wlf,wm1840
74    then:
75      properties:
76        DBVDD2-supply:
77          description:
78            Databus power supply.
79
80      required:
81        - DBVDD2-supply
82  - if:
83      properties:
84        compatible:
85          contains:
86            enum:
87              - cirrus,cs47l85
88              - cirrus,cs47l90
89              - cirrus,cs47l91
90              - wlf,wm1840
91    then:
92      properties:
93        DBVDD3-supply:
94          description:
95            Databus power supply.
96
97        DBVDD4-supply:
98          description:
99            Databus power supply.
100  - if:
101      properties:
102        compatible:
103          contains:
104            enum:
105              - cirrus,cs47l15
106    then:
107      required:
108        - MICVDD-supply
109    else:
110      properties:
111        CPVDD2-supply:
112          description:
113            Secondary charge pump power supply.
114
115      required:
116        - CPVDD2-supply
117
118properties:
119  compatible:
120    enum:
121      - cirrus,cs47l15
122      - cirrus,cs47l35
123      - cirrus,cs47l85
124      - cirrus,cs47l90
125      - cirrus,cs47l91
126      - cirrus,cs42l92
127      - cirrus,cs47l92
128      - cirrus,cs47l93
129      - cirrus,wm1840
130
131  reg:
132    maxItems: 1
133
134  gpio-controller: true
135
136  '#gpio-cells':
137    description:
138      The first cell is the pin number. The second cell is reserved for
139      future use and must be zero
140    const: 2
141
142  interrupt-controller: true
143
144  '#interrupt-cells':
145    description:
146      The first cell is the IRQ number.
147      The second cell is the flags, encoded as the trigger masks from
148      bindings/interrupt-controller/interrupts.txt
149    const: 2
150
151  interrupts:
152    maxItems: 1
153
154  reset-gpios:
155    description:
156      One entry specifying the GPIO controlling /RESET.  As defined in
157      bindings/gpio.txt.  Although optional, it is strongly recommended
158      to use a hardware reset.
159    maxItems: 1
160
161  clocks:
162    description:
163      Should reference the clocks supplied on MCLK1, MCLK2 and MCLK3.
164    minItems: 1
165    maxItems: 3
166
167  clock-names:
168    description: |
169      May contain up to three strings:
170        "mclk1" For the clock supplied on MCLK1, recommended to be a
171                high quality audio reference clock.
172        "mclk2" For the clock supplied on MCLK2, required to be an
173                always on 32k clock.
174        "mclk3" For the clock supplied on MCLK3.
175    oneOf:
176      - items:
177          - const: mclk1
178      - items:
179          - const: mclk2
180      - items:
181          - const: mclk3
182      - items:
183          - const: mclk1
184          - const: mclk2
185      - items:
186          - const: mclk1
187          - const: mclk3
188      - items:
189          - const: mclk2
190          - const: mclk3
191      - items:
192          - const: mclk1
193          - const: mclk2
194          - const: mclk3
195
196  AVDD-supply:
197    description:
198      Analogue power supply.
199
200  DBVDD1-supply:
201    description:
202      Databus power supply.
203
204  CPVDD1-supply:
205    description:
206      Charge pump power supply.
207
208  DCVDD-supply:
209    description:
210      Digital power supply, optional on CS47L85, WM1840 where it can
211      be supplied internally.
212
213  MICVDD-supply:
214    description:
215      Microphone power supply, normally supplied internally except on
216      cs47l24, wm1831 where it is mandatory.
217
218required:
219  - compatible
220  - gpio-controller
221  - '#gpio-cells'
222  - interrupt-controller
223  - '#interrupt-cells'
224  - interrupt-parent
225  - interrupts
226  - AVDD-supply
227  - DBVDD1-supply
228  - CPVDD1-supply
229
230unevaluatedProperties: false
231
232examples:
233  - |
234    #include <dt-bindings/sound/madera.h>
235    i2c@e0004000 {
236        #address-cells = <1>;
237        #size-cells = <0>;
238        reg = <0xe0004000 0x1000>;
239
240        cs47l85: codec@1a {
241            compatible = "cirrus,cs47l85";
242            reg = <0x1a>;
243
244            reset-gpios = <&gpio 0>;
245            wlf,ldoena = <&gpio 1>;
246
247            interrupt-controller;
248            #interrupt-cells = <2>;
249            interrupts = <&host_irq1>;
250            interrupt-parent = <&gic>;
251
252            gpio-controller;
253            #gpio-cells = <2>;
254
255            AVDD-supply = <&vdd1v8>;
256            DBVDD1-supply = <&vdd1v8>;
257            DBVDD2-supply = <&vdd1v8>;
258            DBVDD3-supply = <&vdd1v8>;
259            DBVDD4-supply = <&vdd1v8>;
260            CPVDD1-supply = <&vdd1v8>;
261            CPVDD2-supply = <&vdd1v2>;
262            SPKVDDL-supply = <&vdd5v>;
263            SPKVDDR-supply = <&vdd5v>;
264
265            clocks = <&clks 0>, <&clks 1>, <&clks 2>;
266            clock-names = "mclk1", "mclk2", "mclk3";
267
268            cirrus,dmic-ref = <0 0 MADERA_DMIC_REF_MICBIAS1>;
269            cirrus,inmode = <
270                MADERA_INMODE_SE   MADERA_INMODE_SE
271                MADERA_INMODE_SE   MADERA_INMODE_SE
272                MADERA_INMODE_DIFF MADERA_INMODE_DIFF
273            >;
274            cirrus,max-channels-clocked = <2 0 0>;
275
276            pinctrl-names = "default";
277            pinctrl-0 = <&pinsettings>;
278
279            pinsettings: pin-settings {
280                aif1-pins {
281                    groups = "aif1";
282                    function = "aif1";
283                    bias-bus-hold;
284                };
285
286                aif2-pins {
287                    groups = "aif2";
288                    function = "aif2";
289                    bias-bus-hold;
290                };
291
292                aif3-pins {
293                    groups = "aif3";
294                    function = "aif3";
295                    bias-bus-hold;
296                };
297            };
298        };
299    };
300