xref: /linux/Documentation/sound/soc/platform.rst (revision e5c86679d5e864947a52fb31e45a425dea3e7fa9)
1====================
2ASoC Platform Driver
3====================
4
5An 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.
8
9Audio DMA
10=========
11
12The platform DMA driver optionally supports the following ALSA operations:-
13::
14
15  /* SoC audio ops */
16  struct snd_soc_ops {
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);
23  };
24
25The platform driver exports its DMA functionality via struct
26snd_soc_platform_driver:-
27::
28
29  struct snd_soc_platform_driver {
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 */
38	int (*pcm_new)(struct snd_card *, struct snd_soc_codec_dai *, struct snd_pcm *);
39	void (*pcm_free)(struct snd_pcm *);
40
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
48	/* platform stream ops */
49	struct snd_pcm_ops *pcm_ops;
50  };
51
52Please refer to the ALSA driver documentation for details of audio DMA.
53http://www.alsa-project.org/~iwai/writing-an-alsa-driver/
54
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
631. Digital audio interface (DAI) description
642. Digital audio interface configuration
653. PCM's description
664. SYSCLK configuration
675. Suspend and resume (optional)
68
69Please see codec.txt for a description of items 1 - 4.
70
71
72SoC DSP Drivers
73===============
74
75Each SoC DSP driver usually supplies the following features :-
76
771. DAPM graph
782. Mixer controls
793. DMA IO to/from DSP buffers (if applicable)
804. Definition of DSP front end (FE) PCM devices.
81
82Please see DPCM.txt for a description of item 4.
83