1# SPDX-License-Identifier: GPL-2.0
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/sound/allwinner,sun4i-a10-codec.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Allwinner A10 Codec
8
9maintainers:
10  - Chen-Yu Tsai <[email protected]>
11  - Maxime Ripard <[email protected]>
12
13properties:
14  "#sound-dai-cells":
15    const: 0
16
17  compatible:
18    enum:
19      - allwinner,sun4i-a10-codec
20      - allwinner,sun6i-a31-codec
21      - allwinner,sun7i-a20-codec
22      - allwinner,sun8i-a23-codec
23      - allwinner,sun8i-h3-codec
24      - allwinner,sun8i-v3s-codec
25      - allwinner,sun50i-h616-codec
26      - allwinner,suniv-f1c100s-codec
27
28  reg:
29    maxItems: 1
30
31  interrupts:
32    maxItems: 1
33
34  clocks:
35    items:
36      - description: Bus Clock
37      - description: Module Clock
38
39  clock-names:
40    items:
41      - const: apb
42      - const: codec
43
44  dmas:
45    oneOf:
46      - items:
47          - description: RX DMA Channel
48          - description: TX DMA Channel
49      - items:
50          - description: TX DMA Channel
51
52  dma-names:
53    oneOf:
54      - items:
55          - const: rx
56          - const: tx
57      - items:
58          - const: tx
59
60  resets:
61    maxItems: 1
62
63  allwinner,audio-routing:
64    description: |-
65      A list of the connections between audio components.  Each entry
66      is a pair of strings, the first being the connection's sink, the
67      second being the connection's source.
68    $ref: /schemas/types.yaml#/definitions/non-unique-string-array
69    minItems: 2
70    maxItems: 18
71    items:
72      enum:
73        # Audio Pins on the SoC
74        - HP
75        - HPCOM
76        - LINEIN
77        - LINEOUT
78        - MIC1
79        - MIC2
80        - MIC3
81        - MIC
82
83        # Microphone Biases from the SoC
84        - HBIAS
85        - MBIAS
86
87        # Board Connectors
88        - Headphone
89        - Headset Mic
90        - Line In
91        - Line Out
92        - Right FM In
93        - Left FM In
94        - Mic
95        - Speaker
96
97  allwinner,codec-analog-controls:
98    $ref: /schemas/types.yaml#/definitions/phandle
99    description: Phandle to the codec analog controls in the PRCM
100
101  allwinner,pa-gpios:
102    maxItems: 1
103    description: GPIO to enable the external amplifier
104
105required:
106  - "#sound-dai-cells"
107  - compatible
108  - reg
109  - interrupts
110  - clocks
111  - clock-names
112  - dmas
113  - dma-names
114
115allOf:
116  - $ref: dai-common.yaml#
117  - if:
118      properties:
119        compatible:
120          enum:
121            - allwinner,sun6i-a31-codec
122            - allwinner,sun8i-a23-codec
123            - allwinner,sun8i-h3-codec
124            - allwinner,sun8i-v3s-codec
125
126    then:
127      if:
128        properties:
129          compatible:
130            const: allwinner,sun6i-a31-codec
131
132      then:
133        required:
134          - resets
135          - allwinner,audio-routing
136
137      else:
138        required:
139          - resets
140          - allwinner,audio-routing
141          - allwinner,codec-analog-controls
142
143  - if:
144      properties:
145        compatible:
146          enum:
147            - allwinner,sun6i-a31-codec
148
149    then:
150      properties:
151        allwinner,audio-routing:
152          items:
153            enum:
154              - HP
155              - HPCOM
156              - LINEIN
157              - LINEOUT
158              - MIC1
159              - MIC2
160              - MIC3
161              - HBIAS
162              - MBIAS
163              - Headphone
164              - Headset Mic
165              - Line In
166              - Line Out
167              - Mic
168              - Speaker
169
170  - if:
171      properties:
172        compatible:
173          enum:
174            - allwinner,sun8i-a23-codec
175
176    then:
177      properties:
178        allwinner,audio-routing:
179          items:
180            enum:
181              - HP
182              - HPCOM
183              - LINEIN
184              - MIC1
185              - MIC2
186              - HBIAS
187              - MBIAS
188              - Headphone
189              - Headset Mic
190              - Line In
191              - Line Out
192              - Mic
193              - Speaker
194
195  - if:
196      properties:
197        compatible:
198          enum:
199            - allwinner,sun8i-h3-codec
200
201    then:
202      properties:
203        allwinner,audio-routing:
204          items:
205            enum:
206              - HP
207              - HPCOM
208              - LINEIN
209              - LINEOUT
210              - MIC1
211              - MIC2
212              - HBIAS
213              - MBIAS
214              - Headphone
215              - Headset Mic
216              - Line In
217              - Line Out
218              - Mic
219              - Speaker
220
221  - if:
222      properties:
223        compatible:
224          enum:
225            - allwinner,sun8i-v3s-codec
226
227    then:
228      properties:
229        allwinner,audio-routing:
230          items:
231            enum:
232              - HP
233              - HPCOM
234              - MIC1
235              - HBIAS
236              - Headphone
237              - Headset Mic
238              - Line In
239              - Line Out
240              - Mic
241              - Speaker
242
243  - if:
244      properties:
245        compatible:
246          enum:
247            - allwinner,sun50i-h616-codec
248
249    then:
250      properties:
251        allwinner,audio-routing:
252          items:
253            enum:
254              - LINEOUT
255              - Line Out
256
257        dmas:
258          items:
259            - description: TX DMA Channel
260
261        dma-names:
262          items:
263            - const: tx
264
265    else:
266      properties:
267        dmas:
268          items:
269            - description: RX DMA Channel
270            - description: TX DMA Channel
271
272        dma-names:
273          items:
274            - const: rx
275            - const: tx
276
277  - if:
278      properties:
279        compatible:
280          enum:
281            - allwinner,suniv-f1c100s-codec
282
283    then:
284      properties:
285        allwinner,audio-routing:
286          items:
287            enum:
288              - HP
289              - HPCOM
290              - LINEIN
291              - LINEOUT
292              - MIC
293              - HBIAS
294              - MBIAS
295              - Headphone
296              - Headset Mic
297              - Line In
298              - Line Out
299              - Right FM In
300              - Left FM In
301              - Mic
302              - Speaker
303
304unevaluatedProperties: false
305
306examples:
307  - |
308    codec@1c22c00 {
309        #sound-dai-cells = <0>;
310        compatible = "allwinner,sun7i-a20-codec";
311        reg = <0x01c22c00 0x40>;
312        interrupts = <0 30 4>;
313        clocks = <&apb0_gates 0>, <&codec_clk>;
314        clock-names = "apb", "codec";
315        dmas = <&dma 0 19>, <&dma 0 19>;
316        dma-names = "rx", "tx";
317    };
318
319  - |
320    codec@1c22c00 {
321        #sound-dai-cells = <0>;
322        compatible = "allwinner,sun6i-a31-codec";
323        reg = <0x01c22c00 0x98>;
324        interrupts = <0 29 4>;
325        clocks = <&ccu 61>, <&ccu 135>;
326        clock-names = "apb", "codec";
327        resets = <&ccu 42>;
328        dmas = <&dma 15>, <&dma 15>;
329        dma-names = "rx", "tx";
330        allwinner,audio-routing =
331            "Headphone", "HP",
332            "Speaker", "LINEOUT",
333            "LINEIN", "Line In",
334            "MIC1", "MBIAS",
335            "MIC1", "Mic",
336            "MIC2", "HBIAS",
337            "MIC2", "Headset Mic";
338    };
339
340...
341