赞
踩
本文介绍rk3588平台DMIC的配置;首先了解下,常见的数字麦有纯pdm麦和通过一些codec芯片将数字麦转换为i2s信号输入到SOC;纯pdm麦就是直接进入SOC的pdm接口,走的是PDM信号,原理图如下所示;PDM信号就是两个线,一根数据线一根时钟线。
阵列麦是PDM麦常见的形式,如下原理图;纯pdm麦的dts配置需要使用dummy_codec,内核要打开CONFIG_SND_SOC_DUMMY_CODEC=y;dts配置可以参考如下
- sound_micarray: sound-micarray {
- compatible = "simple-audio-card";
- simple-audio-card,format = "i2s";
- simple-audio-card,name = "rockchip,sound-micarray";
- simple-audio-card,mclk-fs = <256>;
- simple-audio-card,dai-link@0 {
- format = "pdm";
- cpu {
- sound-dai = <&pdm0>;
- };
- codec {
- sound-dai = <&dummy_codec>;
- };
- };
- };
- pdm有全映射设置,rockchip,path-map = <int int int int>,需要和硬件上接的一致。
使用codec芯片rt5651,es7210等,接入到SOC,即数字MIC,接的引脚是codec芯片上的引脚,不是SOC的PDM;最后转换成i2s信号输入主控。以3588平台为例,数字麦的dts参考如下:
- rt5651_sound: rt5651-sound {
- status = "okay";
- compatible = "rockchip,multicodecs-card";
- rockchip,card-name = "rockchip-rt5651";
- hp-det-gpio = <&gpio1 RK_PC0 GPIO_ACTIVE_HIGH>;
- io-channels = <&saradc 3>;
- io-channel-names = "adc-detect";
- keyup-threshold-microvolt = <1800000>;
- poll-interval = <100>;
- rockchip,format = "i2s"; //通过i2s进入到SOC
- rockchip,mclk-fs = <256>;
- rockchip,cpu = <&i2s0_8ch>;
- rockchip,codec = <&rt5651>;
- pinctrl-names = "default";
- pinctrl-0 = <&hp_det>;
- play-pause-key {
- label = "playpause";
- linux,code = <KEY_PLAYPAUSE>;
- press-threshold-microvolt = <2000>;
- };
- };
-
- rt5651: rt5651@1a {
- status = "okay";
- #sound-dai-cells = <0>;
- compatible = "realtek,rt5651";
- reg = <0x1a>;
- clocks = <&cru I2S0_8CH_MCLKOUT>;
- clock-names = "mclk";
- assigned-clocks = <&cru I2S0_8CH_MCLKOUT>;
- assigned-clock-rates = <11289600>; //mclk
- realtek,dmic-en = "ture"; //数字麦的使能
- };
声卡生成之后,就使用tinycap指定es7210或rt5651声卡进行录音,录音时用示波器测量看看7202的pdm_clk和pdm_sdi是否有波形产生。
如何兼容2个数字麦,即主板自带的一个数字麦+外接小板的数字麦;两个数字麦的clk是不一样的,所以dts怎么配置呢? 在&pdm0节点把两个clk同时配置上就可以了。
- pdm0: pdm@fe4b0000 {
- compatible = "rockchip,rk3588-pdm";
- reg = <0x0 0xfe4b0000 0x0 0x1000>;
- clocks = <&cru MCLK_PDM0>, <&cru HCLK_PDM0>;
- clock-names = "pdm_clk", "pdm_hclk";
- dmas = <&dmac0 4>;
- dma-names = "rx";
- pinctrl-names = "default";
- pinctrl-0 = <&pdm0m0_clk //板载数字麦时钟
- &pdm0m0_clk1 //外接数字麦时钟
- &pdm0m0_sdi0
- &pdm0m0_sdi1
- &pdm0m0_sdi2>;
- #sound-dai-cells = <0>;
- status = "disabled";
- };
多个数字麦怎么录音呢?同一组pdm,录音时去设置通道就行了,直接tinycap +通道2/4/6/8。例如下面这个,硬件上看PDM_SDI0_M0接在809,PDM_SDI1_M0接在es7202,PDM_SDI2_M0接在es7202;所以总共可以录6路,使用tinycap直接录6通道就可以了,其中:
PDM_SDI0_M0管脚是0-1通道,
PDM_SDI1_M0管脚是2-3通道,
PDM_SDI2_M0管脚是4-5通道。
PDM_SDI0_M0是接在RK809上的,所以0-1通道就是它的数据。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。