cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP257F-EV-1 external sound codec and `deferred probe pending` for sound card with SAI

tymonz
Visitor

Hello everybody,

For the past few days I am trying to setup up an external codec with STM32MP257F-EV1 dev board. The codec of choice is the Cirrus CS47L35 and I can find a driver for in in OpenSTLinux.

With my STM32MP25 and SAI2 interface I want to operate in Master Mode with Clock-Out. Right now I only need to read data so the SAI2B is configured as synchronous slave for SAI2A. There is additional codec's I2C configuration interface which will be accessed by i2c8 peripherial. I've already identified needed pins and generated device tree:

{
    // root
    sound: sound {
    compatible = "audio-graph-card";
    label = "CS47L35 audio-graph card";
    routing =
        "Playback" , "mclk1",
        "Capture" , "mclk1";
    dais = <&sai2b_port>;
    status = "okay";
};

sai2a_pins_mx: sai2a_mx-0 {
    pins {
        pinmux = <STM32_PINMUX('J', 3, AF3)>, /* SAI2_FS_A */
                 <STM32_PINMUX('J', 11, AF3)>, /* SAI2_SCK_A */
                 <STM32_PINMUX('J', 12, AF3)>, /* SAI2_SD_A */
                 <STM32_PINMUX('J', 13, AF3)>; /* SAI2_MCLK_A */
        bias-disable;
        drive-push-pull;
        slew-rate = <0>;
    };
};

sai2a_sleep_pins_mx: sai2a_sleep_mx-0 {
    pins {
        pinmux = <STM32_PINMUX('J', 3, ANALOG)>, /* SAI2_FS_A */
                 <STM32_PINMUX('J', 11, ANALOG)>, /* SAI2_SCK_A */
                 <STM32_PINMUX('J', 12, ANALOG)>, /* SAI2_SD_A */
                 <STM32_PINMUX('J', 13, ANALOG)>; /* SAI2_MCLK_A */
    };
};

sai2b_pins_mx: sai2b_mx-0 {
    pins {
        pinmux = <STM32_PINMUX('J', 2, AF4)>; /* SAI2_SD_B */
        bias-disable;
        drive-push-pull;
        slew-rate = <0>;
    };
};

sai2b_sleep_pins_mx: sai2b_sleep_mx-0 {
    pins {
        pinmux = <STM32_PINMUX('J', 2, ANALOG)>; /* SAI2_SD_B */
    };
};

&i2c8 {
    pinctrl-names = "default", "sleep";
    pinctrl-0 = <&i2c8_pins_z_mx>;
    pinctrl-1 = <&i2c8_sleep_pins_z_mx>;
    status = "okay";
 
    /* USER CODE BEGIN i2c8 */
    i2c-scl-rising-time-ns = <100>;
    i2c-scl-falling-time-ns = <13>;
    clock-frequency = <400000>;
    /* spare dmas for other usage */
    /delete-property/dmas;
    /delete-property/dma-names;
 
    cs47l85: codec@1a {
        compatible = "cirrus,cs47l35";
        reg = <0x1a>;
 
        gpio-controller;
        #gpio-cells = <2>;
 
        interrupt-parent = <&gpioi>;
        interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
 
        AVDD-supply = <&scmi_v1v8>;
        DBVDD1-supply = <&scmi_v1v8>;
        DCVDD-supply = <&scmi_v1v8>;
        CPVDD1-supply = <&scmi_v1v8>;
 
        clocks = <&sai2a>, <&scmi_clk CK_SCMI_RTCCK>;
        clock-names = "mclk1", "mclk2";
 
        cirrus,dmic-ref = <0 0>;
        cirrus,inmode = <
            MADERA_INMODE_DMIC   MADERA_INMODE_DMIC
            MADERA_INMODE_DMIC   MADERA_INMODE_DMIC
        >;
        cirrus,max-channels-clocked = <2 0 0>;
 
        pinctrl-names = "default";
        pinctrl-0 = <&pinsettings>;
 
        pinsettings: pin-settings {
            aif1-pins {
                groups = "aif1";
                function = "aif1";
                bias-bus-hold;
            };
 
            aif2-pins {
                groups = "aif2";
                function = "aif2";
                bias-bus-hold;
            };
 
            aif3-pins {
                groups = "aif3";
                function = "aif3";
                bias-bus-hold;
            };
        };
 
        cs47l35_port: port {
            cs47l35_rx_endpoint: endpoint {
            remote-endpoint = <&sai2b_endpoint>;
            };
        };
    };
/* USER CODE END i2c8 */
};


&sai2 {
    pinctrl-names = "default", "sleep";
    pinctrl-0 = <&sai2a_pins_mx>, <&sai2b_pins_mx>;
    pinctrl-1 = <&sai2a_sleep_pins_mx>, <&sai2b_sleep_pins_mx>;
 
    status = "okay";
/* USER CODE BEGIN sai2 */
/* USER CODE END sai2 */
 
    sai2a:audio-controller@402a0004{
        #clock-cells = <0>;
        status = "okay";
/* USER CODE BEGIN sai2a */
/* USER CODE END sai2a */
    };
 
    sai2b:audio-controller@402a0024{
        st,sync = <&sai2a 2>; /* SAI2B is slave of SAI2A */
        clocks = <&rcc CK_KER_SAI2>, <&sai2a>; /* SAI2B is a consumer of SAI2A master clock */
        clock-names = "sai_ck", "MCLK";
        status = "okay";

/* USER CODE BEGIN sai2b */
        sai2b_port: port {
            sai2b_endpoint: endpoint {
                remote-endpoint = <&cs47l35_rx_endpoint>;
                format = "i2s";
                mclk-fs = <256>;
            };
        };
/* USER CODE END sai2b */
    };
};
};
};


I've also successfully get some of the output after issuing `i2cdetect` commands:

$ i2cdetect -y 1

0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- --
20: -- -- 22 -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --


Right now, after boot-up I got message: platform sound: deferred probe pending and no error either from SAI or madera - which is name for collection of cirrus codecs.

My idea was that if everything is set up correctly I should observe clock signal on PJ13 pin. I am aware that by default this pin is used by FDCAN (FDCAN_STBY) interface but I've disabled this peripheral and connected with oscilloscope to U23 pad on STM32MP257F-EV1 board (soldered out the CAN driver chip).

Can you please verify my device tree config and point me what should be checked additionally in order to provide more info? I am attaching full device-tree configuration and dmesg logs but the most important parts are the following:

 

What is worrying me in dmesg are those two lines:
Board is not a valid BOARD (stm32mp257f-dk, stm32mp257f-ev1)

platform sound: deferred probe pending

 

Thank you,
T

 

0 REPLIES 0