I am working on a custom board which is using imx8mplus SoC and two rt5640 audio codec chips. In both of them, one is working as a master and the other is working as a slave. I need to enable the slave chip and test it for playing audio. I have made basic changes for porting audio and able to make rt5640 card showing in “aplay -l”. But not able to play audio in that and not able to do record.
Can anyone please tell me what things I should need to enable it.
Information:
As slave chip is on i2c4 and using the SAI3 interface and the master codec chip is on i2c3 and using the SAI2 interface. But I noticed in imx8mp.dtsi file below referencing
gpio0 = &gpio1;
gpio1 = &gpio2;
gpio2 = &gpio3;
gpio3 = &gpio4;
gpio4 = &gpio5;
i2c0 = &i2c1;
i2c1 = &i2c2;
i2c2 = &i2c3;
i2c3 = &i2c4;
i2c4 = &i2c5;
i2c5 = &i2c6;
So when I am adding rt5640 codec node in i2c-4 and make image and decompiled its dtb file i see the audio codec node in i2c-3. I am very confused about its i2c buses referencing. Please anyone tell me why it is like that.
2. Here is my code snippet for the audio codec which I have wrote in imx8mp-evk.dts file
&i2c4 {
clock-frequency = <400000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c4>;
status = "okay";
codec: rt5640@1c {
compatible = "realtek,rt5640";
reg = <0x1c>;
clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_SAI3_MCLK1>;
clock-names = "mclk";
// interrupt-parent=<&gpio1>;
interrupts=<11 IRQ_TYPE_LEVEL_HIGH>;
realtek,in1-differential = "true";
realtek,in2-differential = "false";
realtek,in3-differential = "true";
realtek,jack-detect-source = <0>;
SPKVDD1-supply = <®_audio_pwr>;
status = "okay";
};
};
sound-rt5640 {
compatible = "fsl,imx-audio-rt5640";
model = "rt5640-audio";
audio-cpu = <&sai3>;
audio-codec = <&codec>;
audio-ascr =<&easrc>;
audio-routing =
"Headphone Jack", "HPOL",
"Headphone Jack", "HPOR",
"IN2P", "Mic Jack",
"IN2N", "Mic Jack",
"Mic Jack", "MICBIAS1";
};
&sai2 {
#sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai2>;
assigned-clocks = <&clk IMX8MP_CLK_SAI2>;
assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
assigned-clock-rates = <12288000>;
clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_SAI2_IPG>, <&clk IMX8MP_CLK_DUMMY>,
<&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_SAI2_MCLK1>, <&clk IMX8MP_CLK_DUMMY>,
<&clk IMX8MP_CLK_DUMMY>;
clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
fsl,sai-mclk-direction-output;
status = "okay";
};
&sai3 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai3>;
assigned-clocks = <&clk IMX8MP_CLK_SAI3>;
assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
assigned-clock-rates = <12288000>;
clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_SAI3_IPG>, <&clk IMX8MP_CLK_DUMMY>,
<&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_SAI3_MCLK1>, <&clk IMX8MP_CLK_DUMMY>,
<&clk IMX8MP_CLK_DUMMY>;
clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
fsl,sai-mclk-direction-output;
status = "okay";
};
So anytime I try to play a wav file it shows only “unsupported clock setting 44100 for dai 0 ” I tried to change the sample rate format also but ended with the same error.