]>
Commit | Line | Data |
---|---|---|
eb1a6af3 LG |
1 | ASoC Platform Driver |
2 | ==================== | |
3 | ||
3eb01283 LG |
4 | An ASoC platform driver class can be divided into audio DMA drivers, SoC DAI |
5 | drivers and DSP drivers. The platform drivers only target the SoC CPU and must | |
6 | have no board specific code. | |
eb1a6af3 LG |
7 | |
8 | Audio DMA | |
9 | ========= | |
10 | ||
7c4dbbd8 | 11 | The platform DMA driver optionally supports the following ALSA operations:- |
eb1a6af3 LG |
12 | |
13 | /* SoC audio ops */ | |
14 | struct snd_soc_ops { | |
5b78efd2 TI |
15 | int (*startup)(struct snd_pcm_substream *); |
16 | void (*shutdown)(struct snd_pcm_substream *); | |
17 | int (*hw_params)(struct snd_pcm_substream *, struct snd_pcm_hw_params *); | |
18 | int (*hw_free)(struct snd_pcm_substream *); | |
19 | int (*prepare)(struct snd_pcm_substream *); | |
20 | int (*trigger)(struct snd_pcm_substream *, int); | |
eb1a6af3 LG |
21 | }; |
22 | ||
379c4bf1 SY |
23 | The platform driver exports its DMA functionality via struct |
24 | snd_soc_platform_driver:- | |
eb1a6af3 | 25 | |
379c4bf1 | 26 | struct snd_soc_platform_driver { |
eb1a6af3 LG |
27 | char *name; |
28 | ||
29 | int (*probe)(struct platform_device *pdev); | |
30 | int (*remove)(struct platform_device *pdev); | |
31 | int (*suspend)(struct platform_device *pdev, struct snd_soc_cpu_dai *cpu_dai); | |
32 | int (*resume)(struct platform_device *pdev, struct snd_soc_cpu_dai *cpu_dai); | |
33 | ||
34 | /* pcm creation and destruction */ | |
5b78efd2 TI |
35 | int (*pcm_new)(struct snd_card *, struct snd_soc_codec_dai *, struct snd_pcm *); |
36 | void (*pcm_free)(struct snd_pcm *); | |
eb1a6af3 | 37 | |
379c4bf1 SY |
38 | /* |
39 | * For platform caused delay reporting. | |
40 | * Optional. | |
41 | */ | |
42 | snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *, | |
43 | struct snd_soc_dai *); | |
44 | ||
eb1a6af3 | 45 | /* platform stream ops */ |
5b78efd2 | 46 | struct snd_pcm_ops *pcm_ops; |
eb1a6af3 LG |
47 | }; |
48 | ||
7c4dbbd8 | 49 | Please refer to the ALSA driver documentation for details of audio DMA. |
0ea6e611 | 50 | http://www.alsa-project.org/~iwai/writing-an-alsa-driver/ |
eb1a6af3 LG |
51 | |
52 | An example DMA driver is soc/pxa/pxa2xx-pcm.c | |
53 | ||
54 | ||
55 | SoC DAI Drivers | |
56 | =============== | |
57 | ||
58 | Each SoC DAI driver must provide the following features:- | |
59 | ||
60 | 1) Digital audio interface (DAI) description | |
61 | 2) Digital audio interface configuration | |
62 | 3) PCM's description | |
7c4dbbd8 | 63 | 4) SYSCLK configuration |
eb1a6af3 LG |
64 | 5) Suspend and resume (optional) |
65 | ||
66 | Please see codec.txt for a description of items 1 - 4. | |
3eb01283 LG |
67 | |
68 | ||
69 | SoC DSP Drivers | |
70 | =============== | |
71 | ||
72 | Each SoC DSP driver usually supplies the following features :- | |
73 | ||
74 | 1) DAPM graph | |
75 | 2) Mixer controls | |
76 | 3) DMA IO to/from DSP buffers (if applicable) | |
77 | 4) Definition of DSP front end (FE) PCM devices. | |
78 | ||
79 | Please see DPCM.txt for a description of item 4. |