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

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

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

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的初始化。如机器音