当前位置:   article > 正文

1. 数字mic驱动分析_数字mic clock

数字mic clock

一般遇到的音频硬件都是这样的

由于项目不需要播放只需要录音,于是将模拟的mic换成了数字mic,直接通过i2s连接到soc

由于还要使用alsa架构进行录音,所以这里不能简单的写个代码读i2s数据,需要虚拟出一个codec

 

 上面就是我们这次要分析的数字mic驱动

ALSA架构中有machine,codec,platform的概率

这里可以简单的认为

codec这里就是数字mic

platform指rk的i2s以及dma

machine则是将上面2个关联起来

这3者的dts配置如下,注意这里基于rv1126平台,linux4.19.111

  1. digital_mic: digital-mic {
  2. status = "okay";
  3. compatible = "simple-audio-card";
  4. simple-audio-card,format = "i2s";
  5. simple-audio-card,mclk-fs = <256>;
  6. simple-audio-card,name = "digital-mic";
  7. simple-audio-card,cpu {
  8. sound-dai = <&i2s0_8ch>;
  9. };
  10. simple-audio-card,codec {
  11. sound-dai = <&dummy_codec>;
  12. };
  13. };
  14. i2s0_8ch: i2s@ff800000 {
  15. compatible = "rockchip,rv1126-i2s-tdm";
  16. reg = <0xff800000 0x1000>;
  17. interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
  18. clocks = <&cru MCLK_I2S0_TX>, <&cru MCLK_I2S0_RX>, <&cru HCLK_I2S0>;
  19. clock-names = "mclk_tx", "mclk_rx", "hclk";
  20. dmas = <&dmac 20>, <&dmac 19>;
  21. dma-names = "tx", "rx";
  22. resets = <&cru SRST_I2S0_TX_M>, <&cru SRST_I2S0_RX_M>;
  23. reset-names = "tx-m", "rx-m";
  24. rockchip,cru = <&cru>;
  25. rockchip,grf = <&grf>;
  26. pinctrl-names = "default";
  27. pinctrl-0 = <&i2s0m0_sclk_tx
  28. &i2s0m0_sclk_rx
  29. &i2s0m0_lrck_tx
  30. &i2s0m0_lrck_rx
  31. &i2s0m0_sdi0
  32. &i2s0m0_sdo0
  33. &i2s0m0_sdo1_sdi3
  34. &i2s0m0_sdo2_sdi2
  35. &i2s0m0_sdo3_sdi1>;
  36. status = "disabled";
  37. };
  38. &i2s0_8ch {
  39. status = "okay";
  40. #sound-dai-cells = <0>;
  41. rockchip,clk-trcm = <0>;
  42. rockchip,i2s-rx-route = <0 1 2 3>;
  43. pinctrl-names = "default";
  44. pinctrl-0 = <&i2s0m0_lrck_rx
  45. &i2s0m0_sclk_rx
  46. &i2s0m0_sdi0>;
  47. rockchip,capture-only;
  48. };
  49. dummy_codec: dummy-codec {
  50. compatible = "rockchip,dummy-codec";
  51. #sound-dai-cells = <0>;
  52. };

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/82909
推荐阅读
相关标签
  

闽ICP备14008679号