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