Hello Wu,
WM8960的driver在linux BSP 4.1.15里面支持的。但是是for I.MX6UL的,如果你使用I.MX6Q/D/DL/S的话,你需要在dts和driver上做一些修改才能使用,因为I.MX6UL使用SAI音频,I.MX6Q/D/DL/S使用SSI I2S接口。
Have a nice day!
TIC Weidong Sun
Dear Weidong,
你好,使用的是I.MX6Q,还需要做哪些修改?有补丁吗?在设备树树中
sound {
compatible = "fsl,imx6q-tqcorec-wm8960",
"fsl,imx6q-audio-wm8960";
model = "wm8960-audio";
cpu-dai = <&ssi2>;
audio-codec = <&codec>;
asrc-controller = <&asrc>;
codec-master;
/*
hp-det = <hp-det-pin hp-det-polarity>;
hp-det-pin: JD1 JD2 or JD3
hp-det-polarity = 0: hp detect high for headphone
hp-det-polarity = 1: hp detect high for speaker
*/
hp-det = <1 0>;
//hp-det-gpios = <&gpio3 31 1>;
//mic-det-gpios = <&gpio3 31 1>;
audio-routing =
"Headphone Jack", "HP_L",
"Headphone Jack", "HP_R",
"Ext Spk", "SPK_LP",
"Ext Spk", "SPK_LN",
"Ext Spk", "SPK_RP",
"Ext Spk", "SPK_RN",
"LINPUT2", "Mic Jack",
"LINPUT3", "Mic Jack",
"RINPUT1", "Main MIC",
"RINPUT2", "Main MIC",
"Mic Jack", "MICB",
"Main MIC", "MICB",
"CPU-Playback", "ASRC-Playback",
"Playback", "CPU-Playback",
"ASRC-Capture", "CPU-Capture",
"CPU-Capture", "Capture";
mux-int-port = <2>;
mux-ext-port = <3>;
};
&ssi2 {
fsl,mode = "i2s-slave";
status = "okay";
};
&i2c1 {
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c1>;
status = "okay";
codec: wm8960@1a {
compatible = "wlf,wm8960";
reg = <0x1a>;
clocks = <&clks IMX6QDL_CLK_CKO>;
clock-names = "mclk";
wlf,shared-lrclk;
};
};
在imx-wm8960.c
#include "../codecs/wm8960.h"
//#include "fsl_sai.h"
#include "imx-audmux.h“
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;
}
*/