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

linux音频alsa-uda134x驱动文档阅读之三(解码器)

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

ASoC Codec Driver

ASoC解码器驱动
=================

The codec driver is generic and hardware independent code that configures the
codec to provide audio capture and playback. It should contain no code that is
specific to the target platform or machine. All platform and machine specific
code should be added to the platform and machine drivers respectively.
解码器驱动是通用、硬件无关的代码,它配置解码器以支持音频捕获与回放。它不应包含任何与目标平台或机器相关的代码。平台或机器相关代码应该分别加 入到平台和机器驱动中去。


Each codec driver *must* provide the following features:-
各解码器驱动必须提供如下特性

1) Codec DAI and PCM configuration
2) Codec control IO - using I2C, 3 Wire(SPI) or both APIs
3) Mixers and audio controls
4) Codec audio operations
1)解码器数字音频接口和PCM配置。
2)解码器控制IO-使用I2C,3总线(SPI)或两个都有。
3)混音器和音频控制。
4)解码器音频操作。


Optionally, codec drivers can also provide:-
解码器驱动可以选择性提供:

5) DAPM description.
6) DAPM event handler.
7) DAC Digital mute control.
5)动态音频电源管理描述。
6)动态音频电源管理事件控制。
7)数模转换数字消音控制。


Its probably best to use this guide in conjunction with the existing codec
driver code in sound/soc/codecs/
大家也许最好联同己存在于sound/soc/codecs/中的驱动代码一起来使用这个指导书。


ASoC Codec driver breakdown
ASoC 解码器崩溃
===========================

1 - Codec DAI and PCM configuration
1-解码器数字音频接口和PCM配置
-----------------------------------
Each codec driver must have a struct snd_soc_codec_dai to define its DAI and
PCM capabilities and operations. This struct is exported so that it can be
registered with the core by your machine driver.
各解码器驱动必须有一个snd_soc_codec_dai数据结构,它用来定义DAI和PCM提供的功能和操作。这个数据结构要导出,好让你的机器驱动程序将它注册到ALSA核心中去。

e.g.
例如:
struct snd_soc_codec_dai wm8731_dai = {
    .name = "WM8731",
    /* playback capabilities */
    .playback = {
        .stream_name = "Playback",
        .channels_min = 1,
        .channels_max = 2,
        .rates = WM8731_RATES,
        .formats = WM8731_FORMATS,},
    /* capture capabilities */
  &n