asoc-simple-card: parse error after upgrading to kernel 6.18.x

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

asoc-simple-card: parse error after upgrading to kernel 6.18.x

228 Views
MicMoba
Contributor V

Hi,

here is my working DT for Kernel 6.6.52:

/ {
codec: max98357a@0{
        compatible = "maxim,max98357a";
        #sound-dai-cells = <0>;
        pinctrl-names = "default";
        pinctrl-0 = <&sdmode_en>;
        sdmode-gpios = <&gpio4 28 GPIO_ACTIVE_HIGH>;
        status = "okay";
    };

    sound {
        compatible = "simple-audio-card";

        simple-audio-card,name = "SAI3 MAX98357A";
        simple-audio-card,format = "i2s";
        simple-audio-card,widgets = "Speaker","Speakers";
        simple-audio-card,routing = "Speakers","Speaker";
        simple-audio-card,bitclock-master = <&cpu_dai>;
        simple-audio-card,frame-master = <&cpu_dai>;

        cpu_dai: simple-audio-card,cpu {
            sound-dai = <&sai3>;
            clocks = <&clk IMX8MP_CLK_SAI3>;
            clock-names = "mclk";
            //system-clock-frequency = <&clk IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1>;
            dai-tdm-slot-num = <2>;
            dai-tdm-slot-width = <32>;
        };

        codec_dai: simple-audio-card,codec {
            sound-dai = <&codec>;
            //clocks = <&clk IMX8MP_CLK_SAI3>;
        };
    };
};
&sai3{
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_sai3>;
    #sound-dai-cells = <0>;

    clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI3_IPG>,
             <&clk IMX8MP_CLK_DUMMY>,
             <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1>,
             <&clk IMX8MP_CLK_DUMMY>,
             <&clk IMX8MP_CLK_DUMMY>,
             <&clk IMX8MP_AUDIO_PLL1_OUT>,
             <&clk IMX8MP_AUDIO_PLL2_OUT>;
    clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3", "pll8k", "pll11k";

    assigned-clocks = <&clk IMX8MP_CLK_SAI3>,
                      <&clk IMX8MP_AUDIO_PLL1>,
                      <&clk IMX8MP_AUDIO_PLL2>;

    assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL2_OUT>,
                             <&clk IMX8MP_AUDIO_PLL1_OUT>;
    // Try common MCLK rates that divide well to 48 kHz multiples
    // Option A: 24.576 MHz (very common for MAX98357A + 48 kHz)
    assigned-clock-rates = <24576000>,       // PLL2 for 48 kHz
                           <22579200>;       // PLL1 for 44.1 kHz

    // Option B (if 44.1 kHz needed later): use PLL1 + 22579200
    //assigned-clock-rates = <22579200>;
    fsl,sai-asynchronous;
    fsl,sai-mclk-direction-output;
    status = "okay";
};

After moving to kernel 6.18.20 SAI3 is not probing and I got no sound-card.

The boot log shows:
platform sound: deferred probe pending: asoc-simple-card: parse error

What changes in the DT syntax from kernel 6.6.52 to 6.18.x? I didn't find anything relevant. How can I investigate the parse error?

0 Kudos
Reply
4 Replies

120 Views
MicMoba
Contributor V

I got it, sound is working.

My kernel configs:

CONFIG_SND_IMX_SOC=m
CONFIG_SND_IMX_SOC=m
CONFIG_SND_SOC_FSL_SAI=m
CONFIG_SND_SOC_FSL_UTILS=m
CONFIG_IMX_AIPSTZ=y

The devicetree part:

/{
    codec: max98357a@0{
        compatible = "maxim,max98357a";
        #sound-dai-cells = <0>;
        pinctrl-names = "default";
        pinctrl-0 = <&sdmode_en>;
        sdmode-gpios = <&gpio4 28 GPIO_ACTIVE_HIGH>;
        status = "okay";
    };

    sound {
        compatible = "simple-audio-card";
        status = "okay";
        simple-audio-card,name = "SAI3 MAX98357A";
        simple-audio-card,format = "i2s";
        simple-audio-card,widgets = "Speaker", "Speaker Ext";
        simple-audio-card,routing = "Speaker Ext", "Speaker";
        simple-audio-card,bitclock-master = <&cpu_dai>;
        simple-audio-card,frame-master = <&cpu_dai>;

        cpu_dai: simple-audio-card,cpu {
            sound-dai = <&sai3>;
            clocks = <&clk IMX8MP_CLK_SAI3>;
            clock-names = "mclk";
            //system-clock-frequency = <&clk IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1>;
            dai-tdm-slot-num = <2>;
            dai-tdm-slot-width = <32>;
        };

        codec_dai: simple-audio-card,codec {
            sound-dai = <&codec>;
        };
    };
};

&sdma2 {
    status = "okay";
    fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin";
};

&aips5 {
    status = "okay";
};

&audio_blk_ctrl {
    status = "okay";
    assigned-clocks = <&clk IMX8MP_AUDIO_PLL1>,
                      <&clk IMX8MP_AUDIO_PLL2>;
    assigned-clock-rates = <393216000>, <361267200>;
};

&sai3{
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_sai3>;
    #sound-dai-cells = <0>;
    assigned-clocks = <&clk IMX8MP_CLK_SAI3>;
    assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
    assigned-clock-rates = <12288000>;

    clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI3_IPG>,
             <&clk IMX8MP_CLK_DUMMY>,
             <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1>,
             <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI3_MCLK2>,
             <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI3_MCLK3>;
    clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";

    dmas = <&sdma2 4 2 0>, <&sdma2 5 2 0>;
    dma-names = "rx", "tx";
    
    fsl,sai-asynchronous;
    fsl,sai-mclk-direction-output;
    status = "okay";
};

The devicetree base is imx8mp.dtsi

 

 

0 Kudos
Reply

138 Views
MicMoba
Contributor V

Hi,

I have moved one step forward. After enabling the kernel configuration option CONFIG_IMX_AIPSTZ=y, the sound card device is now available.

Because  sai3 node is a sub node of aips5 I also had to enable aips5 in my devicetree:

&aips5 {
status = "okay";
};

Now I got the following error messages:

[ 13.081746] fsl-sai 30c30000.sai: ASoC error (-110): at snd_soc_dai_hw_params() on sai-tx-rx
[ 13.090223] sai-tx-rx-HiFi: ASoC error (-110): at __soc_pcm_hw_params() on sai-tx-rx-HiFi
speaker-test -c 2 -r 48000 -t sine 2>&1 | head -20
[ 31.368187] fsl-sai 30c30000.sai: ASoC error (-110): at snd_soc_dai_hw_params() on sai-tx-rx
[ 31.376682] sai-tx-rx-HiFi: ASoC error (-110): at __soc_pcm_hw_params() on sai-tx-rx-HiFi
Unable to set hw params for playback: Connection timed out

speaker-test 1.2.11

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 440.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 24 to 131072
Period size range from 12 to 16383
Periods = 4
Setting of hwparams failed: Connection timed out




 

0 Kudos
Reply

196 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

Could you please share your dmesg log?

Best regards.

0 Kudos
Reply

173 Views
MicMoba
Contributor V

Hi Jorge,

dmesg log and running device tree (./dtc -I fs -O dts /proc/device-tree > /tmp/running.dts) attached.

0 Kudos
Reply