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