|
【Linux】
基于RK3288 平台 Simple card声卡添加及调试
发表于 2019-7-31 22:38:19
浏览:6899
|
回复:2
打印
只看该作者
[复制链接]
楼主
本帖最后由 17701603601 于 2019-8-3 11:17 编辑
基于RK3288 平台 Simple card声卡添加及调试
Simple card即简单通用的machine driver, 如果simple-card框架足够满足需求,建议优先使用simple card框架,简单,方便,且易用.
一、 添加声卡
1. 添加codec driver,比如添加:sound/soc/codec/es8323.c
2. 修改sound/soc/codec/Kconfig以及Makefile加入驱动编译。
sound/soc/codec/Kconfig: 添加
select SND_SOC_ES8323 if I2C
config SND_SOC_ES8323
tristate "Everest Semi ES8323 CODEC"
depends on I2C
sound/soc/codec/Makefile: 添加
snd-soc-es8323-objs := es8323.o
obj-$(CONFIG_SND_SOC_ES8323) += snd-soc-es8323.o
3. menuconfig中enable simple card以及codec
make menuconfig Device Drivers ---> Sound card support ---> Advanced Linux Sound Architecture ---> ALSA for SoC audio support ---> ASoC support for Rockchip
CODEC drivers --->
<*> Everest Semi ES8323 CODEC
4. 产品的DTS中添加Simple Card Node
二、修改DTS文件
1 添加sound card 和 spdif(可选添加,用不到不用添加)
2 添加:&i2c2(es8323 mclk)和&i2s(es8323 I2S通信)
3 添加&sound
注意,需要增加内容如下:
{\
sound: sound {
status = "okay";
compatible = "simple-audio-card";
simple-audio-card,format = "i2s";
simple-audio-card,name = "rockchip,firefly-codec";
simple-audio-card,mclk-fs = <512>;
simple-audio-card,widgets =
"Microphone", "Microphone Jack",
"Headphone", "Headphone Jack";
simple-audio-card,routing =
"MIC1", "Microphone Jack",
"MIC2", "Microphone Jack",
"Microphone Jack", "micbias1",
"Headphone Jack", "HPOL",
"Headphone Jack", "HPOR";
simple-audio-card,dai-link@0 {
format = "i2s";
cpu {
sound-dai = <&i2s>;
};
codec {
sound-dai = <&es8323>;
};
};
simple-audio-card,dai-link@1 {
format = "i2s";
cpu {
sound-dai = <&i2s>;
};
codec {
sound-dai = <&hdmi>;
};
};
};
spdif_out: spdif-out {
status = "okay";
compatible = "linux,spdif-dit";
#sound-dai-cells = <0>;
};
spdif-sound {
status = "okay";
compatible = "simple-audio-card";
simple-audio-card,name = "ROCKCHIP,SPDIF";
simple-audio-card,cpu {
sound-dai = <&spdif>;
};
simple-audio-card,codec {
sound-dai = <&spdif_out>;
};
}
&i2c2 {
status = "okay";
es8323: es8323@10 {
status = "okay";
compatible = "everest,es8323";
reg = <0x10>;
spk-con-gpio = <&gpio5 12 GPIO_ACTIVE_LOW>;
// hp-det-gpio = <&gpio7 15 GPIO_ACTIVE_LOW>;
clock-names = "mclk";
clocks = <&cru SCLK_I2S0_OUT>;
pinctrl-names = "default";
pinctrl-0 = <&i2s0_mclk>;
#sound-dai-cells = <0>;
};
};
需要注意的是,如上es8323的clocks即mclk, upstream代码遵循谁使用clk谁申请的原则,所以后续自己添加的codec driver,如果有使用
外部clk作为mclk,需要做同样的适配。
&i2s {
#sound-dai-cells = <0>;
status = "okay";
};
&sound {
status = "okay";
};
注意要去掉以下内容,否则声卡驱动无法挂载
&es8323 {
// aux-det-gpio = <&gpio2 15 GPIO_ACTIVE_HIGH>;
spk-ctl-gpio = <&gpio7 2 GPIO_ACTIVE_HIGH>;
};
三、总结
1 屏幕不亮的问题
调试中发现屏幕 背光是亮的,但是屏幕不亮,把vcc_sys_5v: vcc-sys-5v,gpio GPIO0_B5 修改为GPIO7_A3屏幕就亮了。
如下所示:
vcc_sys_5v: vcc-sys-5v{
compatible = "regulator-fixed";
enable-active-high;
gpio = <&gpio7 3 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
pinctrl-0 = <&pwr5v_en>;
regulator-name = "vcc_sys_5v";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
regulator-always-on;
regulator-boot-on;
};
vcc-sys {
pwr5v_en: pwr5v-en {
rockchip,pins = <7 3 RK_FUNC_GPIO &pcfg_output_high>;
};
};
2 调试中声卡总是挂载不上去:在dts中去掉以下内容后就可以了。因为在I2C2中已经设置过
&es8323 {
// aux-det-gpio = <&gpio2 15 GPIO_ACTIVE_HIGH>;
spk-ctl-gpio = <&gpio7 2 GPIO_ACTIVE_HIGH>;
}; |
|