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