[RK3588-Android12] 关于ES8388 喇叭+PDM回采 4+2配置

问题描述:

ES8388 喇叭+PDM回采 4+2配置如下:


解决方案:

c 复制代码
	// MIC
	pdmics: dummy-codec {
		status = "okay";
		compatible = "rockchip,dummy-codec";
		#sound-dai-cells = <0>;
	};

	// MIC
	pdm_mic_array: pdm-mic-array {
		status = "okay";
		compatible = "simple-audio-card";
		simple-audio-card,name = "rockchip,pdm-mic-array";
		simple-audio-card,cpu {
			sound-dai = <&pdm0>;
		};
		simple-audio-card,codec {
			sound-dai = <&pdmics>;
		};
	};

	// 声卡ES8388
	es8388_sound: es8388-sound {
		status = "okay";
		compatible = "rockchip,multicodecs-card";
		rockchip,card-name = "rockchip-es8388";
		// hp-det-gpio = <&gpio1 RK_PC4 GPIO_ACTIVE_HIGH>;
		io-channels = <&saradc 3>;
		io-channel-names = "adc-detect";
		keyup-threshold-microvolt = <1800000>;
		poll-interval = <100>;
		// SPK_CTL_H 喇叭脚自行配置
		spk-con-gpio = <&gpioX RK_PXX GPIO_ACTIVE_HIGH>;
		// 耳机控制GPIO
		// hp-con-gpio = <&gpio4 RK_PA7 GPIO_ACTIVE_HIGH>;
		linein-type = <0>;
		rockchip,format = "i2s";
		rockchip,mclk-fs = <256>;
		rockchip,cpu = <&i2s0_8ch>;
		rockchip,codec = <&es8388>;
		rockchip,audio-routing =
			"Headphone", "LOUT1",
			"Headphone", "ROUT1",
			"Speaker", "LOUT2",
			"Speaker", "ROUT2",
			"Headphone", "Headphone Power",
			"Headphone", "Headphone Power",
			"Speaker", "Speaker Power",
			"Speaker", "Speaker Power",
			"LINPUT1", "Main Mic",
			"LINPUT2", "Main Mic",
			"RINPUT1", "Headset Mic",
			"RINPUT2", "Headset Mic";
		// pinctrl-names = "default";
		// pinctrl-0 = <&es_det>;
		play-pause-key {
			label = "playpause";
			linux,code = <KEY_PLAYPAUSE>;
			press-threshold-microvolt = <2000>;
		};
	};

&i2c7 {
	status = "okay";

	//这里需要根据新老SDK配置 clock部分的配置不一样
	//新SDK如下
	es8388: es8388@11 {
		status = "okay";
		#sound-dai-cells = <0>;
		compatible = "everest,es8388", "everest,es8323";
		reg = <0x11>;
		clocks = <&mclkout_i2s0>;
		clock-names = "mclk";
		assigned-clocks = <&mclkout_i2s0>;
		assigned-clock-rates = <12288000>;
		pinctrl-names = "default";
		pinctrl-0 = <&i2s0_mclk>;
	};
	//旧SDK如下
	es8388: es8388@11 {
		status = "disabled";
		#sound-dai-cells = <0>;
		compatible = "everest,es8388", "everest,es8323";
		reg = <0x11>;
		clocks = <&cru I2S0_8CH_MCLKOUT>;
		clock-names = "mclk";
		assigned-clocks = <&cru I2S0_8CH_MCLKOUT>;
		assigned-clock-rates = <12288000>;
		pinctrl-names = "default";
		pinctrl-0 = <&i2s0_mclk>;
};

// 根据原理图自行配置clk 和sdi通路 有几路配置几路
&pdm0 {
	status = "okay";
	// 通道顺序 自行配置
	//rockchip,path-map = <0 1 2 3>;
	pinctrl-names = "default";
	pinctrl-0 = <&pdm0m0_clk1
		     &pdm0m0_sdi0  &pdm0m0_sdi2>;
};

使用查看声音命令 cat /proc/asound/cards 如下

如声卡未能注册成功,自行使用 dmesg | grep pdm 检查相关声音注册是否有报错,需要注意pdm的sdio脚是否有复用,如果复用需要去除。

以上声卡注册成功后,使用命令进行录音采集。因为回采使用系统的录音应用是录制不到声音的。

使用 tinycap /mnt/rec.wav -D 1 -d 0 --c 4 对声卡1进行声音录制。

使用adb pull /mnt/rec.wav E:\ 将声音转出

最后使用电脑端的Audacity软件播放声音查看声道如下:

这里可以看到声音被正常录制到,左右声道正常。


相关推荐
兵哥工控4 分钟前
MFC工控项目实例二十九主对话框调用子对话框设定参数值
c++·mfc
我爱工作&工作love我12 分钟前
1435:【例题3】曲线 一本通 代替三分
c++·算法
枯骨成佛32 分钟前
Android中Crash Debug技巧
android
娃娃丢没有坏心思41 分钟前
C++20 概念与约束(2)—— 初识概念与约束
c语言·c++·现代c++
lexusv8ls600h42 分钟前
探索 C++20:C++ 的新纪元
c++·c++20
lexusv8ls600h1 小时前
C++20 中最优雅的那个小特性 - Ranges
c++·c++20
白-胖-子1 小时前
【蓝桥等考C++真题】蓝桥杯等级考试C++组第13级L13真题原题(含答案)-统计数字
开发语言·c++·算法·蓝桥杯·等考·13级
好睡凯1 小时前
c++写一个死锁并且自己解锁
开发语言·c++·算法
依旧阳光的老码农2 小时前
标准C++ 字符串
开发语言·c++
白-胖-子2 小时前
【蓝桥等考C++真题】蓝桥杯等级考试C++组第13级L13真题原题(含答案)-成绩排序
c++·算法·蓝桥杯·真题·蓝桥等考