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