Dual Audio Codec configuration in imx6qpsabresd

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dual Audio Codec configuration in imx6qpsabresd

1,531 Views
devikar
Contributor II

Hi,


We have setup Yocto project 4.9.11_1.0.0 on a imx6qpsabresd based custom board which has two of wm8962 audio codecs.

We have customized device tree file imx6qdl-sabresd.dtsi for dual audio codec configuration as follows. With this configuration, we are seeing that only of the codec is getting registred as sound card and the other one is coming across the issue of ASRC module.


reg_audio_1: regulator@2 {
compatible = "regulator-fixed";
reg = <2>;
regulator-name = "wm8962-supply";
gpio = <&gpio4 10 0>;
enable-active-high;
};

reg_audio_2: regulator@7 {
compatible = "regulator-fixed";
reg = <7>;
regulator-name = "wm8962-supply";
gpio = <&gpio5 5 0>;
enable-active-high;
};

sound_1 {
compatible = "fsl,imx6q-sabresd-wm8962",
"fsl,imx-audio-wm8962";
model = "wm8962-audio1";
cpu-dai = <&ssi2>;
audio-codec = <&codec_1>;
asrc-controller = <&asrc>;
audio-routing =
"Headphone Jack", "HPOUTL",
"Headphone Jack", "HPOUTR",
"Ext Spk", "SPKOUTL",
"Ext Spk", "SPKOUTR",
"AMIC", "MICBIAS",
"IN3R", "AMIC",
"DMIC", "MICBIAS",
"DMICDAT", "DMIC",
"CPU-Playback", "ASRC-Playback",
"Playback", "CPU-Playback",
"ASRC-Capture", "CPU-Capture",
"CPU-Capture", "Capture";
mux-int-port = <2>;
mux-ext-port = <3>;
codec-master;
hp-det-gpios = <&gpio7 8 1>;
mic-det-gpios = <&gpio1 9 1>;
};

sound_2 {
compatible = "fsl,imx6q-sabresd-wm8962",
"fsl,imx-audio-wm8962";
model = "wm8962-audio2";
cpu-dai = <&ssi3>;
audio-codec = <&codec_2>;
asrc-controller = <&asrc>;
audio-routing =
"Headphone Jack", "HPOUTL",
"Headphone Jack", "HPOUTR",
"Ext Spk", "SPKOUTL",
"Ext Spk", "SPKOUTR",
"AMIC", "MICBIAS",
"IN3R", "AMIC",
"DMIC", "MICBIAS",
"DMICDAT", "DMIC",
"CPU-Playback", "ASRC-Playback",
"Playback", "CPU-Playback",
"ASRC-Capture", "CPU-Capture",
"CPU-Capture", "Capture";
mux-int-port = <3>;
mux-ext-port = <4>;
codec-master;
hp-det-gpios = <&gpio4 22 1>;
mic-det-gpios = <&gpio5 10 1>;
};

&audmux {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_audmux1>,<&pinctrl_audmux2>;
status = "okay";
};


&i2c1 {
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c1>;
status = "okay";

codec_1: wm8962@1a {
compatible = "wlf,wm8962";
reg = <0x1a>;
clocks = <&clks IMX6QDL_CLK_CKO>;
DCVDD-supply = <&reg_audio_1>;
DBVDD-supply = <&reg_audio_1>;
AVDD-supply = <&reg_audio_1>;
CPVDD-supply = <&reg_audio_1>;
MICVDD-supply = <&reg_audio_1>;
PLLVDD-supply = <&reg_audio_1>;
SPKVDD1-supply = <&reg_audio_1>;
SPKVDD2-supply = <&reg_audio_1>;
gpio-cfg = <
0x0000 /* 0:Default */
0x0000 /* 1:Default */
0x0013 /* 2:FN_DMICCLK */
0x0000 /* 3:Default */
0x8014 /* 4:FN_DMICCDAT */
0x0000 /* 5:Default */
>;
amic-mono;
};
};

&i2c3 {
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c3>;
status = "okay";

codec_2: wm8962@1a {
compatible = "wlf,wm8962";
reg = <0x1a>;
clocks = <&clks IMX6QDL_CLK_CKO>;
DCVDD-supply = <&reg_audio_2>;
DBVDD-supply = <&reg_audio_2>;
AVDD-supply = <&reg_audio_2>;
CPVDD-supply = <&reg_audio_2>;
MICVDD-supply = <&reg_audio_2>;
PLLVDD-supply = <&reg_audio_2>;
SPKVDD1-supply = <&reg_audio_2>;
SPKVDD2-supply = <&reg_audio_2>;
gpio-cfg = <
0x0000 /* 0:Default */
0x0000 /* 1:Default */
0x0013 /* 2:FN_DMICCLK */
0x0000 /* 3:Default */
0x8014 /* 4:FN_DMICCDAT */
0x0000 /* 5:Default */
>;
amic-mono;
};
};

