|
kernel4.4.55内核的音频es8323驱动调试及dts配置
发表于 2017-7-30 18:16:12
浏览:38107
|
回复:18
打印
只看该作者
[复制链接]
楼主
本帖最后由 luwanjia 于 2017-7-31 20:14 编辑
以下是本人的调试经过,请指导!(刚接触linux驱动开发,对内核框架不熟悉,请各位指导,万分感谢!)
1. 调试环境
内核:https://gitlab.com/TeeFirefly/linux-kernel.git firefly分支
配置:rockchip_linux_defconfig
dts:rk3288-firefly-lvds.dts
$export ARCH=arm
$export CROSS_COMPILE=arm-eabi-
$make rockchip_linux_defconfig
$make rk3288-firefly-lvds.img -j4
2. 问题描述
1> 修改dts,如下git diff arch/arm/boot/dts/rk3288-firefly.dtsi:
- diff --git a/arch/arm/boot/dts/rk3288-firefly.dtsi b/arch/arm/boot/dts/rk3288-firefly.dtsi
- index 1650f98455e2..9888f0816265 100644
- --- a/arch/arm/boot/dts/rk3288-firefly.dtsi
- +++ b/arch/arm/boot/dts/rk3288-firefly.dtsi
- @@ -41,7 +41,6 @@
- */
-
- #include "rk3288.dtsi"
- -
- / {
- memory {
- device_type = "memory";
- @@ -171,10 +170,30 @@
-
- sound {
- compatible = "simple-audio-card";
- - simple-audio-card,name = "SPDIF";
- + simple-audio-card,format = "i2s";
- + simple-audio-card,name = "rockchip,rockchip-codec";
- + simple-audio-card,mclk-fs = <512>;
- +
- + simple-audio-card,dai-link@0 {
- + format = "i2s";
- + cpu {
- + sound-dai = <&i2s>;
- + };
- + codec {
- + sound-dai = <&hdmi>;
- + };
- +
- + };
- +
- simple-audio-card,dai-link@1 {
- - cpu { sound-dai = <&spdif>; };
- - codec { sound-dai = <&spdif_out>; };
- + format = "i2s";
- + cpu {
- + sound-dai = <&i2s>;
- + };
- +
- + codec {
- + sound-dai = <&es8323>;
- + };
- };
- };
-
- @@ -285,6 +304,21 @@
- WIFI,host_wake_irq = <&gpio4 30 GPIO_ACTIVE_HIGH>;
- status = "okay";
- };
- + rockchip-es8323 {
- + compatible = "rockchip-es8323";
- + dais {
- + dai0 {
- + audio-codec = <&es8323>;
- + audio-controller = <&i2s>;
- + format = "i2s";
- + //continuous-clock;
- + //bitclock-inversion;
- + //frame-inversion;
- + //bitclock-master;
- + //frame-master;
- + };
- + };
- + };
- };
-
- &cpu0 {
- @@ -495,6 +529,14 @@
-
- &i2c2 {
- status = "okay";
- + es8323: es8323@10 {
- + compatible = "everest,es8323";
- + reg = <0x10>;
- + hp-det-gpio = <&gpio5 19 GPIO_ACTIVE_HIGH>;
- + clock-names = "mclk";
- + clocks = <&cru SCLK_I2S0_OUT>;
- + #sound-dai-cells = <0>;
- + };
- };
-
- &i2c4 {
复制代码
2> 修改sound/soc/rockchip/card_info.c,这里不改编译不过
- diff --git a/sound/soc/rockchip/card_info.c b/sound/soc/rockchip/card_info.c
- index fced8016c66c..7e1d3a1e45d1 100755
- --- a/sound/soc/rockchip/card_info.c
- +++ b/sound/soc/rockchip/card_info.c
- @@ -62,6 +62,8 @@ int rockchip_of_get_sound_card_info_(struct snd_soc_card *card,
- bool is_need_fmt)
- {
- struct device_node *dai_node, *child_dai_node;
- + struct device_node *bitclkmaster = NULL;
- + struct device_node *framemaster = NULL;
- int dai_num;
-
- dai_node = of_get_child_by_name(card->dev->of_node, "dais");
- @@ -76,7 +78,8 @@ int rockchip_of_get_sound_card_info_(struct snd_soc_card *card,
- for_each_child_of_node(dai_node, child_dai_node) {
- if (is_need_fmt) {
- card->dai_link[dai_num].dai_fmt =
- - snd_soc_of_parse_daifmt(child_dai_node, NULL);
- + snd_soc_of_parse_daifmt(child_dai_node, NULL,
- + &bitclkmaster, &framemaster);
- if ((card->dai_link[dai_num].dai_fmt &
- SND_SOC_DAIFMT_MASTER_MASK) == 0) {
- dev_err(card->dev,
复制代码
3> 修改sound/soc/rockchip/rk_es8323.c,这里都是无效的修改,略过。
- diff --git a/sound/soc/rockchip/rk_es8323.c b/sound/soc/rockchip/rk_es8323.c
- index 1cbb4448bec3..31091512f971 100755
- --- a/sound/soc/rockchip/rk_es8323.c
- +++ b/sound/soc/rockchip/rk_es8323.c
- @@ -116,8 +116,7 @@ static const struct snd_soc_dapm_route audio_map[]= {
- static int rk29_es8323_init(struct snd_soc_pcm_runtime *rtd)
- {
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
- - struct snd_soc_codec *codec = rtd->codec;
- - struct snd_soc_dapm_context *dapm = &codec->dapm;
- +
- int ret;
-
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
- @@ -128,19 +127,7 @@ static int rk29_es8323_init(struct snd_soc_pcm_runtime *rtd)
- printk(KERN_ERR "Failed to set es8323 SYSCLK: %d\n", ret);
- return ret;
- }
- -
- - /* Add specific widgets */
- -#if 0
- - snd_soc_dapm_new_controls(dapm, rk29_dapm_widgets,
- - ARRAY_SIZE(rk29_dapm_widgets));
- - //snd_soc_dapm_nc_pin(codec, "LOUT2");
- - //snd_soc_dapm_nc_pin(codec, "ROUT2");
- -
- - /* Set up specific audio path audio_mapnects */
- - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
- -
- - snd_soc_dapm_sync(dapm);
- -#endif
- +
- return 0;
- }
-
复制代码
4> 修改sound/soc/soc-core.c,这里是调试时发现的问题,无法找到es8323的驱动,提示cpu_name = (null), cpu_dai_name = (null),不知道哪里没有修改正确。
- diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
- index 251a7e8670b7..4e14de311ec8 100644
- --- a/sound/soc/soc-core.c
- +++ b/sound/soc/soc-core.c
- @@ -923,6 +923,7 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)
-
- dev_dbg(card->dev, "ASoC: binding %s at idx %d\n", dai_link->name, num);
-
- + printk("!!! ASoC: dai_link->name = %s, dai_link->cpu_name = %s, dai_link->cpu_dai_name = %s\n", dai_link->name, dai_link->cpu_name, dai_link->cpu_dai_name);
- cpu_dai_component.name = dai_link->cpu_name;
- cpu_dai_component.of_node = dai_link->cpu_of_node;
- cpu_dai_component.dai_name = dai_link->cpu_dai_name;
- @@ -1558,6 +1559,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
- mutex_lock_nested(&card->mutex, SND_SOC_CARD_CLASS_INIT);
-
- /* bind DAIs */
- + printk("!!! snd_soc_instantiate_card: card->num_links = %d\n", card->num_links);
- for (i = 0; i < card->num_links; i++) {
- ret = soc_bind_dai_link(card, i);
- if (ret != 0)
复制代码
5> 完整diff文件是
gitdiff.tar
(10 KB, 下载次数: 13)
6> Log提示如图,Log文件是
minicom.tar
(60 KB, 下载次数: 6)
请各位大虾帮忙看看,或者你们你们哪位有现成的代码能给我一份么?万分感谢!
大家的RK3288开发板都有声音输出吗?怎么没有看到谁提出这个问题?es8323的驱动官方都不维护了吗?内核升级了,驱动居然不改!
以上
----------------------------------------------------------------------------------------------
联系方式:luwanjia@aliyun.com
|
|