^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) ====================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) ASoC Platform Driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) ====================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) An ASoC platform driver class can be divided into audio DMA drivers, SoC DAI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) drivers and DSP drivers. The platform drivers only target the SoC CPU and must
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) have no board specific code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) Audio DMA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) =========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) The platform DMA driver optionally supports the following ALSA operations:-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) /* SoC audio ops */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct snd_soc_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) int (*startup)(struct snd_pcm_substream *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) void (*shutdown)(struct snd_pcm_substream *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) int (*hw_params)(struct snd_pcm_substream *, struct snd_pcm_hw_params *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) int (*hw_free)(struct snd_pcm_substream *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) int (*prepare)(struct snd_pcm_substream *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) int (*trigger)(struct snd_pcm_substream *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) The platform driver exports its DMA functionality via struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) snd_soc_component_driver:-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) struct snd_soc_component_driver {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) const char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) int (*probe)(struct snd_soc_component *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) void (*remove)(struct snd_soc_component *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) int (*suspend)(struct snd_soc_component *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) int (*resume)(struct snd_soc_component *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) /* pcm creation and destruction */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) int (*pcm_new)(struct snd_soc_pcm_runtime *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) void (*pcm_free)(struct snd_pcm *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) const struct snd_pcm_ops *ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) const struct snd_compr_ops *compr_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) Please refer to the ALSA driver documentation for details of audio DMA.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) http://www.alsa-project.org/~iwai/writing-an-alsa-driver/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) An example DMA driver is soc/pxa/pxa2xx-pcm.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) SoC DAI Drivers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) ===============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) Each SoC DAI driver must provide the following features:-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 1. Digital audio interface (DAI) description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 2. Digital audio interface configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 3. PCM's description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 4. SYSCLK configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 5. Suspend and resume (optional)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) Please see codec.rst for a description of items 1 - 4.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) SoC DSP Drivers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) ===============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) Each SoC DSP driver usually supplies the following features :-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 1. DAPM graph
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 2. Mixer controls
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 3. DMA IO to/from DSP buffers (if applicable)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 4. Definition of DSP front end (FE) PCM devices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) Please see DPCM.txt for a description of item 4.