imx8mm fsl_sai clock config failing

Tim Harvey tharvey at gateworks.com
Mon May 11 23:58:24 CEST 2020


Greetings,

I'm trying to get imx8mm sai working with a tlv320aic3x codec on a new
board and am finding that the sai3 bus clock is getting derived from
the wrong source leading hw_params() to fail with 'fsl-sai
30030000.sai: failed to derive required Tx rate: 3072000'

In comparison to the imx8mm-evk I find it's clock gets configured as
desired yet I have the same device-tree configuration for sai3.

Here is my board's dts:
/ {
...
        sound {
                compatible = "simple-audio-card";
                simple-audio-card,name = "tlv320-audio";
                simple-audio-card,format = "i2s";
                simple-audio-card,frame-master = <&cpudai>;
                simple-audio-card,bitclock-master = <&cpudai>;
                simple-audio-card,widgets =
                        "Line", "Left Line Out Jack",
                        "Line", "Right Line Out Jack";
                simple-audio-card,routing =
                        "Left Line Out Jack", "LLOUT",
                        "Right Line Out Jack", "RLOUT";

                cpudai: simple-audio-card,cpu {
                        sound-dai = <&sai3>;
                        dai-tdm-slot-num = <2>;
                        dai-tdm-slot-width = <32>;
                };

                simple-audio-card,codec {
                        sound-dai = <&tlv320aic3105>;
                        clocks = <&clk IMX8MM_CLK_SAI3_ROOT>;
                };
        };
};

&i2c2 {
...
        tlv320aic3105: codec at 18 {
                #sound-dai-cells = <0>;
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_tlv>;
                compatible = "ti,tlv320aic3x";
                reg = <0x18>;
                reset-gpios = <&gpio4 4 GPIO_ACTIVE_LOW>;
                ai3x-micbias-vg = <2>; /* MICBIAS_2_5V */
                /* Regulators */
                DRVDD-supply = <&reg_3p3v>;
                AVDD-supply = <&reg_3p3v>;
                IOVDD-supply = <&reg_3p3v>;
                DVDD-supply = <&reg_1p8v>;
        };
}

&sai3 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_sai3>;
        assigned-clocks = <&clk IMX8MM_CLK_SAI3>;
        assigned-clock-parents = <&clk IMX8MM_AUDIO_PLL1_OUT>;
        assigned-clock-rates = <24576000>;
        status = "okay";
};

and /sys/kernel/debug/clk/clk_summary from my board:
 osc_24m                              7       10        0    24000000
        0     0  50000
...
    audio_pll1_ref_sel                0        0        0    24000000
        0     0  50000
       audio_pll1                     0        0        0   650000000
        0     0  50000
          audio_pll1_bypass           0        0        0   650000000
        0     0  50000
             audio_pll1_out           0        0        0   650000000
        0     0  50000
                sai3                  0        0        0    25000000
        0     0  50000
                   sai3_root_clk       0        0        0    25000000
         0     0  50000
^^^^ note 25000000 instead of requested 24576000

And Here is the imx8mm-evk dts:
/ {
...
        wm8524: audio-codec {
                #sound-dai-cells = <0>;
                compatible = "wlf,wm8524";
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_gpio_wlf>;
                wlf,mute-gpios = <&gpio5 21 GPIO_ACTIVE_LOW>;
        };

        sound-wm8524 {
                compatible = "simple-audio-card";
                simple-audio-card,name = "wm8524-audio";
                simple-audio-card,format = "i2s";
                simple-audio-card,frame-master = <&cpudai>;
                simple-audio-card,bitclock-master = <&cpudai>;
                simple-audio-card,widgets =
                        "Line", "Left Line Out Jack",
                        "Line", "Right Line Out Jack";
                simple-audio-card,routing =
                        "Left Line Out Jack", "LINEVOUTL",
                        "Right Line Out Jack", "LINEVOUTR";

                cpudai: simple-audio-card,cpu {
                        sound-dai = <&sai3>;
                        dai-tdm-slot-num = <2>;
                        dai-tdm-slot-width = <32>;
                };

                simple-audio-card,codec {
                        sound-dai = <&wm8524>;
                        clocks = <&clk IMX8MM_CLK_SAI3_ROOT>;
                };
        };
};

&sai3 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_sai3>;
        assigned-clocks = <&clk IMX8MM_CLK_SAI3>;
        assigned-clock-parents = <&clk IMX8MM_AUDIO_PLL1_OUT>;
        assigned-clock-rates = <24576000>;
        status = "okay";
};

and /sys/kernel/debug/clk/clk_summary from imx8mm_evk:
 osc_24m                              7       10        0    24000000
        0     0  50000
...
    audio_pll1_ref_sel                0        0        0    24000000
        0     0  50000
       audio_pll1                     0        0        0   393215995
        0     0  50000
          audio_pll1_bypass           0        0        0   393215995
        0     0  50000
             audio_pll1_out           0        0        0   393215995
        0     0  50000
                sai3                  0        0        0    24576000
        0     0  50000
                   sai3_root_clk       0        0        0    24576000
         0     0  50000
^^^^ note 24576000 as requested

Any ideas what I'm doing wrong here?

Note that even though the imx8mm-evk appears to configure its clock
correctly I still have not been able to play audio out the wm8524 and
the system appears to hang during playback as if BCLK/MCLK were not
clocking.

Perhaps there is something not supported yet upstream with regards to
IMX8MM SAI?

Best Regards,

Tim


More information about the Alsa-devel mailing list