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 Device Tree Bindings
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    description: GPIO to enable the external amplifier
92
93required:
94  - "#sound-dai-cells"
95  - compatible
96  - reg
97  - interrupts
98  - clocks
99  - clock-names
100  - dmas
101  - dma-names
102
103allOf:
104  - if:
105      properties:
106        compatible:
107          enum:
108            - allwinner,sun6i-a31-codec
109            - allwinner,sun8i-a23-codec
110            - allwinner,sun8i-h3-codec
111            - allwinner,sun8i-v3s-codec
112
113    then:
114      if:
115        properties:
116          compatible:
117            const: allwinner,sun6i-a31-codec
118
119      then:
120        required:
121          - resets
122          - allwinner,audio-routing
123
124      else:
125        required:
126          - resets
127          - allwinner,audio-routing
128          - allwinner,codec-analog-controls
129
130  - if:
131      properties:
132        compatible:
133          enum:
134            - allwinner,sun6i-a31-codec
135
136    then:
137      properties:
138        allwinner,audio-routing:
139          items:
140            enum:
141              - HP
142              - HPCOM
143              - LINEIN
144              - LINEOUT
145              - MIC1
146              - MIC2
147              - MIC3
148              - HBIAS
149              - MBIAS
150              - Headphone
151              - Headset Mic
152              - Line In
153              - Line Out
154              - Mic
155              - Speaker
156
157  - if:
158      properties:
159        compatible:
160          enum:
161            - allwinner,sun8i-a23-codec
162
163    then:
164      properties:
165        allwinner,audio-routing:
166          items:
167            enum:
168              - HP
169              - HPCOM
170              - LINEIN
171              - MIC1
172              - MIC2
173              - HBIAS
174              - MBIAS
175              - Headphone
176              - Headset Mic
177              - Line In
178              - Line Out
179              - Mic
180              - Speaker
181
182  - if:
183      properties:
184        compatible:
185          enum:
186            - allwinner,sun8i-h3-codec
187
188    then:
189      properties:
190        allwinner,audio-routing:
191          items:
192            enum:
193              - HP
194              - HPCOM
195              - LINEIN
196              - LINEOUT
197              - MIC1
198              - MIC2
199              - HBIAS
200              - MBIAS
201              - Headphone
202              - Headset Mic
203              - Line In
204              - Line Out
205              - Mic
206              - Speaker
207
208  - if:
209      properties:
210        compatible:
211          enum:
212            - allwinner,sun8i-v3s-codec
213
214    then:
215      properties:
216        allwinner,audio-routing:
217          items:
218            enum:
219              - HP
220              - HPCOM
221              - MIC1
222              - HBIAS
223              - Headphone
224              - Headset Mic
225              - Line In
226              - Line Out
227              - Mic
228              - Speaker
229
230additionalProperties: false
231
232examples:
233  - |
234    codec@1c22c00 {
235        #sound-dai-cells = <0>;
236        compatible = "allwinner,sun7i-a20-codec";
237        reg = <0x01c22c00 0x40>;
238        interrupts = <0 30 4>;
239        clocks = <&apb0_gates 0>, <&codec_clk>;
240        clock-names = "apb", "codec";
241        dmas = <&dma 0 19>, <&dma 0 19>;
242        dma-names = "rx", "tx";
243    };
244
245  - |
246    codec@1c22c00 {
247        #sound-dai-cells = <0>;
248        compatible = "allwinner,sun6i-a31-codec";
249        reg = <0x01c22c00 0x98>;
250        interrupts = <0 29 4>;
251        clocks = <&ccu 61>, <&ccu 135>;
252        clock-names = "apb", "codec";
253        resets = <&ccu 42>;
254        dmas = <&dma 15>, <&dma 15>;
255        dma-names = "rx", "tx";
256        allwinner,audio-routing =
257            "Headphone", "HP",
258            "Speaker", "LINEOUT",
259            "LINEIN", "Line In",
260            "MIC1", "MBIAS",
261            "MIC1", "Mic",
262            "MIC2", "HBIAS",
263            "MIC2", "Headset Mic";
264    };
265
266...
267