Hi3798 Alsa 驱动分析

1:文件

aiao_v1_1/alsa/dsp_mix_v2/alsa_aiao_proc_func.c

 

aiao_v1_1/alsa/dsp_mix_v2/drv_ao_func.c

 

aiao_v1_1/alsa/dsp_mix_v2/hiaiao_card.c

 

aiao_v1_1/alsa/dsp_mix_v2/hiaiao_i2s.c

 

aiao_v1_1/alsa/dsp_mix_v2/hiaiao_dma.c

 

aiao_v1_1/alsa/dsp_mix_v2/drv_ai_func.o

 

aiao_v1_1/alsa/dsp_mix_v2/alsa_aiao_volume_func.o

 

aiao_v1_1/alsa/dsp_mix_v2/hiaiao_codec.o

 

 

 

 

 

 

 

 

 

 

2:宏定义

 

HI_ALSA_AI_SUPPORT  
   
   
   
   

 

 

3: 基本原理,5大部件

platform ---snd_soc_register_platform

codec

 

platform-dai

 

codec-dai

 

machine

 

 

4 platform

 

4.1 snd_soc_register_platform

 

hiaudio_dma_init

hiaudio_dma_device = platform_device_alloc("hisi-audio", -1);

platform_device_add(hiaudio_dma_device);

platform_driver_register(&hiaudio_dma_driver);

自己创建设备,自己注册驱动,这样就触动driver的porbe函数

static struct platform_driver hiaudio_dma_driver = {
    .driver = {
        .name = "hisi-audio",
        .owner = THIS_MODULE,
    },
    .probe = soc_snd_platform_probe,
    .remove = __exit_p(soc_snd_platform_remove),
};

soc_snd_platform_probe

分配整个platform层的传输管理结构,struct hiaudio_data单独描述

had = kzalloc(sizeof(struct hiaudio_data), GFP_KERNEL);

设置为dev的drvdata   

dev_set_drvdata(&pdev->dev, had);

初始化部分struct hiaudio_data部分成员

向soc注册  platform

    ret = snd_soc_register_platform(&pdev->dev, &aiao_soc_platform_drv);

 

注册platform时,直接把驱动也注册上去了。

struct snd_soc_platform_driver

aiao_soc_platform_drv

static struct snd_soc_platform_driver aiao_soc_platform_drv =
{
    .ops         = &hi_dma_ops,
    .pcm_new   = hi_dma_pcm_new,
    .pcm_free   = hi_dma_pcm_free,
    .probe      = hi_dma_probe,
#ifdef CONFIG_PM
 .suspend = hi_dma_suspend,
 .resume  = hi_dma_resume,
#endif 
};

 

   
   
   
   
   
   
   
   
   
   
   
   

 

4.2  snd_soc_platform_driver

 

你可能感兴趣的:(音频)