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  - interrupts
225  - AVDD-supply
226  - DBVDD1-supply
227  - CPVDD1-supply
228
229unevaluatedProperties: false
230
231examples:
232  - |
233    #include <dt-bindings/sound/madera.h>
234    i2c@e0004000 {
235        #address-cells = <1>;
236        #size-cells = <0>;
237        reg = <0xe0004000 0x1000>;
238
239        cs47l85: codec@1a {
240            compatible = "cirrus,cs47l85";
241            reg = <0x1a>;
242
243            reset-gpios = <&gpio 0>;
244            wlf,ldoena = <&gpio 1>;
245
246            interrupt-controller;
247            #interrupt-cells = <2>;
248            interrupts = <4 1 0>;
249
250            gpio-controller;
251            #gpio-cells = <2>;
252
253            AVDD-supply = <&vdd1v8>;
254            DBVDD1-supply = <&vdd1v8>;
255            DBVDD2-supply = <&vdd1v8>;
256            DBVDD3-supply = <&vdd1v8>;
257            DBVDD4-supply = <&vdd1v8>;
258            CPVDD1-supply = <&vdd1v8>;
259            CPVDD2-supply = <&vdd1v2>;
260            SPKVDDL-supply = <&vdd5v>;
261            SPKVDDR-supply = <&vdd5v>;
262
263            clocks = <&clks 0>, <&clks 1>, <&clks 2>;
264            clock-names = "mclk1", "mclk2", "mclk3";
265
266            cirrus,dmic-ref = <0 0 MADERA_DMIC_REF_MICBIAS1>;
267            cirrus,inmode = <
268                MADERA_INMODE_SE   MADERA_INMODE_SE
269                MADERA_INMODE_SE   MADERA_INMODE_SE
270                MADERA_INMODE_DIFF MADERA_INMODE_DIFF
271            >;
272            cirrus,max-channels-clocked = <2 0 0>;
273
274            pinctrl-names = "default";
275            pinctrl-0 = <&pinsettings>;
276
277            pinsettings: pin-settings {
278                aif1-pins {
279                    groups = "aif1";
280                    function = "aif1";
281                    bias-bus-hold;
282                };
283
284                aif2-pins {
285                    groups = "aif2";
286                    function = "aif2";
287                    bias-bus-hold;
288                };
289
290                aif3-pins {
291                    groups = "aif3";
292                    function = "aif3";
293                    bias-bus-hold;
294                };
295            };
296        };
297    };
298