xref: /freebsd/sys/contrib/device-tree/Bindings/sound/simple-card.yaml (revision 77013d11e6483b970af25e13c9b892075742f7e5)
1# SPDX-License-Identifier: GPL-2.0
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/sound/simple-card.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Simple Audio Card Driver Device Tree Bindings
8
9maintainers:
10  - Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
11
12definitions:
13
14  frame-master:
15    description: Indicates dai-link frame master.
16    $ref: /schemas/types.yaml#/definitions/phandle
17
18  bitclock-master:
19    description: Indicates dai-link bit clock master
20    $ref: /schemas/types.yaml#/definitions/phandle
21
22  frame-inversion:
23    description: dai-link uses frame clock inversion
24    $ref: /schemas/types.yaml#/definitions/flag
25
26  bitclock-inversion:
27    description: dai-link uses bit clock inversion
28    $ref: /schemas/types.yaml#/definitions/flag
29
30  dai-tdm-slot-num:
31    description: see tdm-slot.txt.
32    $ref: /schemas/types.yaml#/definitions/uint32
33
34  dai-tdm-slot-width:
35    description: see tdm-slot.txt.
36    $ref: /schemas/types.yaml#/definitions/uint32
37
38  system-clock-frequency:
39    description: |
40      If a clock is specified and a multiplication factor is given with
41      mclk-fs, the clock will be set to the calculated mclk frequency
42      when the stream starts.
43    $ref: /schemas/types.yaml#/definitions/uint32
44
45  system-clock-direction-out:
46    description: |
47      specifies clock direction as 'out' on initialization.
48      It is useful for some aCPUs with fixed clocks.
49    $ref: /schemas/types.yaml#/definitions/flag
50
51  mclk-fs:
52    description: |
53      Multiplication factor between stream rate and codec mclk.
54      When defined, mclk-fs property defined in dai-link sub nodes are ignored.
55    $ref: /schemas/types.yaml#/definitions/uint32
56
57  aux-devs:
58    description: |
59      List of phandles pointing to auxiliary devices, such
60      as amplifiers, to be added to the sound card.
61    $ref: /schemas/types.yaml#/definitions/phandle-array
62
63  convert-rate:
64    description: CPU to Codec rate convert.
65    $ref: /schemas/types.yaml#/definitions/uint32
66
67  convert-channels:
68    description: CPU to Codec rate channels.
69    $ref: /schemas/types.yaml#/definitions/uint32
70
71  prefix:
72    description: "device name prefix"
73    $ref: /schemas/types.yaml#/definitions/string
74
75  label:
76    maxItems: 1
77
78  routing:
79    description: |
80      A list of the connections between audio components.
81      Each entry is a pair of strings, the first being the
82      connection's sink, the second being the connection's source.
83    $ref: /schemas/types.yaml#/definitions/non-unique-string-array
84
85  widgets:
86    description: User specified audio sound widgets.
87    $ref: /schemas/types.yaml#/definitions/non-unique-string-array
88
89  pin-switches:
90    description: the widget names for which pin switches must be created.
91    $ref: /schemas/types.yaml#/definitions/string-array
92
93  format:
94    description: audio format.
95    items:
96      enum:
97        - i2s
98        - right_j
99        - left_j
100        - dsp_a
101        - dsp_b
102        - ac97
103        - pdm
104        - msb
105        - lsb
106
107  dai:
108    type: object
109    properties:
110      sound-dai:
111        maxItems: 1
112
113      # common properties
114      mclk-fs:
115        $ref: "#/definitions/mclk-fs"
116      prefix:
117        $ref: "#/definitions/prefix"
118      frame-inversion:
119        $ref: "#/definitions/frame-inversion"
120      bitclock-inversion:
121        $ref: "#/definitions/bitclock-inversion"
122      frame-master:
123        $ref: /schemas/types.yaml#/definitions/flag
124      bitclock-master:
125        $ref: /schemas/types.yaml#/definitions/flag
126
127      dai-tdm-slot-num:
128        $ref: "#/definitions/dai-tdm-slot-num"
129      dai-tdm-slot-width:
130        $ref: "#/definitions/dai-tdm-slot-width"
131      clocks:
132        maxItems: 1
133      system-clock-frequency:
134        $ref: "#/definitions/system-clock-frequency"
135      system-clock-direction-out:
136        $ref: "#/definitions/system-clock-direction-out"
137    required:
138      - sound-dai
139
140properties:
141  compatible:
142    contains:
143      enum:
144        - simple-audio-card
145        - simple-scu-audio-card
146
147  "#address-cells":
148    const: 1
149  "#size-cells":
150    const: 0
151
152  label:
153    $ref: "#/definitions/label"
154
155  simple-audio-card,name:
156    description: User specified audio sound card name.
157    $ref: /schemas/types.yaml#/definitions/string
158
159# use patternProperties to avoid naming "xxx,yyy" issue
160patternProperties:
161  "^simple-audio-card,widgets$":
162    $ref: "#/definitions/widgets"
163  "^simple-audio-card,routing$":
164    $ref: "#/definitions/routing"
165  "^simple-audio-card,cpu(@[0-9a-f]+)?":
166    $ref: "#/definitions/dai"
167  "^simple-audio-card,codec(@[0-9a-f]+)?":
168    $ref: "#/definitions/dai"
169
170  # common properties
171  "^simple-audio-card,frame-master$":
172    $ref: "#/definitions/frame-master"
173  "^simple-audio-card,bitclock-master$":
174    $ref: "#/definitions/bitclock-master"
175  "^simple-audio-card,frame-inversion$":
176    $ref: "#/definitions/frame-inversion"
177  "^simple-audio-card,bitclock-inversion$":
178    $ref: "#/definitions/bitclock-inversion"
179  "^simple-audio-card,format$":
180    $ref: "#/definitions/format"
181  "^simple-audio-card,mclk-fs$":
182    $ref: "#/definitions/mclk-fs"
183  "^simple-audio-card,aux-devs$":
184    $ref: "#/definitions/aux-devs"
185  "^simple-audio-card,convert-rate$":
186    $ref: "#/definitions/convert-rate"
187  "^simple-audio-card,convert-channels$":
188    $ref: "#/definitions/convert-channels"
189  "^simple-audio-card,prefix$":
190    $ref: "#/definitions/prefix"
191  "^simple-audio-card,pin-switches$":
192    $ref: "#/definitions/pin-switches"
193  "^simple-audio-card,hp-det-gpio$":
194    maxItems: 1
195  "^simple-audio-card,mic-det-gpio$":
196    maxItems: 1
197
198  "^simple-audio-card,dai-link(@[0-9a-f]+)?$":
199    description: |
200      Container for dai-link level properties and the CPU and CODEC sub-nodes.
201      This container may be omitted when the card has only one DAI link.
202    type: object
203    properties:
204      reg:
205        maxItems: 1
206
207      # common properties
208      frame-master:
209        $ref: "#/definitions/frame-master"
210      bitclock-master:
211        $ref: "#/definitions/bitclock-master"
212      frame-inversion:
213        $ref: "#/definitions/frame-inversion"
214      bitclock-inversion:
215        $ref: "#/definitions/bitclock-inversion"
216      format:
217        $ref: "#/definitions/format"
218      mclk-fs:
219        $ref: "#/definitions/mclk-fs"
220      aux-devs:
221        $ref: "#/definitions/aux-devs"
222      convert-rate:
223        $ref: "#/definitions/convert-rate"
224      convert-channels:
225        $ref: "#/definitions/convert-channels"
226      prefix:
227        $ref: "#/definitions/prefix"
228      pin-switches:
229        $ref: "#/definitions/pin-switches"
230      hp-det-gpio:
231        maxItems: 1
232      mic-det-gpio:
233        maxItems: 1
234
235    patternProperties:
236      "^cpu(@[0-9a-f]+)?":
237        $ref: "#/definitions/dai"
238      "^codec(@[0-9a-f]+)?":
239        $ref: "#/definitions/dai"
240    additionalProperties: false
241
242required:
243  - compatible
244
245additionalProperties: false
246
247examples:
248#--------------------
249# single DAI link
250#--------------------
251  - |
252    sound {
253        compatible = "simple-audio-card";
254        simple-audio-card,name = "VF610-Tower-Sound-Card";
255        simple-audio-card,format = "left_j";
256        simple-audio-card,bitclock-master = <&dailink0_master>;
257        simple-audio-card,frame-master = <&dailink0_master>;
258        simple-audio-card,widgets =
259                "Microphone", "Microphone Jack",
260                "Headphone", "Headphone Jack",
261                "Speaker", "External Speaker";
262        simple-audio-card,routing =
263                "MIC_IN", "Microphone Jack",
264                "Headphone Jack", "HP_OUT",
265                "External Speaker", "LINE_OUT";
266
267        simple-audio-card,cpu {
268            sound-dai = <&sh_fsi2 0>;
269        };
270
271        dailink0_master: simple-audio-card,codec {
272            sound-dai = <&ak4648>;
273            clocks = <&osc>;
274        };
275    };
276
277#--------------------
278# Multi DAI links
279#--------------------
280  - |
281    sound {
282        compatible = "simple-audio-card";
283        simple-audio-card,name = "Cubox Audio";
284
285        #address-cells = <1>;
286        #size-cells = <0>;
287
288        simple-audio-card,dai-link@0 {		/* I2S - HDMI */
289            reg = <0>;
290            format = "i2s";
291            cpu {
292                sound-dai = <&audio0>;
293            };
294            codec {
295                sound-dai = <&tda998x0>;
296            };
297        };
298
299        simple-audio-card,dai-link@1 {		/* S/PDIF - HDMI */
300            reg = <1>;
301            cpu {
302                sound-dai = <&audio1>;
303            };
304            codec {
305                sound-dai = <&tda998x1>;
306            };
307        };
308
309        simple-audio-card,dai-link@2 {		/* S/PDIF - S/PDIF */
310            reg = <2>;
311            cpu {
312                sound-dai = <&audio2>;
313            };
314            codec {
315                sound-dai = <&spdif_codec>;
316            };
317        };
318    };
319
320#--------------------
321# route audio from IMX6 SSI2 through TLV320DAC3100 codec
322# through TPA6130A2 amplifier to headphones:
323#--------------------
324  - |
325    sound {
326        compatible = "simple-audio-card";
327
328        simple-audio-card,widgets =
329            "Headphone", "Headphone Jack";
330        simple-audio-card,routing =
331            "Headphone Jack", "HPLEFT",
332            "Headphone Jack", "HPRIGHT",
333            "LEFTIN", "HPL",
334            "RIGHTIN", "HPR";
335        simple-audio-card,aux-devs = <&amp>;
336        simple-audio-card,cpu {
337            sound-dai = <&ssi2>;
338        };
339        simple-audio-card,codec {
340            sound-dai = <&codec>;
341            clocks = <&clocks>;
342        };
343    };
344
345#--------------------
346# Sampling Rate Conversion
347#--------------------
348  - |
349    sound {
350        compatible = "simple-audio-card";
351
352        simple-audio-card,name = "rsnd-ak4643";
353        simple-audio-card,format = "left_j";
354        simple-audio-card,bitclock-master = <&sndcodec>;
355        simple-audio-card,frame-master = <&sndcodec>;
356
357        simple-audio-card,convert-rate = <48000>;
358
359        simple-audio-card,prefix = "ak4642";
360        simple-audio-card,routing = "ak4642 Playback", "DAI0 Playback",
361                                    "DAI0 Capture", "ak4642 Capture";
362
363        sndcpu: simple-audio-card,cpu {
364            sound-dai = <&rcar_sound>;
365        };
366
367        sndcodec: simple-audio-card,codec {
368            sound-dai = <&ak4643>;
369            system-clock-frequency = <11289600>;
370        };
371    };
372
373#--------------------
374# 2 CPU 1 Codec (Mixing)
375#--------------------
376  - |
377    sound {
378        compatible = "simple-audio-card";
379        #address-cells = <1>;
380        #size-cells = <0>;
381
382        simple-audio-card,name = "rsnd-ak4643";
383        simple-audio-card,format = "left_j";
384        simple-audio-card,bitclock-master = <&dpcmcpu>;
385        simple-audio-card,frame-master = <&dpcmcpu>;
386
387        simple-audio-card,convert-rate = <48000>;
388        simple-audio-card,convert-channels = <2>;
389
390        simple-audio-card,routing = "ak4642 Playback", "DAI0 Playback",
391                                    "ak4642 Playback", "DAI1 Playback";
392
393        dpcmcpu: simple-audio-card,cpu@0 {
394            reg = <0>;
395            sound-dai = <&rcar_sound 0>;
396        };
397
398        simple-audio-card,cpu@1 {
399            reg = <1>;
400            sound-dai = <&rcar_sound 1>;
401        };
402
403        simple-audio-card,codec {
404            prefix = "ak4642";
405            sound-dai = <&ak4643>;
406            clocks = <&audio_clock>;
407        };
408    };
409
410#--------------------
411# Multi DAI links with DPCM:
412#
413# CPU0 ------ ak4613
414# CPU1 ------ PCM3168A-p  /* DPCM 1ch/2ch */
415# CPU2 --/                /* DPCM 3ch/4ch */
416# CPU3 --/                /* DPCM 5ch/6ch */
417# CPU4 --/                /* DPCM 7ch/8ch */
418# CPU5 ------ PCM3168A-c
419#--------------------
420  - |
421    sound {
422        compatible = "simple-audio-card";
423        #address-cells = <1>;
424        #size-cells = <0>;
425
426        simple-audio-card,routing =
427            "pcm3168a Playback", "DAI1 Playback",
428            "pcm3168a Playback", "DAI2 Playback",
429            "pcm3168a Playback", "DAI3 Playback",
430            "pcm3168a Playback", "DAI4 Playback";
431
432        simple-audio-card,dai-link@0 {
433            reg = <0>;
434            format = "left_j";
435            bitclock-master = <&sndcpu0>;
436            frame-master = <&sndcpu0>;
437
438            sndcpu0: cpu {
439                sound-dai = <&rcar_sound 0>;
440            };
441            codec {
442                sound-dai = <&ak4613>;
443            };
444        };
445
446        simple-audio-card,dai-link@1 {
447            reg = <1>;
448            format = "i2s";
449            bitclock-master = <&sndcpu1>;
450            frame-master = <&sndcpu1>;
451
452            convert-channels = <8>; /* TDM Split */
453
454            sndcpu1: cpu0 {
455                sound-dai = <&rcar_sound 1>;
456            };
457            cpu1 {
458                sound-dai = <&rcar_sound 2>;
459            };
460            cpu2 {
461                sound-dai = <&rcar_sound 3>;
462            };
463            cpu3 {
464                sound-dai = <&rcar_sound 4>;
465            };
466            codec {
467                mclk-fs = <512>;
468                prefix = "pcm3168a";
469                dai-tdm-slot-num = <8>;
470                sound-dai = <&pcm3168a 0>;
471            };
472        };
473
474        simple-audio-card,dai-link@2 {
475            reg = <2>;
476            format = "i2s";
477            bitclock-master = <&sndcpu2>;
478            frame-master = <&sndcpu2>;
479
480            sndcpu2: cpu {
481                sound-dai = <&rcar_sound 5>;
482            };
483            codec {
484                mclk-fs = <512>;
485                prefix = "pcm3168a";
486                sound-dai = <&pcm3168a 1>;
487            };
488        };
489    };
490