[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软件播放声音查看声道如下:

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


相关推荐
咔咔咔的34 分钟前
1847. 最近的房间
c++
Gpluso_od1 小时前
算法常用库函数——C++篇
数据结构·c++·算法
m0_748256144 小时前
【全栈开发】----用pymysql库连接MySQL,批量存入
android·数据库·mysql
思麟呀4 小时前
在C语言基础上的C++第二章(类和对象)
c语言·开发语言·c++·学习
hjxxlsx5 小时前
备战 C++ 编程区赛 指南
开发语言·数据结构·c++·算法·贪心算法·区赛
酷酷的崽7985 小时前
【递归与回溯深度解析:经典题解精讲(中篇)】—— LeetCode
c++·算法·leetcode
aaajj5 小时前
[Android]init中添加新的command
android
暗碳5 小时前
安卓/system/bin下命令中文说明(AI)
android
励志成为大佬的小杨6 小时前
初始c语言第一个c语言项目
c语言·c++·算法
和小潘一起学AI6 小时前
c++基于过程
开发语言·c++