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