&iomuxc {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_hog>;

imx6qdl-sabresd {
pinctrl_audmux1: audmux1grp {
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
>;
};

pinctrl_audmux2: audmux2grp {
fsl,pins = <
MX6QDL_PAD_DISP0_DAT23__AUD4_RXD 0x130b0
MX6QDL_PAD_DISP0_DAT20__AUD4_TXC 0x130b0
MX6QDL_PAD_DISP0_DAT21__AUD4_TXD 0x110b0
MX6QDL_PAD_DISP0_DAT22__AUD4_TXFS 0x130b0
>;
};

};

&ssi2 {
assigned-clocks = <&clks IMX6QDL_CLK_PLL4>,
<&clks IMX6QDL_PLL4_BYPASS>,
<&clks IMX6QDL_CLK_SSI2_SEL>;
assigned-clock-parents = <&clks IMX6QDL_CLK_OSC>,
<&clks IMX6QDL_CLK_PLL4>,
<&clks IMX6QDL_CLK_PLL4_AUDIO_DIV>;
assigned-clock-rates = <1179648000>, <0>, <0>;
status = "okay";
};

&ssi3 {
assigned-clocks = <&clks IMX6QDL_CLK_PLL4>,
<&clks IMX6QDL_PLL4_BYPASS>,
<&clks IMX6QDL_CLK_SSI3_SEL>;
assigned-clock-parents = <&clks IMX6QDL_CLK_OSC>,
<&clks IMX6QDL_CLK_PLL4>,
<&clks IMX6QDL_CLK_PLL4_AUDIO_DIV>;
assigned-clock-rates = <1179648000>, <0>, <0>;
status = "okay";
};

Errors we are getting are mentioned in the log file
Can you please let us know about if there is something wrong with this dts?

Thanks,

Devika

0 Kudos
6 Replies

1,278 Views
devikar
Contributor II

Hi,

For dual sound card configuration, we have modified DTS file.

Please find the attached file for configuration in dts file and dmesg log.

With this configuration, we are seeing dual sound card detection, but both the sound cards are failing to record the sound.
When we execute the arecord command it is able to output the recorded file but there will be no content in that.We have used following commands to record the sound.

For primary codec
    arecord -D plughw:0,0 -d 10 -r 44100 -f S16_LE file1.wav

For secondary codec
    arecord -D plughw:1,0 -d 10 -r 44100 -f S16_LE file2.wav

We have tested each sound card interface by saperately enabling them in device tree. It worked fine. However, we are seeing this issue when both the sound card interfaces are enabled.
We can confirm that there are no issues with the hardware interfaces. Based on our observations & debugging, there seems to be issue with the SSI mapping.

We would like to know if anyone has faced same issue and resolved.
We are getting "Unsupported sysclk ratio 544" error for secondary audio codec.

Please let us know if we are missing something in dts file.

Thank you,

Devika

0 Kudos

1,278 Views
devikar
Contributor II

Hi,

Can you please let us know why we are getting these errors.

[    0.466764] wm8962-supply: Failed to create debugfs directory
[    3.181685] wm8962 0-001a: customer id 0 revision D
[    3.205571] wm8962 2-001a: Failed to read ID register
[    3.288401] imx-wm8962 sound_1: wm8962 <-> 202c000.ssi mapping ok
[    3.296550] imx-wm8962 sound_1: snd-soc-dummy-dai <-> 2034000.asrc mapping ok
[    3.302501] imx-wm8962 sound_1: wm8962 <-> 202c000.ssi mapping ok
[    3.310358] imx-wm8962 sound_2: failed to find codec platform device
[    3.315457] imx-wm8962: probe of sound_2 failed with error -22
[    3.705487] wm8962-supply: disabling
[    3.707770] wm8962-supply: disabling
[    3.719334]   #0: wm8962-audio1

Thanks,

Devika

0 Kudos

1,278 Views
jimmychan
NXP TechSupport
NXP TechSupport

I didn't use two same audio codec simultaneously.  You may try to add the "printf" in the driver to debug it.

0 Kudos

1,278 Views
devikar
Contributor II

Hi,

Thanks for the reply.

We have tried to modify the card name in imx-wm8962.c source file as follows,

static const struct of_device_id imx_wm8962_dt_ids[] = {
    { .compatible = "fsl,imx-audio1-wm8962", },
    { .compatible = "fsl,imx-audio2-wm8962", },
    { /* sentinel */ }
};

Now we are getting errors as follows,

[    0.466764] wm8962-supply: Failed to create debugfs directory
[    3.181685] wm8962 0-001a: customer id 0 revision D
[    3.205571] wm8962 2-001a: Failed to read ID register
[    3.288401] imx-wm8962 sound_1: wm8962 <-> 202c000.ssi mapping ok
[    3.296550] imx-wm8962 sound_1: snd-soc-dummy-dai <-> 2034000.asrc mapping ok
[    3.302501] imx-wm8962 sound_1: wm8962 <-> 202c000.ssi mapping ok
[    3.310358] imx-wm8962 sound_2: failed to find codec platform device
[    3.315457] imx-wm8962: probe of sound_2 failed with error -22
[    3.705487] wm8962-supply: disabling
[    3.707770] wm8962-supply: disabling
[    3.719334]   #0: wm8962-audio1

And also we are getting kernel panic for dual audio codec configuration.

Please let us know if we have to modify sound card drivers or if we are missing anything in dts configuration.

Thanks,

Devika

0 Kudos

1,278 Views
jimmychan
NXP TechSupport
NXP TechSupport

yes, you can modify the sound card driver to check where it stopped.

0 Kudos

1,278 Views
jimmychan
NXP TechSupport
NXP TechSupport

The error is from the soc_init_card_debugfs(struct snd_soc_card *card) in the soc-core.c. You may check the card->name, the error may due to use the same name there. You may try to modify the code to use the different name there.

 

0 Kudos