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