Hi Team,
I'm trying to probe the TAS5760M audio codec with IMX8QXP. We are facing a problem when probing the device with the simple-audio-card driver. We configured ESAI0 as I2S master and only Tx sections of ESAI were used as data line to codec.
The following is the dts node for sound card:
&esai0 {
#sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_esai0>;
assigned-clocks = <&acm IMX_ADMA_ACM_ESAI0_MCLK_SEL>,
<&clk IMX_SC_R_AUDIO_PLL_0 IMX_SC_PM_CLK_PLL>,
<&clk IMX_SC_R_AUDIO_PLL_0 IMX_SC_PM_CLK_SLV_BUS>,
<&clk IMX_SC_R_AUDIO_PLL_0 IMX_SC_PM_CLK_MST_BUS>,
<&esai0_lpcg 0>;
assigned-clock-parents = <&aud_pll_div0_lpcg 0>;
assigned-clock-rates = <0>, <786432000>, <49152000>, <12288000>, <49152000>;
fsl,txs-rxm;
status = "okay";
};
pinctrl_esai0: esai0grp {
fsl,pins = <
IMX8QXP_ESAI0_FST_ADMA_ESAI0_FST 0xc6000040
IMX8QXP_ESAI0_SCKT_ADMA_ESAI0_SCKT 0xc6000040
IMX8QXP_ESAI0_TX0_ADMA_ESAI0_TX0 0xc6000040
>;
};
//SOUND CARD
sound-codec {
compatible = "simple-audio-card";
simple-audio-card,name = "tas5760m-audio";
simple-audio-card,format = "i2s";
simple-audio-card,frame-master = <&cpudai>;
simple-audio-card,bitclock-master = <&cpudai>;
simple-audio-card,widgets =
"Speaker", "External Speaker";
simple-audio-card,routing =
"External Speaker", "OUT";
cpudai: simple-audio-card,cpu {
sound-dai = <&esai0>;
};
simple-audio-card,codec {
sound-dai = <&tas5760m>;
};
};
&i2c1 {
#address-cells = <1>;
#size-cells = <0>;
clock-frequency = <400000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_amp_grp &pinctrl_amp_gpio_grp>;
status = "okay";
//CODEC
tas5760m:tas5760@6d {
#sound-dai-cells = <0>;
compatible = "ti,tas5760m";
reg = <0x6d>;
sleep = <&lsio_gpio4 5 GPIO_ACTIVE_LOW>;
shutdown = <&lsio_gpio1 27 GPIO_ACTIVE_HIGH>;
status = "okay";
};
With above entry we were able to create sound card entry
sound card list
When we tried to play 48000 HZ audio we are facing below error:
aplay command
Hello,
The TAS5760 audio CODEC is not supported by default on our BSP. To use this CODEC to your system, you may need to add a third-party driver provided by the manufacturer and configure your device tree.
Unfortunately, there is not a guide to port this specific CODEC to the BSP. The references we have are the i.MX porting guide and reference board device tree, here some examples:
You need to build the .dtb and kernel to enable the device tree and know if the module if working.
Best regards.
Hi Jorge Cas,
We incorporated the amplifier driver and configured the device tree based on the mentioned sound card entries(wm8960), we successfully established the sound card for the amplifier. However, only during our attempt to play an audio file, we encountered this issue.
Also Do we need to build .dtb file separately for enabling , I have added my entries in imx8x-mek.dtsi file
Hello,
You can build the .dtb file separately, modify an existing .dts file of your current machine or create a custom machine to add your custom device tree.
Best regards.
I found that the SCKT rate error is from fsl_esai_set_bclk function, I added some debug prints and checked . The freq value is updated from sample rate and and bit size of audio file . How hck_rate is assigned here.
I used 16 bit, stereo 48000 Hz audio file in aplay command
fsl_esai_set_bclk
What could be the reason for this issue , How to resolve it
Hello,
That is related to the target frequency, and PLL driver (It is not recommended to modify this because could affect other modules).
Other thing you could try is change sample frequency when you try to the play audio or use an external clock to get required clock frequency.
Best regards.
We tried to use ASoC Sound Card similar to wm8960 , So i modified the changes in sound/soc/fsl/fsl-asoc-card.c file. Below is the dts change made asoc sound card dts
and successfully created the sound card list . When we probed, the BCLK and FSYNC is not coming so TAS5760 is throwing a clock error when tried to play the audio file .clock error
Also MCLK will be generated if we give APLAY command for headset(wm8960) and This MCLK (took connection from R170) is given to amplifier
MCLK
What could be the reason for BCLK and FSYNC are not generating, How to resolve it
Hello,
This could be related to the way you added the codec on the code.
fsl-asoc-card.c by dafault supports the next sound cards.
Best regards.
We tried connecting MCLK externally to audio codec and below changes were made in fsl_asoc_card_hw_params functionfsl-asoc-card
and in probe function
with this changes and dts entry, able to create sound card list in aplay -l command but
When in run the below command ,BCLK and LRCK signals are not being generated when probed, leading to the Clock Error Status bit being set high in the TAS5760
aplay -D hw:3,0 -r 48000 piano2.wav
Did i missed any configuration, How to resolve it.
Hi,
I've added debug prints to the fsl-asoc-card.c file and verified that the system clock for the CPU is sourced from the "extal" property and has a rate of 49152000 Hz. This clock is used to derive the SCK and FS clocks. fsl-asoc-card.c
So I have modified it and ensured that the direction of the clock is set to OUT
ret = snd_soc_dai_set_sysclk(asoc_rtd_to_cpu(rtd, 0), cpu_priv->sysclk_id[tx],
cpu_priv->sysclk_freq[tx],
cpu_priv->sysclk_dir[tx]);
However, when I run the aplay command and check the BCLK rate from the fsl_esai_set_bclk function, I'm getting a rate of 1536000 Hz, which matches the expected value.(sample rate x 32) but the clock error persists and SCK and FS is not generating when probed in oscilloscope .
My question is whether it's necessary to change the system clock rate, or if there's another solution to resolve this discrepancy and correct the clock error.
Any suggestions on how to resolve this issue would be greatly appreciated!