IMX8MP with TAS571x audio codec

Hello,

We have been updating the Linux kernel to a more recent version and simply said the audio is not working anymore.

When booting the device it does not list any device in the ALSA device list, and it does not report “tas571x-hifi <-> 30c10000.sai mapping ok” which is reported in the older Linux version.

When logging in and using aplay -l command, it does list the sound card and the mapping with the SAI and the codec.

I also verified that when listing /sys/kernel/debug/clk/clk_summary that the sai1_mclk1_clk, audio_plll2_out are enabled. However when using devmem2 (for example for MX8MP_IOMUXC_SAI1_MCLK__AUDIOMIX_SAI1_MCLK: devmem2 0x30330198 w) to read out the iomuxc I see that the pins from SAI1 are all set to the default value (0x5).

When manually applying the correct value to the register we see a clock signal on the oscilloscope (but still no sound). This gives me the idea that something is not correctly initialized which was initialized in the previous Linux version.

When I compare the codec driver there are no major changes, so I would expect a change somewhere else which breaks this functionality. I noticed however when porting the device tree that some things are renamed like: audiomix_clk -> audio_blk_ctrl. I also noticed that there are some changes in imx8mp-clock.h where for example defines were added in the range of 300, where it was before below the 100.

The Linux version that we are using is the Linux Toradex version, the previous Linux version was 5.4.161 (commit hash: e395d949e46b9b80358668b42b07b85738e5758d) and we are transitioning to version 5.15.148 (branch: toradex_5.15-2.2.x-imx, commit hash: 1735935186dc499bf5c3fcd522ac8a9db8406b9c). We use Yocto version Kirkstone-4.0.6 to build our BSP.

We are using a Verdin IMX8M Plus with a custom carrier board with a Texas Instruments TAS5711 audio codec.

Please find attached a snippet of the device tree, defconfig and logs.

Does anybody know if there is something missing, misconfiguration or has any experience with the sound framework in the kernel?

Thanks in advance.

dmesg.txt (25.8 KB)
devmem2


clk_summary.txt (38.0 KB)
custom_defconfig (9.0 KB)

Hi, I’m the Toradex AI Assistant. I’m in early beta, and I would appreciate your feedback.
The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello,

Based on the information provided, it seems like the issue with the audio not working after updating the Linux kernel on your Verdin iMX8M Plus module might be related to several factors including device tree configuration, clock settings, and possibly the initialization sequence in the newer kernel version.

  1. Device Tree Configuration: Ensure that the device tree reflects the changes in the newer kernel version, especially regarding the renaming of nodes like audiomix_clk to audio_blk_ctrl. This renaming suggests that there might be other changes in the device tree structure or properties that need to be updated to match the new kernel’s expectations. Pay close attention to the IOMUXC settings for the SAI1 pins. The default value (0x5) you observed suggests that the pins might not be correctly configured for SAI1 function. The correct IOMUXC settings are crucial for enabling the SAI1 interface properly.

  2. Clock Configuration: The fact that sai1_mclk1_clk and audio_plll2_out are enabled is a good sign, but ensure that all relevant clocks for the TAS5711 codec and the SAI interface are correctly configured and enabled. The changes in imx8mp-clock.h and the addition of new defines suggest that there might be new clock sources or changes in how clocks are managed in the newer kernel version. Verify that the clock configuration in your device tree matches these changes.

  3. ALSA and Codec Initialization: The absence of the “tas571x-hifi ↔ 30c10000.sai mapping ok” message indicates that there might be an issue with the ALSA subsystem or codec driver initialization. Since you mentioned that the codec driver has not undergone major changes, the issue might lie in the ALSA core or the machine driver that glues the codec and the SAI interface together. Review the initialization sequence and compare it between the two kernel versions to identify any missing or altered steps.

  4. Kernel Configuration: Ensure that your custom_defconfig includes all necessary options for the SAI interface, TAS5711 codec, and the ALSA subsystem. Missing kernel configuration options can lead to features not being enabled or initialized correctly.

  5. Debugging Steps:

    • Use dmesg to look for any errors or warnings related to the audio system, SAI interface, or codec during boot.
    • Verify the ALSA configuration with arecord -l and aplay -l to ensure that the codec

Please, also check if these links can help you solve your problem:

Audio (Linux) | Toradex Developer Center.

Hello @rb92nl,

Thank you for providing all the information.

Could you please specify which version of BSP (6.6.x, 6.7.x?) you are using?

Since I cannot see the uboot logs in the dmesg file, I would ask you to check in those logs if your custom device tree is correctly loaded. (You should see it in fdtfile variable in uboot environment, Also check the fdt_board variable). If possible, could you send me the output of fw_printenv (from linux kernel) in a file?

Could you please also send the old device tree file (assuming that what you sent before is the dts file for your new kernel.)?

Hello,

We are using our own Yocto environment which is based on BSP 6. We use the kirkstone-6.x.y branch of the meta-toradex-nxp layer (git hash: 364341c23ea49fb875e84f980b208699311aaf9c) since the BSP layer was not existing at that moment.

I attached the u-boot environment and the log of the u-boot. I also attached the old and the new device tree for comparison to this post.

Regards,
Randy

u-boot-boot-log.txt (1.4 KB)
u-boot-env.txt (3.6 KB)
imx8mp-verdin-custom.dts (6.2 KB)
imx8mp-verdin-custom-old.dts (6.8 KB)

As an addition we added more debug traces in the drivers, and also found the “mapping ok” print after setting up the sound card (see log file).

In the newer Linux kernel version, the setting up and mapping of the sound card are now performed after the DMA firmware binary is loaded, in previous Linux kernel version this was done before loading the DMA firmware binary.

I am suspecting the order of loading ALSA, drivers, modules, libraries here but cannot determine how to change or get the correct order.

dmesg_with_debug_logs.txt (38.6 KB)

Hello @rb92nl,

Our R&D team has made some changes related to configuring audio devices on BSP 6.7.0. They added the ALSA UCM component so that you can define configuration files for your sound card to have it automatically selected during boot time. This commit shows how it is implemented for our verdin development and dahlia boards. Could you please try switching to BSP 6.7.0 and adding your configuration files to the recipe alsa-ucm-conf-tdx_1.0.bb?

Hello @rudhi.tx,

We were a bit hesitant of updating to BSP 6.7.0 since we want to gradually update our system to limit the dependencies. So we continued our investigation to this.

We have found that in the older kernel the imx8mp-verdin.dtsi contains the node “sai1” which is not present in the newer kernel imx8mp-verdin.dtsi. In the new kernel version it is added in the imx8mp-verdin-dahlia.dtsi.

When comparing the node definition for the “sai” node between imx8mp-verdin.dtsi, imx8mp-verdin-dahlia.dtsi and our DTS we noticed that we did define the pinctrl-0 but did not define the ‘pinctrl-names = “default”’. After adding this to the SAI node in our DTS file it correctly initializes the SAI pins and played audio.

It took a while to find this but at least we have found it, thank you for your help and suggestions! :slight_smile:

Kind regards,
Randy