1d8a5d624STakashi Iwai====================
2d8a5d624STakashi IwaiASoC Platform Driver
3d8a5d624STakashi Iwai====================
4d8a5d624STakashi Iwai
5d8a5d624STakashi IwaiAn ASoC platform driver class can be divided into audio DMA drivers, SoC DAI
6d8a5d624STakashi Iwaidrivers and DSP drivers. The platform drivers only target the SoC CPU and must
7d8a5d624STakashi Iwaihave no board specific code.
8d8a5d624STakashi Iwai
9d8a5d624STakashi IwaiAudio DMA
10d8a5d624STakashi Iwai=========
11d8a5d624STakashi Iwai
12d8a5d624STakashi IwaiThe platform DMA driver optionally supports the following ALSA operations:-
13d8a5d624STakashi Iwai::
14d8a5d624STakashi Iwai
15d8a5d624STakashi Iwai  /* SoC audio ops */
16d8a5d624STakashi Iwai  struct snd_soc_ops {
17d8a5d624STakashi Iwai	int (*startup)(struct snd_pcm_substream *);
18d8a5d624STakashi Iwai	void (*shutdown)(struct snd_pcm_substream *);
19d8a5d624STakashi Iwai	int (*hw_params)(struct snd_pcm_substream *, struct snd_pcm_hw_params *);
20d8a5d624STakashi Iwai	int (*hw_free)(struct snd_pcm_substream *);
21d8a5d624STakashi Iwai	int (*prepare)(struct snd_pcm_substream *);
22d8a5d624STakashi Iwai	int (*trigger)(struct snd_pcm_substream *, int);
23d8a5d624STakashi Iwai  };
24d8a5d624STakashi Iwai
25d8a5d624STakashi IwaiThe platform driver exports its DMA functionality via struct
26d9f29e9eSKuninori Morimotosnd_soc_component_driver:-
27d8a5d624STakashi Iwai::
28d8a5d624STakashi Iwai
29d9f29e9eSKuninori Morimoto  struct snd_soc_component_driver {
30d9f29e9eSKuninori Morimoto	const char *name;
31d8a5d624STakashi Iwai
32d9f29e9eSKuninori Morimoto	...
33d9f29e9eSKuninori Morimoto	int (*probe)(struct snd_soc_component *);
34d9f29e9eSKuninori Morimoto	void (*remove)(struct snd_soc_component *);
35d9f29e9eSKuninori Morimoto	int (*suspend)(struct snd_soc_component *);
36d9f29e9eSKuninori Morimoto	int (*resume)(struct snd_soc_component *);
37d8a5d624STakashi Iwai
38d8a5d624STakashi Iwai	/* pcm creation and destruction */
39d9f29e9eSKuninori Morimoto	int (*pcm_new)(struct snd_soc_pcm_runtime *);
40d8a5d624STakashi Iwai	void (*pcm_free)(struct snd_pcm *);
41d8a5d624STakashi Iwai
42d9f29e9eSKuninori Morimoto	...
43d9f29e9eSKuninori Morimoto	const struct snd_pcm_ops *ops;
44d9f29e9eSKuninori Morimoto	const struct snd_compr_ops *compr_ops;
45d9f29e9eSKuninori Morimoto	...
46d8a5d624STakashi Iwai  };
47d8a5d624STakashi Iwai
48d8a5d624STakashi IwaiPlease refer to the ALSA driver documentation for details of audio DMA.
49*d15534a6SMarek Vasuthttps://www.kernel.org/doc/html/latest/sound/kernel-api/writing-an-alsa-driver.html
50d8a5d624STakashi Iwai
51d8a5d624STakashi IwaiAn example DMA driver is soc/pxa/pxa2xx-pcm.c
52d8a5d624STakashi Iwai
53d8a5d624STakashi Iwai
54d8a5d624STakashi IwaiSoC DAI Drivers
55d8a5d624STakashi Iwai===============
56d8a5d624STakashi Iwai
57d8a5d624STakashi IwaiEach SoC DAI driver must provide the following features:-
58d8a5d624STakashi Iwai
59d8a5d624STakashi Iwai1. Digital audio interface (DAI) description
60d8a5d624STakashi Iwai2. Digital audio interface configuration
61d8a5d624STakashi Iwai3. PCM's description
62d8a5d624STakashi Iwai4. SYSCLK configuration
63d8a5d624STakashi Iwai5. Suspend and resume (optional)
64d8a5d624STakashi Iwai
659225e4e0SChristina QuastPlease see codec.rst for a description of items 1 - 4.
66d8a5d624STakashi Iwai
67d8a5d624STakashi Iwai
68d8a5d624STakashi IwaiSoC DSP Drivers
69d8a5d624STakashi Iwai===============
70d8a5d624STakashi Iwai
71d8a5d624STakashi IwaiEach SoC DSP driver usually supplies the following features :-
72d8a5d624STakashi Iwai
73d8a5d624STakashi Iwai1. DAPM graph
74d8a5d624STakashi Iwai2. Mixer controls
75d8a5d624STakashi Iwai3. DMA IO to/from DSP buffers (if applicable)
76d8a5d624STakashi Iwai4. Definition of DSP front end (FE) PCM devices.
77d8a5d624STakashi Iwai
78d8a5d624STakashi IwaiPlease see DPCM.txt for a description of item 4.
79