Merge tag 'block-6.13-20242901' of git://git.kernel.dk/linux
[drm/drm-misc.git] / Documentation / devicetree / bindings / sound / simple-card.yaml
blob533d0a1da56e34eb0cf4c3ed8d04d3f02b2b30ae
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#
7 title: Simple Audio Card Driver
9 maintainers:
10   - Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
12 definitions:
14   frame-master:
15     description: Indicates dai-link frame master.
16     $ref: /schemas/types.yaml#/definitions/phandle
18   bitclock-master:
19     description: Indicates dai-link bit clock master
20     $ref: /schemas/types.yaml#/definitions/phandle
22   frame-inversion:
23     description: dai-link uses frame clock inversion
24     $ref: /schemas/types.yaml#/definitions/flag
26   bitclock-inversion:
27     description: dai-link uses bit clock inversion
28     $ref: /schemas/types.yaml#/definitions/flag
30   dai-tdm-slot-num:
31     description: see tdm-slot.txt.
32     $ref: /schemas/types.yaml#/definitions/uint32
34   dai-tdm-slot-width:
35     description: see tdm-slot.txt.
36     $ref: /schemas/types.yaml#/definitions/uint32
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
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
51   system-clock-fixed:
52     description: |
53       Specifies that the clock frequency should not be modified.
54       Implied when system-clock-frequency is specified, but can be used when
55       a clock is mapped to the device whose frequency cannot or should not be
56       changed. When mclk-fs is also specified, this restricts the device to a
57       single fixed sampling rate.
58     $ref: /schemas/types.yaml#/definitions/flag
60   mclk-fs:
61     description: |
62       Multiplication factor between stream rate and codec mclk.
63       When defined, mclk-fs property defined in dai-link sub nodes are ignored.
64     $ref: /schemas/types.yaml#/definitions/uint32
66   aux-devs:
67     description: |
68       List of phandles pointing to auxiliary devices, such
69       as amplifiers, to be added to the sound card.
70     $ref: /schemas/types.yaml#/definitions/phandle-array
72   convert-rate:
73     description: CPU to Codec rate convert.
74     $ref: /schemas/types.yaml#/definitions/uint32
76   convert-channels:
77     description: CPU to Codec rate channels.
78     $ref: /schemas/types.yaml#/definitions/uint32
80   prefix:
81     description: device name prefix
82     $ref: /schemas/types.yaml#/definitions/string
84   label:
85     maxItems: 1
87   routing:
88     description: |
89       A list of the connections between audio components.
90       Each entry is a pair of strings, the first being the
91       connection's sink, the second being the connection's source.
92     $ref: /schemas/types.yaml#/definitions/non-unique-string-array
94   widgets:
95     description: User specified audio sound widgets.
96     $ref: /schemas/types.yaml#/definitions/non-unique-string-array
98   pin-switches:
99     description: the widget names for which pin switches must be created.
100     $ref: /schemas/types.yaml#/definitions/string-array
102   format:
103     description: audio format.
104     items:
105       enum:
106         - i2s
107         - right_j
108         - left_j
109         - dsp_a
110         - dsp_b
111         - ac97
112         - pdm
113         - msb
114         - lsb
116   dai:
117     type: object
118     properties:
119       sound-dai:
120         maxItems: 1
122       # common properties
123       mclk-fs:
124         $ref: "#/definitions/mclk-fs"
125       prefix:
126         $ref: "#/definitions/prefix"
127       frame-inversion:
128         $ref: "#/definitions/frame-inversion"
129       bitclock-inversion:
130         $ref: "#/definitions/bitclock-inversion"
131       frame-master:
132         $ref: /schemas/types.yaml#/definitions/flag
133       bitclock-master:
134         $ref: /schemas/types.yaml#/definitions/flag
136       dai-tdm-slot-num:
137         $ref: "#/definitions/dai-tdm-slot-num"
138       dai-tdm-slot-width:
139         $ref: "#/definitions/dai-tdm-slot-width"
140       clocks:
141         maxItems: 1
142       system-clock-frequency:
143         $ref: "#/definitions/system-clock-frequency"
144       system-clock-direction-out:
145         $ref: "#/definitions/system-clock-direction-out"
146       system-clock-fixed:
147         $ref: "#/definitions/system-clock-fixed"
148     required:
149       - sound-dai
151   additional-devs:
152     type: object
153     description:
154       Additional devices used by the simple audio card.
155     patternProperties:
156       '^iio-aux(-.+)?$':
157         type: object
158         $ref: audio-iio-aux.yaml#
160 properties:
161   compatible:
162     contains:
163       enum:
164         - simple-audio-card
165         - simple-scu-audio-card
167   "#address-cells":
168     const: 1
169   "#size-cells":
170     const: 0
172   label:
173     $ref: "#/definitions/label"
175   simple-audio-card,name:
176     description: User specified audio sound card name.
177     $ref: /schemas/types.yaml#/definitions/string
179   simple-audio-card,widgets:
180     $ref: "#/definitions/widgets"
181   simple-audio-card,routing:
182     $ref: "#/definitions/routing"
184   # common properties
185   simple-audio-card,frame-master:
186     $ref: "#/definitions/frame-master"
187   simple-audio-card,bitclock-master:
188     $ref: "#/definitions/bitclock-master"
189   simple-audio-card,frame-inversion:
190     $ref: "#/definitions/frame-inversion"
191   simple-audio-card,bitclock-inversion:
192     $ref: "#/definitions/bitclock-inversion"
193   simple-audio-card,format:
194     $ref: "#/definitions/format"
195   simple-audio-card,mclk-fs:
196     $ref: "#/definitions/mclk-fs"
197   simple-audio-card,aux-devs:
198     $ref: "#/definitions/aux-devs"
199   simple-audio-card,additional-devs:
200     $ref: "#/definitions/additional-devs"
201   simple-audio-card,convert-rate:
202     $ref: "#/definitions/convert-rate"
203   simple-audio-card,convert-channels:
204     $ref: "#/definitions/convert-channels"
205   simple-audio-card,prefix:
206     $ref: "#/definitions/prefix"
207   simple-audio-card,pin-switches:
208     $ref: "#/definitions/pin-switches"
209   simple-audio-card,hp-det-gpio:
210     deprecated: true
211     maxItems: 1
212   simple-audio-card,hp-det-gpios:
213     maxItems: 1
214   simple-audio-card,mic-det-gpio:
215     deprecated: true
216     maxItems: 1
217   simple-audio-card,mic-det-gpios:
218     maxItems: 1
220 patternProperties:
221   "^simple-audio-card,cpu(@[0-9a-f]+)?$":
222     $ref: "#/definitions/dai"
223   "^simple-audio-card,codec(@[0-9a-f]+)?$":
224     $ref: "#/definitions/dai"
225   "^simple-audio-card,plat(@[0-9a-f]+)?$":
226     $ref: "#/definitions/dai"
228   "^simple-audio-card,dai-link(@[0-9a-f]+)?$":
229     description: |
230       Container for dai-link level properties and the CPU and CODEC sub-nodes.
231       This container may be omitted when the card has only one DAI link.
232     type: object
233     properties:
234       reg:
235         maxItems: 1
237       "#address-cells":
238         const: 1
239       "#size-cells":
240         const: 0
241       # common properties
242       frame-master:
243         $ref: "#/definitions/frame-master"
244       bitclock-master:
245         $ref: "#/definitions/bitclock-master"
246       frame-inversion:
247         $ref: "#/definitions/frame-inversion"
248       bitclock-inversion:
249         $ref: "#/definitions/bitclock-inversion"
250       format:
251         $ref: "#/definitions/format"
252       mclk-fs:
253         $ref: "#/definitions/mclk-fs"
254       aux-devs:
255         $ref: "#/definitions/aux-devs"
256       convert-rate:
257         $ref: "#/definitions/convert-rate"
258       convert-channels:
259         $ref: "#/definitions/convert-channels"
260       prefix:
261         $ref: "#/definitions/prefix"
262       pin-switches:
263         $ref: "#/definitions/pin-switches"
264       hp-det-gpio:
265         deprecated: true
266         maxItems: 1
267       hp-det-gpios:
268         maxItems: 1
269       mic-det-gpio:
270         deprecated: true
271         maxItems: 1
272       mic-det-gpios:
273         maxItems: 1
275     patternProperties:
276       "^cpu(-[0-9]+)?$":
277         $ref: "#/definitions/dai"
278       "^codec(-[0-9]+)?$":
279         $ref: "#/definitions/dai"
280     additionalProperties: false
282 required:
283   - compatible
285 additionalProperties: false
287 examples:
288 # --------------------
289 # single DAI link
290 # --------------------
291   - |
292     sound {
293         compatible = "simple-audio-card";
294         simple-audio-card,name = "VF610-Tower-Sound-Card";
295         simple-audio-card,format = "left_j";
296         simple-audio-card,bitclock-master = <&dailink0_master>;
297         simple-audio-card,frame-master = <&dailink0_master>;
298         simple-audio-card,widgets =
299                 "Microphone", "Microphone Jack",
300                 "Headphone", "Headphone Jack",
301                 "Speaker", "External Speaker";
302         simple-audio-card,routing =
303                 "MIC_IN", "Microphone Jack",
304                 "Headphone Jack", "HP_OUT",
305                 "External Speaker", "LINE_OUT";
307         simple-audio-card,cpu {
308             sound-dai = <&sh_fsi2 0>;
309         };
311         dailink0_master: simple-audio-card,codec {
312             sound-dai = <&ak4648>;
313             clocks = <&osc>;
314         };
315     };
317 # --------------------
318 # Multi DAI links
319 # --------------------
320   - |
321     sound {
322         compatible = "simple-audio-card";
323         simple-audio-card,name = "Cubox Audio";
325         #address-cells = <1>;
326         #size-cells = <0>;
328         simple-audio-card,dai-link@0 {          /* I2S - HDMI */
329             reg = <0>;
330             format = "i2s";
331             cpu {
332                 sound-dai = <&audio0>;
333             };
334             codec {
335                 sound-dai = <&tda998x0>;
336             };
337         };
339         simple-audio-card,dai-link@1 {          /* S/PDIF - HDMI */
340             reg = <1>;
341             cpu {
342                 sound-dai = <&audio1>;
343             };
344             codec {
345                 sound-dai = <&tda998x1>;
346             };
347         };
349         simple-audio-card,dai-link@2 {          /* S/PDIF - S/PDIF */
350             reg = <2>;
351             cpu {
352                 sound-dai = <&audio2>;
353             };
354             codec {
355                 sound-dai = <&spdif_codec>;
356             };
357         };
358     };
360 # --------------------
361 # route audio from IMX6 SSI2 through TLV320DAC3100 codec
362 # through TPA6130A2 amplifier to headphones:
363 # --------------------
364   - |
365     sound {
366         compatible = "simple-audio-card";
368         simple-audio-card,widgets =
369             "Headphone", "Headphone Jack";
370         simple-audio-card,routing =
371             "Headphone Jack", "HPLEFT",
372             "Headphone Jack", "HPRIGHT",
373             "LEFTIN", "HPL",
374             "RIGHTIN", "HPR";
375         simple-audio-card,aux-devs = <&amp>;
376         simple-audio-card,cpu {
377             sound-dai = <&ssi2>;
378         };
379         simple-audio-card,codec {
380             sound-dai = <&codec>;
381             clocks = <&clocks>;
382         };
383     };
385 # --------------------
386 # route audio to/from a codec through an amplifier
387 # designed with a potentiometer driven by IIO:
388 # --------------------
389   - |
390     sound {
391         compatible = "simple-audio-card";
393         simple-audio-card,aux-devs = <&amp_in>, <&amp_out>;
394         simple-audio-card,routing =
395             "CODEC LEFTIN", "AMP_IN LEFT OUT",
396             "CODEC RIGHTIN", "AMP_IN RIGHT OUT",
397             "AMP_OUT LEFT IN", "CODEC LEFTOUT",
398             "AMP_OUT RIGHT IN", "CODEC RIGHTOUT";
400         simple-audio-card,additional-devs {
401             amp_out: iio-aux-out {
402                 compatible = "audio-iio-aux";
403                 io-channels = <&pot_out 0>, <&pot_out 1>;
404                 io-channel-names = "LEFT", "RIGHT";
405                 snd-control-invert-range = <1 1>;
406                 sound-name-prefix = "AMP_OUT";
407             };
409             amp_in: iio_aux-in {
410                 compatible = "audio-iio-aux";
411                 io-channels = <&pot_in 0>, <&pot_in 1>;
412                 io-channel-names = "LEFT", "RIGHT";
413                 sound-name-prefix = "AMP_IN";
414             };
415         };
417         simple-audio-card,cpu {
418             sound-dai = <&cpu>;
419         };
421         simple-audio-card,codec {
422             sound-dai = <&codec>;
423             clocks = <&clocks>;
424         };
425     };
427 # --------------------
428 # Sampling Rate Conversion
429 # --------------------
430   - |
431     sound {
432         compatible = "simple-audio-card";
434         simple-audio-card,name = "rsnd-ak4643";
435         simple-audio-card,format = "left_j";
436         simple-audio-card,bitclock-master = <&sndcodec>;
437         simple-audio-card,frame-master = <&sndcodec>;
439         simple-audio-card,convert-rate = <48000>;
441         simple-audio-card,prefix = "ak4642";
442         simple-audio-card,routing = "ak4642 Playback", "DAI0 Playback",
443                                     "DAI0 Capture", "ak4642 Capture";
445         sndcpu: simple-audio-card,cpu {
446             sound-dai = <&rcar_sound>;
447         };
449         sndcodec: simple-audio-card,codec {
450             sound-dai = <&ak4643>;
451             system-clock-frequency = <11289600>;
452         };
453     };
455 # --------------------
456 # 2 CPU 1 Codec (Mixing)
457 # --------------------
458   - |
459     sound {
460         compatible = "simple-audio-card";
461         #address-cells = <1>;
462         #size-cells = <0>;
464         simple-audio-card,name = "rsnd-ak4643";
465         simple-audio-card,format = "left_j";
466         simple-audio-card,bitclock-master = <&dpcmcpu>;
467         simple-audio-card,frame-master = <&dpcmcpu>;
469         simple-audio-card,convert-rate = <48000>;
470         simple-audio-card,convert-channels = <2>;
472         simple-audio-card,routing = "ak4642 Playback", "DAI0 Playback",
473                                     "ak4642 Playback", "DAI1 Playback";
475         dpcmcpu: simple-audio-card,cpu@0 {
476             reg = <0>;
477             sound-dai = <&rcar_sound 0>;
478         };
480         simple-audio-card,cpu@1 {
481             reg = <1>;
482             sound-dai = <&rcar_sound 1>;
483         };
485         simple-audio-card,codec {
486             prefix = "ak4642";
487             sound-dai = <&ak4643>;
488             clocks = <&audio_clock>;
489         };
490     };
492 # --------------------
493 # Multi DAI links with DPCM:
495 # CPU0 ------ ak4613
496 # CPU1 ------ PCM3168A-p  /* DPCM 1ch/2ch */
497 # CPU2 --/                /* DPCM 3ch/4ch */
498 # CPU3 --/                /* DPCM 5ch/6ch */
499 # CPU4 --/                /* DPCM 7ch/8ch */
500 # CPU5 ------ PCM3168A-c
501 # --------------------
502   - |
503     sound {
504         compatible = "simple-audio-card";
505         #address-cells = <1>;
506         #size-cells = <0>;
508         simple-audio-card,routing =
509             "pcm3168a Playback", "DAI1 Playback",
510             "pcm3168a Playback", "DAI2 Playback",
511             "pcm3168a Playback", "DAI3 Playback",
512             "pcm3168a Playback", "DAI4 Playback";
514         simple-audio-card,dai-link@0 {
515             reg = <0>;
516             format = "left_j";
517             bitclock-master = <&sndcpu0>;
518             frame-master = <&sndcpu0>;
520             sndcpu0: cpu {
521                 sound-dai = <&rcar_sound 0>;
522             };
523             codec {
524                 sound-dai = <&ak4613>;
525             };
526         };
528         simple-audio-card,dai-link@1 {
529             reg = <1>;
530             format = "i2s";
531             bitclock-master = <&sndcpu1>;
532             frame-master = <&sndcpu1>;
534             convert-channels = <8>; /* TDM Split */
536             sndcpu1: cpu-0 {
537                 sound-dai = <&rcar_sound 1>;
538             };
539             cpu-1 {
540                 sound-dai = <&rcar_sound 2>;
541             };
542             cpu-2 {
543                 sound-dai = <&rcar_sound 3>;
544             };
545             cpu-3 {
546                 sound-dai = <&rcar_sound 4>;
547             };
548             codec {
549                 mclk-fs = <512>;
550                 prefix = "pcm3168a";
551                 dai-tdm-slot-num = <8>;
552                 sound-dai = <&pcm3168a 0>;
553             };
554         };
556         simple-audio-card,dai-link@2 {
557             reg = <2>;
558             format = "i2s";
559             bitclock-master = <&sndcpu2>;
560             frame-master = <&sndcpu2>;
562             sndcpu2: cpu {
563                 sound-dai = <&rcar_sound 5>;
564             };
565             codec {
566                 mclk-fs = <512>;
567                 prefix = "pcm3168a";
568                 sound-dai = <&pcm3168a 1>;
569             };
570         };
571     };