blob: d5574904d981d59e1b2a23afbfcc71262f50edbe [file] [log] [blame]
Takashi Iwaid8a5d622016-11-10 22:21:56 +01001====================
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +02002ASoC Platform Driver
3====================
4
Liam Girdwood3eb01282013-09-20 18:19:06 +01005An ASoC platform driver class can be divided into audio DMA drivers, SoC DAI
6drivers and DSP drivers. The platform drivers only target the SoC CPU and must
7have no board specific code.
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +02008
9Audio DMA
10=========
11
Mark Brown7c4dbbd2008-01-23 08:41:46 +010012The platform DMA driver optionally supports the following ALSA operations:-
Takashi Iwaid8a5d622016-11-10 22:21:56 +010013::
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +020014
Takashi Iwaid8a5d622016-11-10 22:21:56 +010015 /* SoC audio ops */
16 struct snd_soc_ops {
Takashi Iwai5b78efd2006-11-24 16:12:50 +010017 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 Iwaid8a5d622016-11-10 22:21:56 +010023 };
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +020024
Seungwhan Youn379c4bf2011-01-13 11:08:21 +090025The platform driver exports its DMA functionality via struct
26snd_soc_platform_driver:-
Takashi Iwaid8a5d622016-11-10 22:21:56 +010027::
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +020028
Takashi Iwaid8a5d622016-11-10 22:21:56 +010029 struct snd_soc_platform_driver {
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +020030 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 Iwai5b78efd2006-11-24 16:12:50 +010038 int (*pcm_new)(struct snd_card *, struct snd_soc_codec_dai *, struct snd_pcm *);
39 void (*pcm_free)(struct snd_pcm *);
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +020040
Seungwhan Youn379c4bf2011-01-13 11:08:21 +090041 /*
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 Girdwoodeb1a6af2006-10-06 18:34:51 +020048 /* platform stream ops */
Takashi Iwai5b78efd2006-11-24 16:12:50 +010049 struct snd_pcm_ops *pcm_ops;
Takashi Iwaid8a5d622016-11-10 22:21:56 +010050 };
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +020051
Mark Brown7c4dbbd2008-01-23 08:41:46 +010052Please refer to the ALSA driver documentation for details of audio DMA.
Justin P. Mattock0ea6e612010-07-23 20:51:24 -070053http://www.alsa-project.org/~iwai/writing-an-alsa-driver/
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +020054
55An example DMA driver is soc/pxa/pxa2xx-pcm.c
56
57
58SoC DAI Drivers
59===============
60
61Each SoC DAI driver must provide the following features:-
62
Takashi Iwaid8a5d622016-11-10 22:21:56 +0100631. Digital audio interface (DAI) description
642. Digital audio interface configuration
653. PCM's description
664. SYSCLK configuration
675. Suspend and resume (optional)
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +020068
69Please see codec.txt for a description of items 1 - 4.
Liam Girdwood3eb01282013-09-20 18:19:06 +010070
71
72SoC DSP Drivers
73===============
74
75Each SoC DSP driver usually supplies the following features :-
76
Takashi Iwaid8a5d622016-11-10 22:21:56 +0100771. DAPM graph
782. Mixer controls
793. DMA IO to/from DSP buffers (if applicable)
804. Definition of DSP front end (FE) PCM devices.
Liam Girdwood3eb01282013-09-20 18:19:06 +010081
82Please see DPCM.txt for a description of item 4.