Merge remote-tracking branches 'asoc/topic/fsl-spdif', 'asoc/topic/hdmi', 'asoc/topic...
[linux-2.6-block.git] / Documentation / sound / alsa / soc / machine.txt
CommitLineData
eb1a6af3
LG
1ASoC Machine Driver
2===================
3
b5c47df9
LG
4The ASoC machine (or board) driver is the code that glues together all the
5component drivers (e.g. codecs, platforms and DAIs). It also describes the
add3873e 6relationships between each component which include audio paths, GPIOs,
b5c47df9 7interrupts, clocking, jacks and voltage regulators.
eb1a6af3
LG
8
9The machine driver can contain codec and platform specific code. It registers
10the audio subsystem with the kernel as a platform device and is represented by
11the following struct:-
12
13/* SoC machine */
4f904735 14struct snd_soc_card {
eb1a6af3
LG
15 char *name;
16
379c4bf1
SY
17 ...
18
eb1a6af3
LG
19 int (*probe)(struct platform_device *pdev);
20 int (*remove)(struct platform_device *pdev);
21
22 /* the pre and post PM functions are used to do any PM work before and
7c4dbbd8 23 * after the codec and DAIs do any PM work. */
eb1a6af3
LG
24 int (*suspend_pre)(struct platform_device *pdev, pm_message_t state);
25 int (*suspend_post)(struct platform_device *pdev, pm_message_t state);
26 int (*resume_pre)(struct platform_device *pdev);
27 int (*resume_post)(struct platform_device *pdev);
28
379c4bf1 29 ...
eb1a6af3
LG
30
31 /* CPU <--> Codec DAI links */
32 struct snd_soc_dai_link *dai_link;
33 int num_links;
379c4bf1
SY
34
35 ...
eb1a6af3
LG
36};
37
38probe()/remove()
39----------------
40probe/remove are optional. Do any machine specific probe here.
41
42
43suspend()/resume()
44------------------
45The machine driver has pre and post versions of suspend and resume to take care
7c4dbbd8 46of any machine audio tasks that have to be done before or after the codec, DAIs
eb1a6af3
LG
47and DMA is suspended and resumed. Optional.
48
49
eb1a6af3
LG
50Machine DAI Configuration
51-------------------------
7c4dbbd8 52The machine DAI configuration glues all the codec and CPU DAIs together. It can
eb1a6af3
LG
53also be used to set up the DAI system clock and for any machine related DAI
54initialisation e.g. the machine audio map can be connected to the codec audio
145294c3 55map, unconnected codec pins can be set as such.
eb1a6af3
LG
56
57struct snd_soc_dai_link is used to set up each DAI in your machine. e.g.
58
59/* corgi digital audio interface glue - connects codec <--> CPU */
60static struct snd_soc_dai_link corgi_dai = {
61 .name = "WM8731",
62 .stream_name = "WM8731",
379c4bf1
SY
63 .cpu_dai_name = "pxa-is2-dai",
64 .codec_dai_name = "wm8731-hifi",
65 .platform_name = "pxa-pcm-audio",
66 .codec_name = "wm8713-codec.0-001a",
eb1a6af3 67 .init = corgi_wm8731_init,
10b98527 68 .ops = &corgi_ops,
eb1a6af3
LG
69};
70
a33f3224 71struct snd_soc_card then sets up the machine with its DAIs. e.g.
eb1a6af3
LG
72
73/* corgi audio machine driver */
87506549 74static struct snd_soc_card snd_soc_corgi = {
eb1a6af3
LG
75 .name = "Corgi",
76 .dai_link = &corgi_dai,
77 .num_links = 1,
eb1a6af3
LG
78};
79
80
eb1a6af3
LG
81Machine Power Map
82-----------------
83
84The machine driver can optionally extend the codec power map and to become an
85audio power map of the audio subsystem. This allows for automatic power up/down
86of speaker/HP amplifiers, etc. Codec pins can be connected to the machines jack
145294c3 87sockets in the machine init function.
eb1a6af3
LG
88
89
90Machine Controls
91----------------
92
7c4dbbd8 93Machine specific audio mixer controls can be added in the DAI init function.