2016-11-11 05:21:56 +08:00
|
|
|
====================
|
2006-10-07 00:34:51 +08:00
|
|
|
ASoC Platform Driver
|
|
|
|
====================
|
|
|
|
|
2013-09-21 01:19:06 +08:00
|
|
|
An ASoC platform driver class can be divided into audio DMA drivers, SoC DAI
|
|
|
|
drivers and DSP drivers. The platform drivers only target the SoC CPU and must
|
|
|
|
have no board specific code.
|
2006-10-07 00:34:51 +08:00
|
|
|
|
|
|
|
Audio DMA
|
|
|
|
=========
|
|
|
|
|
2008-01-23 15:41:46 +08:00
|
|
|
The platform DMA driver optionally supports the following ALSA operations:-
|
2016-11-11 05:21:56 +08:00
|
|
|
::
|
2006-10-07 00:34:51 +08:00
|
|
|
|
2016-11-11 05:21:56 +08:00
|
|
|
/* SoC audio ops */
|
|
|
|
struct snd_soc_ops {
|
2006-11-24 23:12:50 +08:00
|
|
|
int (*startup)(struct snd_pcm_substream *);
|
|
|
|
void (*shutdown)(struct snd_pcm_substream *);
|
|
|
|
int (*hw_params)(struct snd_pcm_substream *, struct snd_pcm_hw_params *);
|
|
|
|
int (*hw_free)(struct snd_pcm_substream *);
|
|
|
|
int (*prepare)(struct snd_pcm_substream *);
|
|
|
|
int (*trigger)(struct snd_pcm_substream *, int);
|
2016-11-11 05:21:56 +08:00
|
|
|
};
|
2006-10-07 00:34:51 +08:00
|
|
|
|
2011-01-13 10:08:21 +08:00
|
|
|
The platform driver exports its DMA functionality via struct
|
2018-05-08 11:21:24 +08:00
|
|
|
snd_soc_component_driver:-
|
2016-11-11 05:21:56 +08:00
|
|
|
::
|
2006-10-07 00:34:51 +08:00
|
|
|
|
2018-05-08 11:21:24 +08:00
|
|
|
struct snd_soc_component_driver {
|
|
|
|
const char *name;
|
2006-10-07 00:34:51 +08:00
|
|
|
|
2018-05-08 11:21:24 +08:00
|
|
|
...
|
|
|
|
int (*probe)(struct snd_soc_component *);
|
|
|
|
void (*remove)(struct snd_soc_component *);
|
|
|
|
int (*suspend)(struct snd_soc_component *);
|
|
|
|
int (*resume)(struct snd_soc_component *);
|
2006-10-07 00:34:51 +08:00
|
|
|
|
|
|
|
/* pcm creation and destruction */
|
2018-05-08 11:21:24 +08:00
|
|
|
int (*pcm_new)(struct snd_soc_pcm_runtime *);
|
2006-11-24 23:12:50 +08:00
|
|
|
void (*pcm_free)(struct snd_pcm *);
|
2006-10-07 00:34:51 +08:00
|
|
|
|
2018-05-08 11:21:24 +08:00
|
|
|
...
|
|
|
|
const struct snd_pcm_ops *ops;
|
|
|
|
const struct snd_compr_ops *compr_ops;
|
|
|
|
...
|
2016-11-11 05:21:56 +08:00
|
|
|
};
|
2006-10-07 00:34:51 +08:00
|
|
|
|
2008-01-23 15:41:46 +08:00
|
|
|
Please refer to the ALSA driver documentation for details of audio DMA.
|
2010-07-24 11:51:24 +08:00
|
|
|
http://www.alsa-project.org/~iwai/writing-an-alsa-driver/
|
2006-10-07 00:34:51 +08:00
|
|
|
|
|
|
|
An example DMA driver is soc/pxa/pxa2xx-pcm.c
|
|
|
|
|
|
|
|
|
|
|
|
SoC DAI Drivers
|
|
|
|
===============
|
|
|
|
|
|
|
|
Each SoC DAI driver must provide the following features:-
|
|
|
|
|
2016-11-11 05:21:56 +08:00
|
|
|
1. Digital audio interface (DAI) description
|
|
|
|
2. Digital audio interface configuration
|
|
|
|
3. PCM's description
|
|
|
|
4. SYSCLK configuration
|
|
|
|
5. Suspend and resume (optional)
|
2006-10-07 00:34:51 +08:00
|
|
|
|
2018-04-12 00:33:26 +08:00
|
|
|
Please see codec.rst for a description of items 1 - 4.
|
2013-09-21 01:19:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
SoC DSP Drivers
|
|
|
|
===============
|
|
|
|
|
|
|
|
Each SoC DSP driver usually supplies the following features :-
|
|
|
|
|
2016-11-11 05:21:56 +08:00
|
|
|
1. DAPM graph
|
|
|
|
2. Mixer controls
|
|
|
|
3. DMA IO to/from DSP buffers (if applicable)
|
|
|
|
4. Definition of DSP front end (FE) PCM devices.
|
2013-09-21 01:19:06 +08:00
|
|
|
|
|
|
|
Please see DPCM.txt for a description of item 4.
|