</pre><pre name="code" class="html">        tlvaic3101音频芯片开发笔记调试技巧4、解读芯片寄存器设置
TLV320AIC3101IRHBT寄存器共分两组:page0和page1,每页127个寄存器, 我们需要关心的主要是page0的127个寄存器
page0中寄存器,按照功能分类如下:
page选择:    register 0
复位:           register 1
配置采样率: register 2 3 4 5 6 7 11
配置数据格式: register 8 9 10
录音ADC音量增益: register 15 16
输入通道设置: regisert 17 ~ 35
输出通道设置: register 37 ~89
输出音量设置:register 43 44
时钟设置:       register 101 1025、调试音频时,需要注意的地方
调试放音时,
a,放音音量默认设置为最大
b,cpu输出的i2s数据,位宽等要与音频芯片中的设置对等
c,注意通道的选择,硬件上连接的通道与软件寄存器设置的通道要对的上
调试录音时,
a,录音的增益调至最大
b,录音时,mic部分不能有悬空的引脚,否则会出现杂音的。6、调试技巧
IIC调试
a,可以尝试向音量控制寄存器写入音量,在读出,若都ok的话,则证明iic通讯异常
录音/放音有杂音,放音无声音
a,用逻辑分析仪测试I2S总线,在放音时左声道,右声道的数据应该是一致的,否则需要检查reg10的设置与处理器输出数据设置的关系
b,录音时,测试I2S总线,录音的左右声道数据也应该是一致的,可与手册中的I2S波形进行对比,查找原因。分析过程:
在\dvrrdk_04.00.00.03.kernel\sound\soc\codecs\tlv320aic3x.c
//重要的数据结构
/* machine i2c codec control layer */
static struct i2c_driver aic3x_i2c_driver = {.driver = {.name = "tlv320aic3x-codec",.owner = THIS_MODULE,},.probe = aic3x_i2c_probe,.remove = aic3x_i2c_remove,.id_table = aic3x_i2c_id,
};static struct snd_soc_codec_driver soc_codec_dev_aic3x = {.set_bias_level = aic3x_set_bias_level,.reg_cache_size = ARRAY_SIZE(aic3x_reg),.reg_word_size = sizeof(u8),.reg_cache_default = aic3x_reg,.probe = aic3x_probe,       //声卡的探测和初始化.remove = aic3x_remove,     //声卡卸载.suspend = aic3x_suspend,   //声卡休眠.resume = aic3x_resume,     //声卡从休眠到恢复
};static struct snd_soc_dai_ops aic3x_dai_ops = {.hw_params    = aic3x_hw_params,              //硬件参数设定.digital_mute  = aic3x_mute,               //静音操作.set_sysclk  = aic3x_set_dai_sysclk,         //系统时钟.set_fmt = aic3x_set_dai_fmt,            //格式设置
};static struct snd_soc_dai_driver aic3x_dai = {.name = "tlv320aic3x-hifi",.playback = {.stream_name = "Playback",.channels_min = 1,.channels_max = 2,.rates = AIC3X_RATES,.formats = AIC3X_FORMATS,},.capture = {.stream_name = "Capture",.channels_min = 1,.channels_max = 2,.rates = AIC3X_RATES,.formats = AIC3X_FORMATS,},.ops = &aic3x_dai_ops,      //声卡操作函数集合全部与硬件操作有关.symmetric_rates = 1,
};
/module_init(aic3x_modinit)--->aic3x_modinit(void)--->i2c_add_driver(&aic3x_i2c_driver)--->aic3x_i2c_probe---snd_soc_register_codec(&i2c->dev,&soc_codec_dev_aic3x, &aic3x_dai, 1);//执行结构体中soc_codec_dev_aic3x中的硬件探测函数aic3x_probe--->aic3x_probe(struct snd_soc_codec *codec)//硬件寄存器初始化--->aic3x_init(codec)   //Output stage volumes控制      --->snd_soc_add_controls(codec, aic3x_snd_controls,ARRAY_SIZE(aic3x_snd_controls));    在\dvrrdk_04.00.00.03.kernel\sound\soc\soc-core.c
//重要的数据结构,可以参考图来理解由上而下
/* ASoC platform driver */
static struct platform_driver soc_driver = {.driver        = {.name       = "soc-audio",.owner     = THIS_MODULE,.pm      = &soc_pm_ops,},.probe     = soc_probe,.remove        = soc_remove,
};/* 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,.pointer = soc_pcm_pointer,
};static int __init snd_soc_init(void)//platform注册--->platform_driver_register(&soc_driver);/* probes a new socdev */--->soc_probe(struct platform_device *pdev)//获取platform设备指针--->platform_get_drvdata(pdev)//snd_soc_register_card - Register a card with the ASoC core--->snd_soc_register_card(card)--->snd_soc_instantiate_cards();--->snd_soc_instantiate_card(card);--->INIT_WORK(&card->deferred_resume_work, soc_resume_deferred);--->soc_probe_dai_link(card, i);/* probe the cpu_dai */--->if (!cpu_dai->probed) /* probe the CODEC */--->if (!codec->probed) /* probe the platform */--->if (!platform->probed) /* probe the CODEC DAI */--->if (!codec_dai->probed)   //创建一个pcm实例--->soc_new_pcm(rtd, num);--->snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &soc_pcm_ops);问1:在tlvaic310x.c中aic3x_mute静音操作函数如何被上层调用的?
答1:
在
static struct snd_soc_dai_ops aic3x_dai_ops = {.hw_params  = aic3x_hw_params,.digital_mute    = aic3x_mute,.set_sysclk   = aic3x_set_dai_sysclk,.set_fmt    = aic3x_set_dai_fmt,
}; .digital_mute被--->dai->driver->ops->digital_mute(dai, mute);被--->int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute)被--->static int soc_codec_close(struct snd_pcm_substream *substream)被--->asla应用层调用问2:Asoc驱动中,音频数据流如何处理的?
答2:
在sound\soc\davinci\davinci-pcm.c
static int __init snd_davinci_pcm_init(void)--->platform_driver_register(&davinci_pcm_driver)--->davinci_soc_platform_probe(struct platform_device *pdev)--->snd_soc_register_platform(&pdev->dev, &davinci_soc_platform)//被谁调用?    --->davinci_pcm_new(struct snd_card *card,struct snd_soc_dai *dai, struct snd_pcm *pcm)//播放--->if (dai->driver->playback.channels_min) {ret = davinci_pcm_preallocate_dma_buffer(pcm,//录音--->if (dai->driver->capture.channels_min) {ret = davinci_pcm_preallocate_dma_buffer(pcm,//分配dma内存 --->dma_alloc_writecombine  问3:谁来调用davinci_pcm_new?
答3:
static struct snd_soc_platform_driver davinci_soc_platform = {.ops =      &davinci_pcm_ops,.pcm_new =    davinci_pcm_new,.pcm_free =    davinci_pcm_free,
};在sound\soc\Soc-core.c
/* create a new pcm */
static int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)--->platform->driver->pcm_new(rtd->card->snd_card, codec_dai, pcm);

