blob: d57efad37e0a5b33606599f6735f180706fd228d [file] [log] [blame]
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +02001ASoC Platform Driver
2====================
3
4An ASoC platform driver can be divided into audio DMA and SoC DAI configuration
5and control. The platform drivers only target the SoC CPU and must have no board
6specific code.
7
8Audio DMA
9=========
10
Mark Brown7c4dbbd2008-01-23 08:41:46 +010011The platform DMA driver optionally supports the following ALSA operations:-
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +020012
13/* SoC audio ops */
14struct snd_soc_ops {
Takashi Iwai5b78efd2006-11-24 16:12:50 +010015 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);
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +020021};
22
Seungwhan Youn379c4bf2011-01-13 11:08:21 +090023The platform driver exports its DMA functionality via struct
24snd_soc_platform_driver:-
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +020025
Seungwhan Youn379c4bf2011-01-13 11:08:21 +090026struct snd_soc_platform_driver {
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +020027 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 */
Takashi Iwai5b78efd2006-11-24 16:12:50 +010035 int (*pcm_new)(struct snd_card *, struct snd_soc_codec_dai *, struct snd_pcm *);
36 void (*pcm_free)(struct snd_pcm *);
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +020037
Seungwhan Youn379c4bf2011-01-13 11:08:21 +090038 /*
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
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +020045 /* platform stream ops */
Takashi Iwai5b78efd2006-11-24 16:12:50 +010046 struct snd_pcm_ops *pcm_ops;
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +020047};
48
Mark Brown7c4dbbd2008-01-23 08:41:46 +010049Please refer to the ALSA driver documentation for details of audio DMA.
Justin P. Mattock0ea6e612010-07-23 20:51:24 -070050http://www.alsa-project.org/~iwai/writing-an-alsa-driver/
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +020051
52An example DMA driver is soc/pxa/pxa2xx-pcm.c
53
54
55SoC DAI Drivers
56===============
57
58Each 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
Mark Brown7c4dbbd2008-01-23 08:41:46 +010063 4) SYSCLK configuration
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +020064 5) Suspend and resume (optional)
65
66Please see codec.txt for a description of items 1 - 4.