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