系统linux 3.14,设备树文件如下,电路上将一个wm8960断开,另一个声卡能正常工作。但是当两个都挂载时都不能工作,请问应该怎么设置?
sound@0 {
compatible = "fsl,imx6ul-evk-wm8960",
"fsl,imx-audio-wm8960";
model = "wm8960-audio";
cpu-dai = <&sai1>;
audio-codec = <&codec_2>;
asrc-controller = <&asrc>;
codec-master;
gpr = <&gpr>;
audio-routing =
"Headset Jack", "HP_L",
"Headset Jack", "HP_R",
"LINPUT1", "Main MIC",
"CPU-Playback", "ASRC-Playback",
"Playback", "CPU-Playback",
"ASRC-Capture", "CPU-Capture",
"CPU-Capture", "Capture";
};
sound@1 {
compatible = "fsl,imx6ul-evk-wm8960",
"fsl,imx-audio-wm8960";
model = "wm8960-audio";
cpu-dai = <&sai2>;
audio-codec = <&codec_1>;
asrc-controller = <&asrc>;
codec-master;
gpr = <&gpr>;
audio-routing =
"Headset Jack", "HP_L",
"Headset Jack", "HP_R",
"LINPUT1", "Main MIC",
"CPU-Playback", "ASRC-Playback",
"Playback", "CPU-Playback",
"ASRC-Capture", "CPU-Capture",
"CPU-Capture", "Capture";
};
&i2c1 {
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c1>;
status = "okay";
codec_1:wm8960@1a{
compatible = "wlf,wm8960";
reg = <0x1a>;
clocks = <&clks IMX6UL_CLK_SAI1>;
clock-names = "mclk";
wlf,shared-lrclk;
};
};
&i2c2 {
clock_frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c2>;
status = "okay";
codec_2:wm8960@1a{
compatible = "wlf,wm8960";
reg = <0x1a>;
clocks = <&clks IMX6UL_CLK_SAI2>;
clock-names = "mclk";
wlf,shared-lrclk;
};
};
&sai1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai1>;
assigned-clocks = <&clks IMX6UL_CLK_SAI1_SEL>,
<&clks IMX6UL_CLK_SAI1>;
assigned-clock-parents = <&clks IMX6UL_CLK_PLL4_AUDIO_DIV>;
assigned-clock-rates = <0>, <12288000>;
status = "okay";
};
&sai2 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai2>;
assigned-clocks = <&clks IMX6UL_CLK_SAI2_SEL>,
<&clks IMX6UL_CLK_SAI2>;
assigned-clock-parents = <&clks IMX6UL_CLK_PLL4_AUDIO_DIV>;
assigned-clock-rates = <0>, <12288000>;
status = "okay";
};
Hi,
理论上,I.MX6UL的SAI1和SAI2各接一个codec是允许的。
但是,你使用的都是WM8960 codec,那么它们就会加载相同的Machine driver,因此,你需要注意的是在imx-wm8960.c文件中,包含了对MIC & HP的控制,包含了对MCLK的控制。对于你的2个WM8960来说,电路上是不同的,特别是MIC & HP的GPIO控制。
因此,你不能直接使用默认BSP里提供的imx-wm8960.c,你需要针对你的应用对它进行代码上的调整,以区分针对哪个WM8960进行驱动。
希望上述建议对你有帮助!
Have a great day,
TIC Weidong sun
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
你好,感谢你的回复,目前codec没有使用io检测功能,电路上通道是固定的,不需要考虑通道切换的问题。您提到的修改imx-wm8960.c有相关例子吗?没有接触过相关方面的
还没有处理好吗?
最简单的办法,你用2个Machine driver,虽然都是wm8960的,但是你可以用不同的driver name来区分。
比如一个用imx-wm8960-sai1.c ,一个imx-wm8960-sai2.c,在各自的里面把driver的名字修改为不同。
Weidong
孙工,您好~
就这个双声卡的问题请教下。
因为我这边现在也在做一个双声卡的项目,不过我的codec不是wm8960,用的是TI的TLV320ADC6140。
我现在按照你说的这个办法,就是把machine驱动复制两份出来,声卡和codec驱动都可以加载显示了,在/dev/snd下也有两个声卡了。但是当我配置route的时候,发现codec还有平台端的widget都还是只有一份,如cpu-capture,这样的话,我route该怎么配置?还是说codec和platform那边也要做双份分开才行?
非常感谢~
好的,谢谢