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