MAX I2S not detected on SAI3 with max98357a

Dear tx,

I am a bit struggling with the I2S connection on the IMX8MPlus on SAI3. I want to use the max98357a driver (that I activated in Kconfig), and I disabled the pins already used for the backlight driver. Nothing is recognised at kernel boot. Do you have any idea about the issue ?

My dtsi are like this:

/* VERDIN I2S_2 */
&sai3 {
        #sound-dai-cells = <0>;
        assigned-clocks = <&clk IMX8MP_CLK_SAI3>;
        assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
        assigned-clock-rates = <24576000>;
        clocks = <&audiomix_clk IMX8MP_CLK_AUDIOMIX_SAI3_IPG>, <&clk IMX8MP_CLK_DUMMY>,
                 <&audiomix_clk IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1>, <&clk IMX8MP_CLK_DUMMY>,
                 <&clk IMX8MP_CLK_DUMMY>;
        clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_sai3>;
        status = "okay";
pinctrl_sai3: sai3grp {
                fsl,pins = <
                        MX8MP_IOMUXC_SAI3_RXD__AUDIOMIX_SAI3_RX_DATA00  0x1d6   /* SODIMM 48 */
                        MX8MP_IOMUXC_SAI3_TXFS__AUDIOMIX_SAI3_TX_SYNC   0x1d6   /* SODIMM 44 */
                        MX8MP_IOMUXC_SAI3_TXC__AUDIOMIX_SAI3_TX_BCLK    0x1d6   /* SODIMM 42 */
                        MX8MP_IOMUXC_SAI3_TXD__AUDIOMIX_SAI3_TX_DATA00  0x96    /* SODIMM 46 */
        sound_card: sound-card {
                compatible = "simple-audio-card";
                simple-audio-card,bitclock-master = <&dailink_master>;
                simple-audio-card,format = "i2s";
                simple-audio-card,frame-master = <&dailink_master>;
                simple-audio-card,name = "max98357a";
                status = "okay";
                simple-audio-card,widgets = "Speaker", "Speakers";
                simple-audio-card,routing = "Speakers", "Speaker";
                dailink_master: simple-audio-card,cpu {
                        sound-dai = <&sai3>;
                        /*system-clock-frequency = <&sound_osc 0>;*/
                        dai-tdm-slot-num = <2>;
                        dai-tdm-slot-width = <16>;
                        clocks = <&audiomix_clk IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1>;

                        sound-dai = <&codec_ext>;


        codec_ext: max98357a {
                compatible = "maxim,max98357a";

Many thanks

Hi @luciolis !

Does this codec have any control interface (like I2C)?

How can you confirm that it was not recognized by the kernel?

Did you try to list the devices using alsa (aplay -l or aplay -L for output and arecord -l or arecord -L for inputs)?

Best regards,

Hi @henrique.tx,

Thanks for your answer. It’s not been recognized by the kernel because dmesg makes no mention of it, and it’s not in the /sys/class/sound folder, and therefore it’s not listed by ALSA.
The codec does not have any control interface.


Hi @luciolis !

Could you please share more information?

  • How is the connection with de codec?
  • Which BSP are you using?
  • Which Linux version?
  • Which device tree are you using?
    • Could you please check that the device tree that you modified is indeed being loaded?

Could you please also share the whole dmesg output and the output of the command below (from the module):

zcat /proc/config.gz

Best regards,

Hi @henrique.tx,

  1. I connected the MAX98357 to the SODIMM 42 (CLK), 44 (LRC), 46 (DATA)
  2. Last one from your git (5.5.0?)
  3. 5.4.161
  4. I directly patched your verdin and verdin-dahlia that you use in the BSP, so I guess it’s loaded correctly. My other patches (rpmsg, lvds, GPIO, backlight) work as well. I’ll attach the patched files

Thanks !

configgz.txt (190.7 KB)
imx8mp-verdin-dahlia.dtsi (3.6 KB)
imx8mp-verdin.dtsi (32.7 KB)
imx8mp-verdin-rpmsg.dtsi (2.3 KB)

Thanks for the files, @luciolis

Could you please attach the dmesg output as well?

Best regards,

Here it is. Sorry about the delay
dmesg.txt (30.4 KB)

Hi @luciolis !

It is not clear to me the relation between the device trees that you shared.

Seems like you are using the imx8mp-verdin-rpmsg.dtsi. But this file deactivates sai3 (line 93). And sai3 is the node that you use for you codec.

Could you please clarify on that?

Best regards,

Yay, that was the trick !
However RPMSG had a conflict with SAI3, so I used SAI1 with a change of pins instead.

I still cannot get any sound, but my SAI is getting recognized by ALSA.

Hi @luciolis !

Did you check the output volume via amixer or alsamixer?

Maybe it is muted and/or at 0% volume.

Best regards,

Hi @henrique.tx !

Thanks for the follow-up. Currently I do not have access to any controls:

And speaker test freezes:

Do you know if, in the DTS, which one is the frame and bitclock master: the codec or the CPU sai ? Examples from IMX6 put the CPU as master, and IMX8 examples put the codec as master. With cpu as master i’ve got:

Hi @luciolis !

You have made some changes to the device tree files (.dtsi and .dts), right?

Could you please share their latest version?

Please share the .dts as well. You don’t need to share the .dtsi that you didn’t modify.

Best regards,