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