tlvaic3101音频芯片开发笔记调试技巧相关推荐

  1. ios学习--iphone开发笔记和技巧总结(原址持续更新)

    ios学习--iphone开发笔记和技巧总结(原址持续更新) 分类: ios Object-C2012-04-18 10:16 2716人阅读 评论(1) 收藏 举报 uiviewiphonelist ...

  2. iphone开发笔记和技巧总结

    在iphone程序中实现截屏的一种方法: //导入头文件   #importQuartzCore/QuartzCore.h //将整个self.view大小的图层形式创建一张图片imageUIGrap ...

  3. IDEA开发工具调试技巧(极大提升开发效率)

    1.快捷键 1.1.查看方法哪里使用 操作:首先选中一个方法  然后按Ctrl +Alt +H 1.2.查看变量哪里使用 操作:首先选中一个变量  然后按 Alt +F7 1.3.查看类的继承关系 操 ...

  4. 《Java 核心技术卷1 第10版》学习笔记------调试技巧

    调试器是 Eclipse . NetBeans 这类专业集成开发环境的一部分 . 在启动调试器之前, 本节先给出一些有价值的建议 . 1 ) 可以用下面的方法打印或记录任意变量的值 : System. ...

  5. Visual Studio开发工具----调试技巧-转储文件

    3.10 转储文件 3.10.1 概述        转储文件是一个快照,它显示正在执行的进程和某个时刻为应用程序加载的模块.转储文件带有堆信息的转储还包括应用程序在该点的内存快照.        在 ...

  6. 嵌入式开发笔记——调试组件SEGGER_RTT

    作者:zzssdd2 E-mail:zzssdd2@foxmail.com 一.前言 在嵌入式开发过程中,经常会通过打印输出一些调试信息来调试参数.查找问题等,通常我的做法都是使用芯片的串口硬件设备配 ...

  7. Visual Studio原生开发的10个调试技巧

    最近碰巧读了Ivan Shcherbakov写的一篇文章,<11个强大的Visual Studio调试小技巧>.这篇文章只介绍了一些有关Visual Studio的基本调试技巧,但是还有其 ...

  8. Intel VT学习笔记(五)—— 调试技巧

    Intel VT学习笔记(五)-- 调试技巧 要点回顾 INT 3失效 调试技巧 参考资料 要点回顾 在上一篇中,我们主要学习了如何填写Guest state fields的各项字段,以及如何对错误码 ...

  9. Flutter调试技巧总结——高效开发的秘密

    刚开始学前端的时候看到大家都是用的console.log()作为调试的手段,也可以说,很多人只会用console.log().在学习Flutter开发app的时候,我就在思考,除了使用print()来 ...

