4 The ASoC machine (or board) driver is the code that glues together the platform
7 The machine driver can contain codec and platform specific code. It registers
8 the audio subsystem with the kernel as a platform device and is represented by
15 int (*probe)(struct platform_device *pdev);
16 int (*remove)(struct platform_device *pdev);
18 /* the pre and post PM functions are used to do any PM work before and
19 * after the codec and DAIs do any PM work. */
20 int (*suspend_pre)(struct platform_device *pdev, pm_message_t state);
21 int (*suspend_post)(struct platform_device *pdev, pm_message_t state);
22 int (*resume_pre)(struct platform_device *pdev);
23 int (*resume_post)(struct platform_device *pdev);
25 /* machine stream operations */
26 struct snd_soc_ops *ops;
28 /* CPU <--> Codec DAI links */
29 struct snd_soc_dai_link *dai_link;
35 probe/remove are optional. Do any machine specific probe here.
40 The machine driver has pre and post versions of suspend and resume to take care
41 of any machine audio tasks that have to be done before or after the codec, DAIs
42 and DMA is suspended and resumed. Optional.
47 The machine specific audio operations can be set here. Again this is optional.
50 Machine DAI Configuration
51 -------------------------
52 The machine DAI configuration glues all the codec and CPU DAIs together. It can
53 also be used to set up the DAI system clock and for any machine related DAI
54 initialisation e.g. the machine audio map can be connected to the codec audio
55 map, unconnected codec pins can be set as such. Please see corgi.c, spitz.c
58 struct snd_soc_dai_link is used to set up each DAI in your machine. e.g.
60 /* corgi digital audio interface glue - connects codec <--> CPU */
61 static struct snd_soc_dai_link corgi_dai = {
63 .stream_name = "WM8731",
64 .cpu_dai = &pxa_i2s_dai,
65 .codec_dai = &wm8731_dai,
66 .init = corgi_wm8731_init,
70 struct snd_soc_card then sets up the machine with it's DAIs. e.g.
72 /* corgi audio machine driver */
73 static struct snd_soc_card snd_soc_corgi = {
75 .dai_link = &corgi_dai,
80 Machine Audio Subsystem
81 -----------------------
83 The machine soc device glues the platform, machine and codec driver together.
84 Private data can also be set here. e.g.
86 /* corgi audio private data */
87 static struct wm8731_setup_data corgi_wm8731_setup = {
91 /* corgi audio subsystem */
92 static struct snd_soc_device corgi_snd_devdata = {
93 .machine = &snd_soc_corgi,
94 .platform = &pxa2xx_soc_platform,
95 .codec_dev = &soc_codec_dev_wm8731,
96 .codec_data = &corgi_wm8731_setup,
103 The machine driver can optionally extend the codec power map and to become an
104 audio power map of the audio subsystem. This allows for automatic power up/down
105 of speaker/HP amplifiers, etc. Codec pins can be connected to the machines jack
106 sockets in the machine init function. See soc/pxa/spitz.c and dapm.txt for
113 Machine specific audio mixer controls can be added in the DAI init function.