大家好,我用的是sabresd-6dl平台,在移植wm8960出现了下列问题,希望得到大家的帮助,先谢过了
imx6qdl-sabresd.dtsi配置如下:
sound {
compatible = "fsl,imx-audio-wm8960";
model = "wm8960-audio";
cpu-dai = <&ssi2>;
audio-codec = <&codec>;
codec-master;
gpr = <&gpr>;
audio-routing =
"Headset Jack", "HP_L",
"Headset Jack", "HP_R",
"LINPUT1", "Main MIC",
"LINPUT3", "Main MIC",
"RINPUT1", "Main MIC",
"RINPUT3", "Main MIC",
"Main MIC", "MICB";
mux-int-port = <2>;
mux-ext-port = <3>;
status = "okay";
};
codec: wm8960@1a {
compatible = "wlf,wm8960";
reg = <0x1a>;
clocks = <&clks 201>;
clock-names = "mclk";
clock-frequency = <12000000>;
wlf,shared-lrclk;
};
&ssi2 {
fsl,mode = "i2s-slave";
status = "okay";
};
其他没做文件没做任何修改,开机打印信息如下:
root@sabresd_6dq:/ # dmesg | grep wm
<5> lowmem : 0xc0000000 - 0xef000000 ( 752 MB)
<6>wm8962-supply: no parameters
<4>pwm-backlight.25 supply power not found, using dummy regulator
<6>imx-wm8960 sound.21: wm8960-hifi <-> 202c000.ssi mapping ok
<6>wm8962-supply: disabling
<6> #0: wm8960-audio
而且一直打印下列错误
ASoC: HiFi startup failed: -16
ASoC: HiFi startup failed: -16
ASoC: HiFi startup failed: -16
ASoC: HiFi startup failed: -16
ASoC: HiFi startup failed: -16
ASoC: HiFi startup failed: -16
Hello,
按照出错的LOG,应该来自imx-wm8960.C文件中,参数初始化时就没有通过。那么问题可能出在CPU端I2S有关的代码中。所以请检查一下:
(1)AUD3复用部分代码是不是对的。
(2)这里的cpu_dai好像不对:
imx6qdl-sabresd.dtsi配置如下:
sound {
... ...
cpu-dai = <&ssi2>; //请修改为 cpu-dai = <&ssi1>
... ...
(3)WM8960 MCLK的问题
从你的代码中,你采用的12MHz(我做过试验12MHZ是可以使用的),但是24MHz时钟也是可以的。这里要注意的是:采用不同的MCLK时,从MCLK输入,经过PLL,直至得到sysclk(bit_clock)是不一样的配置,所以要注意一下驱动中的配置方式。
Best Regards,
Weidong
Hi,Weidong
非常感谢你的回复,我追踪了下错误的出处,的确是来自imx-wm8960.c中的imx-hifi-startup函数
static int imx_hifi_startup(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_soc_card *card = codec_dai->codec->card;
struct imx_wm8960_data *data = snd_soc_card_get_drvdata(card);
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
struct fsl_sai *sai = dev_get_drvdata(cpu_dai->dev);
int ret = 0;
data->is_stream_opened[tx] = true;
if (data->is_stream_opened[tx] != sai->is_stream_opened[tx] ||
data->is_stream_opened[!tx] != sai->is_stream_opened[!tx]) {
data->is_stream_opened[tx] = false;
return -EBUSY;
}
.......
}
(1)AUD3复用部分代码
pinctrl_audmux: audmuxgrp {
fsl,pins = <
MX6QDL_PAD_CSI0_DAT7__AUD3_RXD 0x130b0
MX6QDL_PAD_CSI0_DAT4__AUD3_TXC 0x130b0
MX6QDL_PAD_CSI0_DAT5__AUD3_TXD 0x110b0
MX6QDL_PAD_CSI0_DAT6__AUD3_TXFS 0x130b0
>;
};
(2)这里的cpu_dai设置cpu-dai = <&ssi1>
(3)WM8960 MCLK不指定12M
MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x130b0
经上面三个步骤确认修改,重新编译下载镜像,结果还是一样,在论坛我看到一个同样问题的帖子
https://community.nxp.com/message/642991#comment-642991
但也没人给出正确的回复,希望得到你的帮助,谢谢
问题解决了吗?我也遇到同样的问题!!
能把解决方法说一下吗?