ASoC 平台 驱动
ASoC平台驱动类可以分成音频DMA驱动、Soc数字音频接口驱动和DSP驱动。平台驱动程序不能包含目标板特定代码,因为它只和Soc/CPU相关。
Audio DMA
平台DMA驱动程序支持(可选的)如下的ALSA文件指针:
/* SoC audio ops */
struct snd_soc_ops {
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);
};
平台驱动程序通过结构体snd_soc_platform_driver输出DMA功能函数。
struct snd_soc_platform_driver {
char *name;
int (*probe)(struct platform_device *pdev);
int (*remove)(struct platform_device *pdev);
int (*suspend)(struct platform_device *pdev, struct snd_soc_cpu_dai *cpu_dai);
int (*resume)(struct platform_device *pdev, struct snd_soc_cpu_dai
cpu_dai);
/ pcm creation and destruction */
int (*pcm_new)(struct snd_card *, struct snd_soc_codec_dai *, struct snd_pcm *);
void (*pcm_free)(struct snd_pcm
);
/
* For platform caused delay reporting.
* Optional.
*/
snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *,
struct snd_soc_dai
);
/ platform stream ops */
struct snd_pcm_ops *pcm_ops;
};
了解音频DMA的更多详情请参考 ALSA 驱动的文件说明.
http://www.alsa-project.org/~iwai/writing-an-alsa-driver/
可以查看一个DMA的驱动实例: soc/pxa/pxa2xx-pcm.c
SoC DAI 驱动程序
所有 SoC DAI 驱动必须提供以下的功能:
- 数字音频接口 (DAI) 描述
- 数字音频接口配置
- PCM’s 描述
- 系统时钟配置
- 休眠唤醒函数 (可选)
请从 codec.txt 获取 1 - 4点的详细描述.
SoC DSP 驱动
所有的 SoC DSP 驱动程序必须提供以下功能:
- 动态音频电源管理图
- 混音器控件
- DSP缓冲器相关的 DMA IO (如果适用)
- DSP前端 (FE) PCM 设备的定义.
请从 DPCM.txt获取第 4点详细描述.