cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP1 SAI driver probe fails with "Unsupported direction" (-22) — Need help with device tree nodes

Midhul_Pk
Associate II

Hello everyone,

I’m working on configuring the STM32MP1 SAI interface with the SGTL5000 codec using a device tree setup on the STM32MP13-Disco board. I’m running into an error when the SAI driver probes the audio-controller node. The kernel log shows:

 

[    3.432693] st,stm32-sai-sub 4400a004.audio-controller: Unsupported direction
[    3.438601] st,stm32-sai-sub: probe of 4400a004.audio-controller failed with error -22

Device Tree snippets:

Pin Control:

&pinctrl { 
    sai1_pins_a: sai1-0 {
        pins {
            pinmux = <STM32_PINMUX('A', 4, AF12)>, /* SAI1_SCK_A */
                     <STM32_PINMUX('A', 0, AF6)>,  /* SAI1_SD_B */
                     <STM32_PINMUX('A', 5, AF6)>,  /* SAI1_SD_A */
                     <STM32_PINMUX('F', 11, AF6)>; /* SAI1_FS_A */
            slew-rate = <0>;
            drive-push-pull;
            bias-disable;
        };
    };

    sai1_mclk_pin: sai1-mclk {
        pins {
            pinmux = <STM32_PINMUX('D', 13, AF6)>; /* SAI1_MCKA */
            slew-rate = <0>;
            drive-push-pull;
            bias-disable;
        };
    };

    sai1_sleep_pins_a: sai1-sleep-0 {
        pins {
            pinmux = <STM32_PINMUX('A', 4, ANALOG)>,  /* SAI1_SCK_A */
                     <STM32_PINMUX('A', 0, ANALOG)>,  /* SAI1_SD_B */
                     <STM32_PINMUX('A', 5, ANALOG)>,  /* SAI1_SD_A */
                     <STM32_PINMUX('F', 11, ANALOG)>; /* SAI1_FS_A */
        };
    };
};

 SAI node:

&sai1 {
    pinctrl-names = "default", "mclk", "sleep";
    pinctrl-0 = <&sai1_pins_a>;
    pinctrl-1 = <&sai1_mclk_pin>;
    pinctrl-2 = <&sai1_sleep_pins_a>;
    status = "okay";
    clock-names = "pclk", "x8k", "x11k";
    clocks = <&rcc SAI1>, <&scmi_clk CK_SCMI_PLL3_Q>, <&scmi_clk CK_SCMI_PLL3_R>;

    sai1a: audio-controller@4400a004 {
        status = "okay";
        #sound-dai-cells = <0>;
        clock-names = "sai_ck";
        clocks = <&rcc SAI1_K>;
        st,sai-out;
    };

    sai1b: audio-controller@4400a024 {
        status = "disabled";
        #sound-dai-cells = <0>;
        clock-names = "sai_ck";
        clocks = <&rcc SAI1_K>;
    };
};

I2C codec node:

codec: sgtl5000@0a {
    compatible = "fsl,sgtl5000";
    reg = <0x0a>;
    VDDA-supply = <&scmi_v3v3_sw>;
    VDDIO-supply = <&scmi_v3v3_sw>;
    VDDD-supply = <&v3v3_ao>;
    status = "okay";
};

Sound card node:

sound {
    compatible = "simple-audio-card";
    simple-audio-card,name = "stm32mp1-sgtl5000";
    simple-audio-card,format = "i2s";
    simple-audio-card,bitclock-master = <&cpu_dai>;
    simple-audio-card,frame-master = <&cpu_dai>;

    cpu_dai: simple-audio-card,cpu {
        sound-dai = <&sai1a>;
    };

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

 

How I tried to troubleshoot:
I checked ST’s Linux kernel sources and noticed the driver looks for st,sai-direction. Currently, I’m using st,sai-out;, and I suspect that may be causing the issue. I also reviewed other DTS examples but couldn’t find a clear answer.

My question:

  • Is st,sai-direction = <1>; required instead of st,sai-out;?

  • Are there any other required properties or known issues with SAI on STM32MP1?

Any advice or working DTS examples would be greatly appreciated. Let me know if more logs or info are needed. Thanks!

@Saket_Om @FBL @KDJEM.1 @MFARH.1 

0 REPLIES 0