Chinaunix首页 | 论坛 | 博客
  • 博客访问: 36969
  • 博文数量: 28
  • 博客积分: 351
  • 博客等级: 一等列兵
  • 技术积分: 205
  • 用 户 组: 普通用户
  • 注册时间: 2010-06-24 18:36
文章分类

全部博文(28)

文章存档

2012年(18)

2011年(9)

2010年(1)

我的朋友

分类:

2012-08-08 16:45:07

ASoC Machine Driver
ASoC机器驱动
===================

The ASoC machine (or board) driver is the code that glues together the platform
and codec drivers.
ASoC机器或板级驱动是把平台和解码器驱动粘合在一起的代码

The machine driver can contain codec and platform specific code. It registers
the audio subsystem with the kernel as a platform device and is represented by
the following struct:-
机器驱动可以包含解码器和平台相关代码。它把音频系统注册为内核中的一个平台设备,并由下面的结构体表示:

/* SoC machine */
struct snd_soc_card {
    char *name;

    int (*probe)(struct platform_device *pdev);
    int (*remove)(struct platform_device *pdev);

    /* the pre and post PM functions are used to do any PM work before and
     * after the codec and DAIs do any PM work. */
    int (*suspend_pre)(struct platform_device *pdev, pm_message_t state);
    int (*suspend_post)(struct platform_device *pdev, pm_message_t state);
    int (*resume_pre)(struct platform_device *pdev);
    int (*resume_post)(struct platform_device *pdev);

    /* machine stream operations */
    struct snd_soc_ops *ops;

    /* CPU <--> Codec DAI links  */
    struct snd_soc_dai_link *dai_link;
    int num_links;
};

probe()/remove()
探测和移除函数
----------------
probe/remove are optional. Do any machine specific probe here.
probe/remove(探测和移除函数)是可选的。可以做一些机器相关的探测。


suspend()/resume()
挂起和恢复函数
------------------
The machine driver has pre and post versions of suspend and resume to take care
of any machine audio tasks that have to be done before or after the codec, DAIs
and DMA is suspended and resumed. Optional.
机器驱动有一前后两个版本的挂起和恢复函数来管理在解码前后要完成的机器音频任务。DAI和DMA都要挂起和恢复。这也是可选的。


Machine operations
机器操作
------------------
The machine specific audio operations can be set here. Again this is optional.
机器相关音频操作可以在这里设定。这也是可选的。


Machine DAI Configuration
机器数字音频接口配置
-------------------------
The machine DAI configuration glues all the codec and CPU DAIs together. It can
also be used to set up the DAI system clock and for any machine related DAI
initialisation e.g. the machine audio map can be connected to the codec audio
map, unconnected codec pins can be set as such. Please see corgi.c, spitz.c
for examples.
机器的DAI配置把所有的解码器和CPU DAI粘合在一起。它也可以用来启动DAI系统时钟或机器相在DAI的初始化。如机器音频映像可以与解码器音频映像连在一起。非相连的解码器引脚也可以如此设置。例子请见corgi.c,spitz.c.

struct snd_soc_dai_link is used to set up each DAI in your machine. e.g.
结构体snd_soc_dai_link设置你机器的DAI。例如:

/* corgi digital audio interface glue - connects codec <--> CPU */
static struct snd_soc_dai_link corgi_dai = {
    .name = "WM8731",
    .stream_name = "WM8731",
    .cpu_dai = &pxa_i2s_dai,
    .codec_dai = &wm8731_dai,
    .init = corgi_wm8731_init,
    .ops = &corgi_ops,
};

struct snd_soc_card then sets up the machine with it's DAIs. e.g.
然后snd_soc_card用这个DAI来配置机器,例如:

/* corgi audio machine driver */
static struct snd_soc_card snd_soc_corgi = {
    .name = "Corgi",
    .dai_link = &corgi_dai,
    .num_links = 1,
};


Machine Audio Subsystem
机器音频子系统
-----------------------

The machine soc device glues the platform, machine and codec driver together.
Private data can also be set here. e.g.
机器soc 设备把平台,机器,解码器驱动结合在一起。
这里也可以设置私有数据

/* corgi audio private data */
static struct wm8731_setup_data corgi_wm8731_setup = {
    .i2c_address = 0x1b,
};

/* corgi audio subsystem */
static struct snd_soc_device corgi_snd_devdata = {
    .machine = &snd_soc_corgi,
    .platform = &pxa2xx_soc_platform,
    .codec_dev = &soc_codec_dev_wm8731,
    .codec_data = &corgi_wm8731_setup,
};


Machine Power Map
机器电源映像
-----------------

The machine driver can optionally extend the codec power map and to become an
audio power map of the audio subsystem. This allows for automatic power up/down
of speaker/HP amplifiers, etc. Codec pins can be connected to the machines jack
sockets in the machine init function. See soc/pxa/spitz.c and dapm.txt for
details.
机器驱动可以扩展解码器的电源映像,这样就变成一个音频子系统的音频电源映像。这允许扬声器/HP放大器等 源的自动通断。解码器引脚可以在机器初始化函数中连到机器插口中。详情请见soc/pxa/spitx.c和dapm.txt.


Machine Controls
机器控制
----------------

Machine specific audio mixer controls can be added in the DAI init function.
机器相关的音频混音控制可以加入到DAI初始化函数中。

君子注:
您现在所阅读的,是君子阅读Linux音频SoC驱动时,写下的文档译文。
君子写些译文,一方面是作为自己的笔记,帮助记忆,另一方面也希望能对他人有所帮助。
如果您能于君子的译文中有所收获,则吾心甚慰。
所有这几个文档原文,是见于linux-2.6.30/Documentation/sound/alsa/soc目录下的全部内容。
由于君子对音频方面的内容了解也不多,很多地方我自己也不理解,只是照着原文生硬的译出来。
其中错误愿来来访者之宾不吝指正。
张君再拜.
下面是所有九篇译文的详细网址,希望能对大家有用:

  1. linux音频alsa-uda134x驱动文档阅读之一(over-view)

  2. linux音频alsa-uda134x驱动文档阅读之二(时钟)

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

  4. linux音频alsa-uda134x驱动文档阅读之四(数字音频接口)

  5. linux音频alsa-uda134x驱动文档阅读之五(动态音频电源管理)

  6. linux音频alsa-uda134x驱动文档阅读之六(插口)

  7. linux音频alsa-uda134x驱动文档阅读之七(机器驱动)

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

  9. linux音频alsa-uda134x驱动文档阅读之九(咔咔声)

阅读(304) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~