We have custom board based on sabresd, with wm8960 chip connected to i2c2 and audmux3, and there is also gpio 5 muxed to be clko (MX6Q_PAD_GPIO_5__CCM_CLKO) and connected to wm8960 MCLK pin.
Audio is working with old kernel, but we can't make it work on new 3.14 with device tree.
Here is relevant code from DT:
sound {
compatible = "ray,imx6dl-stevie-wm8960",
"fsl,imx-audio-wm8960";
model = "wm8960-audio";
cpu-dai = <&ssi1>;
audio-codec = <&codec>;
codec-master;
mux-int-port = <2>;
mux-ext-port = <3>;
// asrc-controller = <&asrc>;
audio-routing =
"SPK_RN", "Right Speaker Output",
"SPK_RP", "Right Speaker Output",
"LINPUT1", "Main MIC",
"Main MIC", "MICB";
};
&audmux {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_audmux>;
status = "okay";
};
codec: wm8960@1a {
compatible = "wlf,wm8960";
reg = <0x1a>;
clocks = <&clks 201>;
clock-names = "mclk";
wlf,shared-lrclk;
};
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
>;
};
This is current behavior:
It prints the device correctly:
ALSA device list:
#0: wm8960-audio
Driver probe function is called and it prints:
imx-wm8960 sound.22: wm8960-hifi <-> 2028000.ssi mapping ok
But then when it tries to play audio file, function imx_hifi_startup returns -EBUSY each time.
In old kernel we had this code for clock setup:
clko = clk_get(NULL, "clko_clk");
rate = clk_round_rate(clko, 24000000);
clk_set_rate(clko, rate);
wm8960_pdata.sysclk = rate;
How to define MX6Q_PAD_GPIO_5__CCM_CLKO in Device Tree and how to mux correct clock to this pin for wm8960?
seems you used imx7d-sdb board configs, it has wm8960 and sai.
Also sai does not use audmux, audmux is used only with ssi.
I see that WM8960 driver in FSL kernel is depending on SAI, is there any other driver for WM8960 that uses SSI?
No I just checked them out, but couldn't/didn't use sai.
The config in DT is set like at the begining of this thread, ssi and audmux.
Hi Petar
clko clock is configured in clk-imx6q.c
linux-2.6-imx.git - Freescale i.MX Linux Tree
regarding dts file, one can check clko settings, like:
&iomuxc {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_hog>;
imx6qdl-sabresd {
pinctrl_hog: hoggrp {
fsl,pins = <
..
MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x130b0
linux-2.6-imx.git - Freescale i.MX Linux Tree
also it may be helpful to check attached Linux Manual Chapter 29
for description of wm8960 driver.
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi thank you for your reply, I added hog pin control to iomuxc with clko like this:
pinctrl_hog: hoggrp {
fsl,pins = <
MX6QDL_PAD_GPIO_5__CCM_CLKO1 0x0001b0b0
>;
};
but it didnt help. The error Im getting is related to stream allocation in imx_hifi_startup function. There is comparison of two fields in two structures:
struct fsl_sai *sai = dev_get_drvdata(cpu_dai->dev);
struct imx_wm8960_data *data = snd_soc_card_get_drvdata(card);
I noticed that cpu_dai in my DT is defined as <&ssi1>, not sai.
Please note Im using wm8960 not wm8962. I found that imx7d-sdb.dts for example is using wm8960 and there it defines cpu_dai as <&sai1>.
So my question is can I use ssi or sai equally, or it depends on hardware implementation?
Is wm8960 made to work only with SAI, and I have to change the driver to make it work with SSI, or do I just change DT to use sai?
ssi and sai are quite different interfaces and use
different drivers and configurations.
~igor
according to my old kernel config and hardware schematics, it seems like we were using ssi, and that is how DT is configured. so what do you think about this error in wm8960 driver related to sai? how do I go about fixing that?
Hi,Petar
I met the same problem , can you tell me the solution?
thank you
We didnt solved it.
This can work normally to wm8960?