Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 1 | ASoC Platform Driver |
| 2 | ==================== |
| 3 | |
| 4 | An ASoC platform driver can be divided into audio DMA and SoC DAI configuration |
| 5 | and control. The platform drivers only target the SoC CPU and must have no board |
| 6 | specific code. |
| 7 | |
| 8 | Audio DMA |
| 9 | ========= |
| 10 | |
Mark Brown | 7c4dbbd | 2008-01-23 08:41:46 +0100 | [diff] [blame] | 11 | The platform DMA driver optionally supports the following ALSA operations:- |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 12 | |
| 13 | /* SoC audio ops */ |
| 14 | struct snd_soc_ops { |
Takashi Iwai | 5b78efd | 2006-11-24 16:12:50 +0100 | [diff] [blame] | 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); |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 21 | }; |
| 22 | |
Matt LaPlante | 01dd2fb | 2007-10-20 01:34:40 +0200 | [diff] [blame] | 23 | The platform driver exports its DMA functionality via struct snd_soc_platform:- |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 24 | |
| 25 | struct snd_soc_platform { |
| 26 | char *name; |
| 27 | |
| 28 | int (*probe)(struct platform_device *pdev); |
| 29 | int (*remove)(struct platform_device *pdev); |
| 30 | int (*suspend)(struct platform_device *pdev, struct snd_soc_cpu_dai *cpu_dai); |
| 31 | int (*resume)(struct platform_device *pdev, struct snd_soc_cpu_dai *cpu_dai); |
| 32 | |
| 33 | /* pcm creation and destruction */ |
Takashi Iwai | 5b78efd | 2006-11-24 16:12:50 +0100 | [diff] [blame] | 34 | int (*pcm_new)(struct snd_card *, struct snd_soc_codec_dai *, struct snd_pcm *); |
| 35 | void (*pcm_free)(struct snd_pcm *); |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 36 | |
| 37 | /* platform stream ops */ |
Takashi Iwai | 5b78efd | 2006-11-24 16:12:50 +0100 | [diff] [blame] | 38 | struct snd_pcm_ops *pcm_ops; |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 39 | }; |
| 40 | |
Mark Brown | 7c4dbbd | 2008-01-23 08:41:46 +0100 | [diff] [blame] | 41 | Please refer to the ALSA driver documentation for details of audio DMA. |
Justin P. Mattock | 0ea6e61 | 2010-07-23 20:51:24 -0700 | [diff] [blame^] | 42 | http://www.alsa-project.org/~iwai/writing-an-alsa-driver/ |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 43 | |
| 44 | An example DMA driver is soc/pxa/pxa2xx-pcm.c |
| 45 | |
| 46 | |
| 47 | SoC DAI Drivers |
| 48 | =============== |
| 49 | |
| 50 | Each SoC DAI driver must provide the following features:- |
| 51 | |
| 52 | 1) Digital audio interface (DAI) description |
| 53 | 2) Digital audio interface configuration |
| 54 | 3) PCM's description |
Mark Brown | 7c4dbbd | 2008-01-23 08:41:46 +0100 | [diff] [blame] | 55 | 4) SYSCLK configuration |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 56 | 5) Suspend and resume (optional) |
| 57 | |
| 58 | Please see codec.txt for a description of items 1 - 4. |