xref: /linux/Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-codec.yaml (revision 6315d93541f8a5f77c5ef5c4f25233e66d189603)
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 <wens@csie.org>
11  - Maxime Ripard <mripard@kernel.org>
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
105  hp-det-gpios:
106    maxItems: 1
107    description: GPIO for headphone/line-out detection
108
109required:
110  - "#sound-dai-cells"
111  - compatible
112  - reg
113  - interrupts
114  - clocks
115  - clock-names
116  - dmas
117  - dma-names
118
119allOf:
120  - $ref: dai-common.yaml#
121  - if:
122      properties:
123        compatible:
124          enum:
125            - allwinner,sun6i-a31-codec
126            - allwinner,sun8i-a23-codec
127            - allwinner,sun8i-h3-codec
128            - allwinner,sun8i-v3s-codec
129
130    then:
131      if:
132        properties:
133          compatible:
134            const: allwinner,sun6i-a31-codec
135
136      then:
137        required:
138          - resets
139          - allwinner,audio-routing
140
141      else:
142        required:
143          - resets
144          - allwinner,audio-routing
145          - allwinner,codec-analog-controls
146
147  - if:
148      properties:
149        compatible:
150          enum:
151            - allwinner,sun6i-a31-codec
152
153    then:
154      properties:
155        allwinner,audio-routing:
156          items:
157            enum:
158              - HP
159              - HPCOM
160              - LINEIN
161              - LINEOUT
162              - MIC1
163              - MIC2
164              - MIC3
165              - HBIAS
166              - MBIAS
167              - Headphone
168              - Headset Mic
169              - Line In
170              - Line Out
171              - Mic
172              - Speaker
173
174  - if:
175      properties:
176        compatible:
177          enum:
178            - allwinner,sun8i-a23-codec
179
180    then:
181      properties:
182        allwinner,audio-routing:
183          items:
184            enum:
185              - HP
186              - HPCOM
187              - LINEIN
188              - MIC1
189              - MIC2
190              - HBIAS
191              - MBIAS
192              - Headphone
193              - Headset Mic
194              - Line In
195              - Line Out
196              - Mic
197              - Speaker
198
199  - if:
200      properties:
201        compatible:
202          enum:
203            - allwinner,sun8i-h3-codec
204
205    then:
206      properties:
207        allwinner,audio-routing:
208          items:
209            enum:
210              - HP
211              - HPCOM
212              - LINEIN
213              - LINEOUT
214              - MIC1
215              - MIC2
216              - HBIAS
217              - MBIAS
218              - Headphone
219              - Headset Mic
220              - Line In
221              - Line Out
222              - Mic
223              - Speaker
224
225  - if:
226      properties:
227        compatible:
228          enum:
229            - allwinner,sun8i-v3s-codec
230
231    then:
232      properties:
233        allwinner,audio-routing:
234          items:
235            enum:
236              - HP
237              - HPCOM
238              - MIC1
239              - HBIAS
240              - Headphone
241              - Headset Mic
242              - Line In
243              - Line Out
244              - Mic
245              - Speaker
246
247  - if:
248      properties:
249        compatible:
250          enum:
251            - allwinner,sun50i-h616-codec
252
253    then:
254      properties:
255        allwinner,audio-routing:
256          items:
257            enum:
258              - Headphone
259              - LINEOUT
260              - Line Out
261              - Speaker
262
263        dmas:
264          items:
265            - description: TX DMA Channel
266
267        dma-names:
268          items:
269            - const: tx
270
271    else:
272      properties:
273        dmas:
274          items:
275            - description: RX DMA Channel
276            - description: TX DMA Channel
277
278        dma-names:
279          items:
280            - const: rx
281            - const: tx
282
283  - if:
284      properties:
285        compatible:
286          enum:
287            - allwinner,suniv-f1c100s-codec
288
289    then:
290      properties:
291        allwinner,audio-routing:
292          items:
293            enum:
294              - HP
295              - HPCOM
296              - LINEIN
297              - LINEOUT
298              - MIC
299              - HBIAS
300              - MBIAS
301              - Headphone
302              - Headset Mic
303              - Line In
304              - Line Out
305              - Right FM In
306              - Left FM In
307              - Mic
308              - Speaker
309
310unevaluatedProperties: false
311
312examples:
313  - |
314    codec@1c22c00 {
315        #sound-dai-cells = <0>;
316        compatible = "allwinner,sun7i-a20-codec";
317        reg = <0x01c22c00 0x40>;
318        interrupts = <0 30 4>;
319        clocks = <&apb0_gates 0>, <&codec_clk>;
320        clock-names = "apb", "codec";
321        dmas = <&dma 0 19>, <&dma 0 19>;
322        dma-names = "rx", "tx";
323    };
324
325  - |
326    codec@1c22c00 {
327        #sound-dai-cells = <0>;
328        compatible = "allwinner,sun6i-a31-codec";
329        reg = <0x01c22c00 0x98>;
330        interrupts = <0 29 4>;
331        clocks = <&ccu 61>, <&ccu 135>;
332        clock-names = "apb", "codec";
333        resets = <&ccu 42>;
334        dmas = <&dma 15>, <&dma 15>;
335        dma-names = "rx", "tx";
336        allwinner,audio-routing =
337            "Headphone", "HP",
338            "Speaker", "LINEOUT",
339            "LINEIN", "Line In",
340            "MIC1", "MBIAS",
341            "MIC1", "Mic",
342            "MIC2", "HBIAS",
343            "MIC2", "Headset Mic";
344    };
345
346...
347