Merge tag 'fs_for_v5.2-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / Documentation / devicetree / bindings / sound / simple-card.txt
1 Simple-Card:
2
3 Simple-Card specifies audio DAI connections of SoC <-> codec.
4
5 Required properties:
6
7 - compatible                            : "simple-audio-card"
8
9 Optional properties:
10
11 - simple-audio-card,name                : User specified audio sound card name, one string
12                                           property.
13 - simple-audio-card,widgets             : Please refer to widgets.txt.
14 - simple-audio-card,routing             : A list of the connections between audio components.
15                                           Each entry is a pair of strings, the first being the
16                                           connection's sink, the second being the connection's
17                                           source.
18 - simple-audio-card,mclk-fs             : Multiplication factor between stream rate and codec
19                                           mclk. When defined, mclk-fs property defined in
20                                           dai-link sub nodes are ignored.
21 - simple-audio-card,hp-det-gpio         : Reference to GPIO that signals when
22                                           headphones are attached.
23 - simple-audio-card,mic-det-gpio        : Reference to GPIO that signals when
24                                           a microphone is attached.
25 - simple-audio-card,aux-devs            : List of phandles pointing to auxiliary devices, such
26                                           as amplifiers, to be added to the sound card.
27 - simple-audio-card,pin-switches        : List of strings containing the widget names for
28                                           which pin switches must be created.
29
30 Optional subnodes:
31
32 - simple-audio-card,dai-link            : Container for dai-link level
33                                           properties and the CPU and CODEC
34                                           sub-nodes. This container may be
35                                           omitted when the card has only one
36                                           DAI link. See the examples and the
37                                           section below.
38
39 Dai-link subnode properties and subnodes:
40
41 If dai-link subnode is omitted and the subnode properties are directly
42 under "sound"-node the subnode property and subnode names have to be
43 prefixed with "simple-audio-card,"-prefix.
44
45 Required dai-link subnodes:
46
47 - cpu                                   : CPU   sub-node
48 - codec                                 : CODEC sub-node
49
50 Optional dai-link subnode properties:
51
52 - format                                : CPU/CODEC common audio format.
53                                           "i2s", "right_j", "left_j" , "dsp_a"
54                                           "dsp_b", "ac97", "pdm", "msb", "lsb"
55 - frame-master                          : Indicates dai-link frame master.
56                                           phandle to a cpu or codec subnode.
57 - bitclock-master                       : Indicates dai-link bit clock master.
58                                           phandle to a cpu or codec subnode.
59 - bitclock-inversion                    : bool property. Add this if the
60                                           dai-link uses bit clock inversion.
61 - frame-inversion                       : bool property. Add this if the
62                                           dai-link uses frame clock inversion.
63 - mclk-fs                               : Multiplication factor between stream
64                                           rate and codec mclk, applied only for
65                                           the dai-link.
66
67 For backward compatibility the frame-master and bitclock-master
68 properties can be used as booleans in codec subnode to indicate if the
69 codec is the dai-link frame or bit clock master. In this case there
70 should be no dai-link node, the same properties should not be present
71 at sound-node level, and the bitclock-inversion and frame-inversion
72 properties should also be placed in the codec node if needed.
73
74 Required CPU/CODEC subnodes properties:
75
76 - sound-dai                             : phandle and port of CPU/CODEC
77
78 Optional CPU/CODEC subnodes properties:
79
80 - dai-tdm-slot-num                      : Please refer to tdm-slot.txt.
81 - dai-tdm-slot-width                    : Please refer to tdm-slot.txt.
82 - clocks / system-clock-frequency       : specify subnode's clock if needed.
83                                           it can be specified via "clocks" if system has
84                                           clock node (= common clock), or "system-clock-frequency"
85                                           (if system doens't support common clock)
86                                           If a clock is specified, it is
87                                           enabled with clk_prepare_enable()
88                                           in dai startup() and disabled with
89                                           clk_disable_unprepare() in dai
90                                           shutdown().
91                                           If a clock is specified and a
92                                           multiplication factor is given with
93                                           mclk-fs, the clock will be set to the
94                                           calculated mclk frequency when the
95                                           stream starts.
96 - system-clock-direction-out            : specifies clock direction as 'out' on
97                                           initialization. It is useful for some aCPUs with
98                                           fixed clocks.
99
100 -------------------------------------------
101 Example 1 - single DAI link:
102 -------------------------------------------
103
104 sound {
105         compatible = "simple-audio-card";
106         simple-audio-card,name = "VF610-Tower-Sound-Card";
107         simple-audio-card,format = "left_j";
108         simple-audio-card,bitclock-master = <&dailink0_master>;
109         simple-audio-card,frame-master = <&dailink0_master>;
110         simple-audio-card,widgets =
111                 "Microphone", "Microphone Jack",
112                 "Headphone", "Headphone Jack",
113                 "Speaker", "External Speaker";
114         simple-audio-card,routing =
115                 "MIC_IN", "Microphone Jack",
116                 "Headphone Jack", "HP_OUT",
117                 "External Speaker", "LINE_OUT";
118
119         simple-audio-card,cpu {
120                 sound-dai = <&sh_fsi2 0>;
121         };
122
123         dailink0_master: simple-audio-card,codec {
124                 sound-dai = <&ak4648>;
125                 clocks = <&osc>;
126         };
127 };
128
129 &i2c0 {
130         ak4648: ak4648@12 {
131                 #sound-dai-cells = <0>;
132                 compatible = "asahi-kasei,ak4648";
133                 reg = <0x12>;
134         };
135 };
136
137 sh_fsi2: sh_fsi2@ec230000 {
138         #sound-dai-cells = <1>;
139         compatible = "renesas,sh_fsi2";
140         reg = <0xec230000 0x400>;
141         interrupt-parent = <&gic>;
142         interrupts = <0 146 0x4>;
143 };
144
145 -------------------------------------------
146 Example 2 - many DAI links:
147 -------------------------------------------
148
149 sound {
150         compatible = "simple-audio-card";
151         simple-audio-card,name = "Cubox Audio";
152
153         simple-audio-card,dai-link@0 {          /* I2S - HDMI */
154                 reg = <0>;
155                 format = "i2s";
156                 cpu {
157                         sound-dai = <&audio1 0>;
158                 };
159                 codec {
160                         sound-dai = <&tda998x 0>;
161                 };
162         };
163
164         simple-audio-card,dai-link@1 {          /* S/PDIF - HDMI */
165                 reg = <1>;
166                 cpu {
167                         sound-dai = <&audio1 1>;
168                 };
169                 codec {
170                         sound-dai = <&tda998x 1>;
171                 };
172         };
173
174         simple-audio-card,dai-link@2 {          /* S/PDIF - S/PDIF */
175                 reg = <2>;
176                 cpu {
177                         sound-dai = <&audio1 1>;
178                 };
179                 codec {
180                         sound-dai = <&spdif_codec>;
181                 };
182         };
183 };
184
185 -------------------------------------------
186 Example 3 - route audio from IMX6 SSI2 through TLV320DAC3100 codec
187 through TPA6130A2 amplifier to headphones:
188 -------------------------------------------
189
190 &i2c0 {
191         codec: tlv320dac3100@18 {
192                 compatible = "ti,tlv320dac3100";
193                 ...
194         }
195
196         amp: tpa6130a2@60 {
197                 compatible = "ti,tpa6130a2";
198                 ...
199         }
200 }
201
202 sound {
203         compatible = "simple-audio-card";
204         ...
205         simple-audio-card,widgets =
206                 "Headphone", "Headphone Jack";
207         simple-audio-card,routing =
208                 "Headphone Jack", "HPLEFT",
209                 "Headphone Jack", "HPRIGHT",
210                 "LEFTIN", "HPL",
211                 "RIGHTIN", "HPR";
212         simple-audio-card,aux-devs = <&amp>;
213         simple-audio-card,cpu {
214                 sound-dai = <&ssi2>;
215         };
216         simple-audio-card,codec {
217                 sound-dai = <&codec>;
218                 clocks = ...
219         };
220 };
221
222 -------------------------------------------
223 Example 4. Sampling Rate Conversion
224 -------------------------------------------
225
226 sound {
227         compatible = "simple-audio-card";
228
229         simple-audio-card,name = "rsnd-ak4643";
230         simple-audio-card,format = "left_j";
231         simple-audio-card,bitclock-master = <&sndcodec>;
232         simple-audio-card,frame-master = <&sndcodec>;
233
234         simple-audio-card,convert-rate = <48000>;
235
236         simple-audio-card,prefix = "ak4642";
237         simple-audio-card,routing = "ak4642 Playback", "DAI0 Playback",
238                         "DAI0 Capture", "ak4642 Capture";
239
240         sndcpu: simple-audio-card,cpu {
241                 sound-dai = <&rcar_sound>;
242         };
243
244         sndcodec: simple-audio-card,codec {
245                 sound-dai = <&ak4643>;
246                 system-clock-frequency = <11289600>;
247         };
248 };
249
250 -------------------------------------------
251 Example 5. 2 CPU 1 Codec (Mixing)
252 -------------------------------------------
253 sound {
254         compatible = "simple-audio-card";
255
256         simple-audio-card,name = "rsnd-ak4643";
257         simple-audio-card,format = "left_j";
258         simple-audio-card,bitclock-master = <&dpcmcpu>;
259         simple-audio-card,frame-master = <&dpcmcpu>;
260
261         simple-audio-card,routing = "ak4642 Playback", "DAI0 Playback",
262                         "ak4642 Playback", "DAI1 Playback";
263
264         dpcmcpu: cpu@0 {
265                 sound-dai = <&rcar_sound 0>;
266         };
267
268         cpu@1 {
269                 sound-dai = <&rcar_sound 1>;
270         };
271
272         codec {
273                 prefix = "ak4642";
274                 sound-dai = <&ak4643>;
275                 clocks = <&audio_clock>;
276         };
277 };
278
279 -------------------------------------------
280 Example 6 - many DAI links with DPCM:
281 -------------------------------------------
282
283 CPU0 ------ ak4613
284 CPU1 ------ PCM3168A-p  /* DPCM 1ch/2ch */
285 CPU2 --/                /* DPCM 3ch/4ch */
286 CPU3 --/                /* DPCM 5ch/6ch */
287 CPU4 --/                /* DPCM 7ch/8ch */
288 CPU5 ------ PCM3168A-c
289
290 sound {
291         compatible = "simple-audio-card";
292
293         simple-audio-card,routing =
294                   "pcm3168a Playback", "DAI1 Playback",
295                   "pcm3168a Playback", "DAI2 Playback",
296                   "pcm3168a Playback", "DAI3 Playback",
297                   "pcm3168a Playback", "DAI4 Playback";
298
299         simple-audio-card,dai-link@0 {
300                 format = "left_j";
301                 bitclock-master = <&sndcpu0>;
302                 frame-master = <&sndcpu0>;
303
304                 sndcpu0: cpu {
305                         sound-dai = <&rcar_sound 0>;
306                 };
307                 codec {
308                         sound-dai = <&ak4613>;
309                 };
310         };
311         simple-audio-card,dai-link@1 {
312                 format = "i2s";
313                 bitclock-master = <&sndcpu1>;
314                 frame-master = <&sndcpu1>;
315
316                 convert-channels = <8>; /* TDM Split */
317
318                 sndcpu1: cpu@0 {
319                         sound-dai = <&rcar_sound 1>;
320                 };
321                 cpu@1 {
322                         sound-dai = <&rcar_sound 2>;
323                 };
324                 cpu@2 {
325                         sound-dai = <&rcar_sound 3>;
326                 };
327                 cpu@3 {
328                         sound-dai = <&rcar_sound 4>;
329                 };
330                 codec {
331                         mclk-fs = <512>;
332                         prefix = "pcm3168a";
333                         dai-tdm-slot-num = <8>;
334                         sound-dai = <&pcm3168a 0>;
335                 };
336         };
337         simple-audio-card,dai-link@2 {
338                 format = "i2s";
339                 bitclock-master = <&sndcpu2>;
340                 frame-master = <&sndcpu2>;
341
342                 sndcpu2: cpu {
343                         sound-dai = <&rcar_sound 5>;
344                 };
345                 codec {
346                         mclk-fs = <512>;
347                         prefix = "pcm3168a";
348                         sound-dai = <&pcm3168a 1>;
349                 };
350         };
351 };