Merge branch 'drm-tda9950-fixes' of git://git.armlinux.org.uk/~rmk/linux-arm into...
[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 Example 1 - single DAI link:
99
100 sound {
101         compatible = "simple-audio-card";
102         simple-audio-card,name = "VF610-Tower-Sound-Card";
103         simple-audio-card,format = "left_j";
104         simple-audio-card,bitclock-master = <&dailink0_master>;
105         simple-audio-card,frame-master = <&dailink0_master>;
106         simple-audio-card,widgets =
107                 "Microphone", "Microphone Jack",
108                 "Headphone", "Headphone Jack",
109                 "Speaker", "External Speaker";
110         simple-audio-card,routing =
111                 "MIC_IN", "Microphone Jack",
112                 "Headphone Jack", "HP_OUT",
113                 "External Speaker", "LINE_OUT";
114
115         simple-audio-card,cpu {
116                 sound-dai = <&sh_fsi2 0>;
117         };
118
119         dailink0_master: simple-audio-card,codec {
120                 sound-dai = <&ak4648>;
121                 clocks = <&osc>;
122         };
123 };
124
125 &i2c0 {
126         ak4648: ak4648@12 {
127                 #sound-dai-cells = <0>;
128                 compatible = "asahi-kasei,ak4648";
129                 reg = <0x12>;
130         };
131 };
132
133 sh_fsi2: sh_fsi2@ec230000 {
134         #sound-dai-cells = <1>;
135         compatible = "renesas,sh_fsi2";
136         reg = <0xec230000 0x400>;
137         interrupt-parent = <&gic>;
138         interrupts = <0 146 0x4>;
139 };
140
141 Example 2 - many DAI links:
142
143 sound {
144         compatible = "simple-audio-card";
145         simple-audio-card,name = "Cubox Audio";
146
147         simple-audio-card,dai-link@0 {          /* I2S - HDMI */
148                 reg = <0>;
149                 format = "i2s";
150                 cpu {
151                         sound-dai = <&audio1 0>;
152                 };
153                 codec {
154                         sound-dai = <&tda998x 0>;
155                 };
156         };
157
158         simple-audio-card,dai-link@1 {          /* S/PDIF - HDMI */
159                 reg = <1>;
160                 cpu {
161                         sound-dai = <&audio1 1>;
162                 };
163                 codec {
164                         sound-dai = <&tda998x 1>;
165                 };
166         };
167
168         simple-audio-card,dai-link@2 {          /* S/PDIF - S/PDIF */
169                 reg = <2>;
170                 cpu {
171                         sound-dai = <&audio1 1>;
172                 };
173                 codec {
174                         sound-dai = <&spdif_codec>;
175                 };
176         };
177 };
178
179 Example 3 - route audio from IMX6 SSI2 through TLV320DAC3100 codec
180 through TPA6130A2 amplifier to headphones:
181
182 &i2c0 {
183         codec: tlv320dac3100@18 {
184                 compatible = "ti,tlv320dac3100";
185                 ...
186         }
187
188         amp: tpa6130a2@60 {
189                 compatible = "ti,tpa6130a2";
190                 ...
191         }
192 }
193
194 sound {
195         compatible = "simple-audio-card";
196         ...
197         simple-audio-card,widgets =
198                 "Headphone", "Headphone Jack";
199         simple-audio-card,routing =
200                 "Headphone Jack", "HPLEFT",
201                 "Headphone Jack", "HPRIGHT",
202                 "LEFTIN", "HPL",
203                 "RIGHTIN", "HPR";
204         simple-audio-card,aux-devs = <&amp>;
205         simple-audio-card,cpu {
206                 sound-dai = <&ssi2>;
207         };
208         simple-audio-card,codec {
209                 sound-dai = <&codec>;
210                 clocks = ...
211         };
212 };