博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
lsa声卡/dev/snd/pcmC0D0p的open打开流程
阅读量:5839 次
发布时间:2019-06-18

本文共 2873 字,大约阅读时间需要 9 分钟。

lsa声卡/dev/snd/pcmC0D0p的open打开流程 (2010-06-02 17:20)
分类:

soc_probe
==> snd_soc_register_card或者snd_soc_register_dai或者snd_soc_register_platform或者snd_soc_register_codec
==> snd_soc_instantiate_cards
==> snd_soc_instantiate_card
==> codec_dev->probe
==> uda134x_soc_probe
==> snd_soc_new_pcms
==> soc_new_pcm
==> snd_pcm_new
snd_soc_new_pcms
snd_card_create
snd_ctl_create
snd_ctl_dev_register创建"controlC%i"声卡对应的控制节点,
他的fops为snd_ctl_f_ops
snd_pcm_dev_register
snd_register_device_for_dev
创建"pcmC%iD%ip"或者"pcmC%iD%ic"设备节点,它的fops为snd_pcm_f_ops[2]
snd_pcm_f_ops[2]
==> snd_pcm_playback_open或者snd_pcm_capture_open
==> snd_pcm_open或者oss的snd_pcm_oss_f_reg.snd_pcm_oss_open,这就对应/dev/dsp了
==> snd_pcm_open_file或者oss的snd_pcm_oss_open_file
==> snd_pcm_open_substream
==> soc_pcm_open
/* ASoC PCM operations */
static struct snd_pcm_ops soc_pcm_ops = {
    .open        = soc_pcm_open,
    .close        = soc_codec_close,
    .hw_params    = soc_pcm_hw_params,
    .hw_free    = soc_pcm_hw_free,
    .prepare    = soc_pcm_prepare,
    .trigger    = soc_pcm_trigger,
};
==> soc_pcm_open
cpu_dai->ops->startup       // 无
platform->pcm_ops->open     // s3c_dma_open 分配DMA空间
codec_dai->ops->startup     // uda134x_startup
card_dai_link->ops->startup // s3c24xx_uda134x_startup 获取clock时钟源
// cpu_dai单元
struct snd_soc_dai s3c24xx_i2s_dai = {
    .name = "s3c24xx-i2s",
    .id = 0,
    .probe = s3c24xx_i2s_probe,
    .suspend = s3c24xx_i2s_suspend,
    .resume = s3c24xx_i2s_resume,
    .playback = {
        .channels_min = 2,
        .channels_max = 2,
        .rates = S3C24XX_I2S_RATES,
        .formats = SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE,},
    .capture = {
        .channels_min = 2,
        .channels_max = 2,
        .rates = S3C24XX_I2S_RATES,
        .formats = SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE,},
    .ops = &s3c24xx_i2s_dai_ops,
};
//platform单元
struct snd_soc_platform s3c24xx_soc_platform = {
    .name        = "s3c24xx-audio",
    .pcm_ops     = &s3c_dma_ops,
    .pcm_new    = s3c_dma_new,
    .pcm_free    = s3c_dma_free_dma_buffers,
};
static struct snd_pcm_ops s3c_dma_ops = {
    .open        = s3c_dma_open,
    .close        = s3c_dma_close,
    .ioctl        = snd_pcm_lib_ioctl,
    .hw_params    = s3c_dma_hw_params,
    .hw_free    = s3c_dma_hw_free,
    .prepare    = s3c_dma_prepare,
    .trigger    = s3c_dma_trigger,
    .pointer    = s3c_dma_pointer,
    .mmap        = s3c_dma_mmap,
};
// codec_dai单元
struct snd_soc_dai uda134x_dai = {
    .name = "UDA134X",
    /* playback capabilities */
    .playback = {
        .stream_name = "Playback",
        .channels_min = 1,
        .channels_max = 2,
        .rates = UDA134X_RATES,
        .formats = UDA134X_FORMATS,
    },
    /* capture capabilities */
    .capture = {
        .stream_name = "Capture",
        .channels_min = 1,
        .channels_max = 2,
        .rates = UDA134X_RATES,
        .formats = UDA134X_FORMATS,
    },
    /* pcm operations */
    .ops = &uda134x_dai_ops,
};
//card_dai_link单元
static struct snd_soc_dai_link s3c24xx_uda134x_dai_link = {
    .name = "UDA134X",
    .stream_name = "UDA134X",
    .codec_dai = &uda134x_dai,
    .cpu_dai = &s3c24xx_i2s_dai,
    .ops = &s3c24xx_uda134x_ops,
};

转载于:https://www.cnblogs.com/yuzaipiaofei/archive/2011/08/16/4124370.html

你可能感兴趣的文章
“互联网+广交会”,AMT助广交会确立互联网时代竞争新优势
查看>>
配置ks.cfg实现自动安装过程
查看>>
Soul 网关发布 1.0.4-RELEASE 版本
查看>>
Setting Up Load Balancers Using Terraform
查看>>
第一届对象存储技术及应用大会:Esri中国周宁——万物互联时代,云存储技术的变革与展望...
查看>>
有孚网络副总裁吕鑫:合纵连横,云领未来—如何打造低成本混合云架构
查看>>
Spring中注入基本类型
查看>>
aws devops
查看>>
Android 中文API (33) —— Checkable
查看>>
脚本方式安装 IIS7
查看>>
Oracle password expire notices
查看>>
C++异常处理 - try,catch,throw,finally的用法
查看>>
稳扎稳打Silverlight(12) - 2.0外观之样式, 模板, 视觉状态和视觉状态管理器
查看>>
Linux技巧汇总
查看>>
Linux下多播编程<一>【十全十美】
查看>>
怎样给RCP程序添加依赖的JAR包
查看>>
嵌入式应用MPU前景看好
查看>>
动态路由协议
查看>>
Windows Server 2008 R2 之二十八AD RMS故障排除
查看>>
发现“郝茵晴”:屌丝们的社会性传播实验
查看>>