最新文章

  1. Linux文件系统的组成部分
  2. 现在的编译器还需要手动展开循环吗_DSP(知识点+思考题)
  3. Java EE重新审视设计模式:异步
  4. UVA 11584—— Partitioning by Palindromes
  5. python文本特征选择,机器学习--特征选择(Python实现)
  6. scala 类中的对象是类_Scala类和对象– Singleton对象,伴侣类
  7. 加密方式(包括MD5 base64 对称加密 非对称加密简介)
  8. Selenium爬虫 -- 用户动态数据爬取
  9. python实现逆序输出一个数字
  10. Chrome谷歌离线安装包下载
  11. iptables中DNAT、SNAT和MASQUERADE
  12. 48 个无版权素材网站收好,以后不怕视觉中国的律师函
  13. CnOpenData中国理财产品数据
  14. Android学习笔记--Notification(通知)
  15. JS入门笔记九:循环精灵图案例
  16. 公式图片转latex神器Mathpix以及latex公式与word公式的相互转换
  17. allergro音乐术语什么意思_音乐术语大全
  18. 学习算法笔记(12)
  19. Flash AS3.0实战
  20. C#中Guid.ToString (String)五种格式,以及将32位的GUID转为16位及其他格式

热门文章

  1. 解析word公式的解决方案(office插入和wps插入不同的解决方案)
  2. 消息号 KD522,为结算凭证定义号码范围
  3. GlusterFS:统一命名空间(Unify)源码分析
  4. Docker 进阶篇
  5. JAVA微信小程序美食菜谱系统毕业设计 开题报告
  6. php实现联系客服(在线咨询)
  7. MongoDB 官方文档学习笔记(一):概述、数据库、集合、视图及定容集合
  8. JavaCV的摄像头实战之十二:性别检测
  9. Excel如何快速统计某班级男生和女生人数
  10. 苹果怎么应用分身_在苹果商店App Store中购买的应用项目怎么申请退款方法