About Kernel Documentation Linux Kernel Contact Linux Resources Linux Blog

Documentation / sound / alsa / soc / machine.txt




Custom Search

Based on kernel version 3.16. Page generated on 2014-08-06 21:41 EST.

1	ASoC Machine Driver
2	===================
3	
4	The ASoC machine (or board) driver is the code that glues together all the
5	component drivers (e.g. codecs, platforms and DAIs). It also describes the
6	relationships between each componnent which include audio paths, GPIOs,
7	interrupts, clocking, jacks and voltage regulators.
8	
9	The machine driver can contain codec and platform specific code. It registers
10	the audio subsystem with the kernel as a platform device and is represented by
11	the following struct:-
12	
13	/* SoC machine */
14	struct snd_soc_card {
15		char *name;
16	
17		...
18	
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
23		 * after the codec and DAIs do any PM work. */
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	
29		...
30	
31		/* CPU <--> Codec DAI links  */
32		struct snd_soc_dai_link *dai_link;
33		int num_links;
34	
35		...
36	};
37	
38	probe()/remove()
39	----------------
40	probe/remove are optional. Do any machine specific probe here.
41	
42	
43	suspend()/resume()
44	------------------
45	The machine driver has pre and post versions of suspend and resume to take care
46	of any machine audio tasks that have to be done before or after the codec, DAIs
47	and DMA is suspended and resumed. Optional.
48	
49	
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.
56	
57	struct 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 */
60	static struct snd_soc_dai_link corgi_dai = {
61		.name = "WM8731",
62		.stream_name = "WM8731",
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",
67		.init = corgi_wm8731_init,
68		.ops = &corgi_ops,
69	};
70	
71	struct snd_soc_card then sets up the machine with its DAIs. e.g.
72	
73	/* corgi audio machine driver */
74	static struct snd_soc_card snd_soc_corgi = {
75		.name = "Corgi",
76		.dai_link = &corgi_dai,
77		.num_links = 1,
78	};
79	
80	
81	Machine Power Map
82	-----------------
83	
84	The machine driver can optionally extend the codec power map and to become an
85	audio power map of the audio subsystem. This allows for automatic power up/down
86	of speaker/HP amplifiers, etc. Codec pins can be connected to the machines jack
87	sockets in the machine init function.
88	
89	
90	Machine Controls
91	----------------
92	
93	Machine specific audio mixer controls can be added in the DAI init function.
Hide Line Numbers
About Kernel Documentation Linux Kernel Contact Linux Resources Linux Blog

Information is copyright its respective author. All material is available from the Linux Kernel Source distributed under a GPL License. This page is provided as a free service by mjmwired.net.