日期:2014-05-16  浏览次数:20656 次

linux音频alsa-uda134x驱动文档阅读之八(平台驱动)

转自:http://blog.chinaunix.net/uid-22917448-id-1765509.html

ASoC Platform Driver

ASoC平台驱动
====================

An ASoC platform driver can be divided into audio DMA and SoC DAI configuration
and control. The platform drivers only target the SoC CPU and must have no board
specific code.
一个ASoC平台驱动可以分为音频DAM和SoC DAI配置和控制。平台驱动只锁定平台处理器为目标,必须不包含任何板级相关代码

Audio DMA
音频DMA
=========

The platform DMA driver optionally supports the following ALSA operations:-
平台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);
};

The platform driver exports its DMA functionality via struct snd_soc_platform:-
平台驱动通过snd_doc_platform结构导出其DAM功能

struct snd_soc_platform {
    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 *);

    /* platform stream ops */
    struct snd_pcm_ops *pcm_ops;
};

Please refer to the ALSA driver documentation for details of audio DMA.
请参考ALSA驱动文档以更加详尽地了解音频DMA。
http://www.alsa-project.org/~iwai/writing-an-alsa-driver/c436.htm

An example DMA driver is soc/pxa/pxa2xx-pcm.c
DMA驱动的一个例子:soc/pxa/pxa2xx-pcm.c

SoC DAI Drivers
板级DAI驱动
===============

Each SoC DAI driver must provide the following features:-
每个SoC DAI驱动都必须提供如下性能:

1) Digital audio interface (DAI) description
1)数字音频接口描述
2) Digital audio interface configuration
2)数字音频接口配置
3) PCM's description
3)PCM描述
4) SYSCLK configuration
4)系统时钟配置
5) Suspend and resume (optional)
5)挂起和恢复(可选的)

Please see codec.txt for a description of items 1 - 4.