cancel
Showing results for 
Search instead for 
Did you mean: 

I2S3 Audio codec clock

DGami.1
Associate II

Hi all,

i am trying to interface es8388 to I2S3 bus,

Here are fragments from device tree :

       sound {
                compatible = "audio-graph-card";
                label = "STM32MP1-SOM";
                routing =
                        "Playback" , "MCLK",
                        "Capture" , "MCLK",
                        "MICL" , "Mic Bias";
                        dais = <&i2s3_port>;
 
                status = "okay";
        };
 
 
.............................................
&pinctrl {
 
 i2s3_pins_a: i2s3-0 {
                pins {
                        pinmux = <STM32_PINMUX('A', 8, AF5)>, /* I2S3_SDO */
                                 <STM32_PINMUX('A', 4, AF6)>, /* I2S3_WS */
                                 <STM32_PINMUX('B', 3, AF6)>, /* I2S3_CK */
                                 <STM32_PINMUX('B', 4, AF6)>, /* I2S3_SDI */
                                 <STM32_PINMUX('C', 7, AF6)>; /* I2S3_MCK */
 
                        slew-rate = <1>;
                        drive-push-pull;
                        bias-disable;
                };
        };
 
        i2s3_pins_sleep_a: i2s3-1 {
                pins {
                        pinmux = <STM32_PINMUX('A', 8, ANALOG)>, /* I2S3_SDO */
                                 <STM32_PINMUX('A', 4, ANALOG)>, /* I2S3_WS */
                                 <STM32_PINMUX('B', 3, ANALOG)>, /* I2S3_CK */
                                 <STM32_PINMUX('B', 4, ANALOG)>, /* I2S3_SDI */
                                 <STM32_PINMUX('C', 7, ANALOG)>; /* I2S3_MCK */
 
 
 
                };
        };
}
 
&i2s3 {
        clocks = <&rcc SPI3>, <&rcc SPI3_K>, <&rcc PLL3_Q>, <&rcc PLL4_Q>;
        clock-names = "pclk", "i2sclk", "x8k", "x11k";
        pinctrl-names = "default", "sleep";
        pinctrl-0 = <&i2s3_pins_a>;
        pinctrl-1 = <&i2s3_pins_sleep_a>;
        status = "okay";
 
        i2s3_port: port {
                i2s3_endpoint: endpoint {
                        remote-endpoint = <&es8388_endpoint>;
                        format = "i2s";
                        mclk-fs = <256>;
                };
        };
};
 
&i2c5 {
        pinctrl-names = "default";
        pinctrl-0 = <&i2c5_pins_a>;
        i2c-scl-rising-time-ns = <185>;
        i2c-scl-falling-time-ns = <20>;
        status = "okay";
          es8388: es8388@20 {
                compatible = "everest,es8388", "everest,es8328";
                reg = <0x20>;
                AVDD-supply = <&vdd_sd3v3>;
                DVDD-supply = <&vdd_sd3v3>;
                HPVDD-supply = <&vdd_sd3v3>;
                PVDD-supply = <&vdd_sd3v3>;
              clocks = <&sai2a>; //change me
          clock-names = "MCLK1";
                es8388_tx_port: port@0 {
                        #address-cells = <1>;
                        #size-cells = <0>;
                        es8388_endpoint: endpoint {
                                remote-endpoint = <&i2s3_endpoint>;
                        };
                };
 
        };
 
};

I'm struggling with es8388 clock property, i cant find example in documentation or document about clock source.

Experimented with sai2a clock but without success.

My question is , is my dts correct, and which clock source to use for es8388

Thanks,

Best Regards

3 REPLIES 3
Olivier GALLIEN
ST Employee

Hi @DGami.1​ 

Do you know and ever refer to following wiki pages :

https://wiki.st.com/stm32mpu/wiki/Soundcard_configuration

I'm not expert but, reading wiki, sai2a as clock source look to require to properly set sai2 as master clock provider and &sai node is not part of DT you share :

see https://wiki.st.com/stm32mpu/wiki/SAI_device_tree_configuration#Setting_SAI_as_a_master_clock_provider

Hope it help,

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
DGami.1
Associate II

Hi @Community member​ ,

thanks for suggestion, but i want to use i2s3 clock, i do not see example in documentation about i2s at all.

I want to use I2S3 MCK pin as master clock provider for codec.

Is it possible to do it without SAI ?

Thanks

Olivier GALLIEN
ST Employee

Hi @DGami.1​ 

I2S MCK as master is not supported in ST delivery.

One of our expert kindly accept to provide the attached patch as an example.

Only basic alsa playback/record tests have been performed in a single configuration, so there is NO warranty that it is fully functional.

However it should be stable enough to evaluate the connection of I2S to an external audio codec fed with the I2S master clock.

The I2S master clock provider feature has to be configured through the DT (SAI device tree wiki page can be used as reference as

It is quite similar)

Below is a sample of DT provided as example:

            snd_i2s2: snd_i2s2 {
                        compatible = "audio-graph-card";
                        routing = "Playback" , "MCLK";
                        dais = <&i2s2_port>;
                        status = "okay";
            };
 
&i2s2 {
            compatible = "st,stm32h7-i2s";
            clocks = <&rcc PCLK1>, <&rcc SPI2_K>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
            clock-names = "pclk", "i2sclk", "x8k", "x11k";
            #clock-cells = <0>;
            pinctrl-names = "default", "sleep";
            pinctrl-0 = <&i2s2_pins_test_b>;
            pinctrl-1 = <&i2s2_pins_test_sleep_b>;
            status = "okay";
 
            i2s2_port: port {
                        i2s2_endpoint: endpoint {
                                   remote-endpoint = <&wm8994_endpoint>;
                                   format = "i2s";
                                   mclk-fs = <256>;
                        };
            };
 
            wm8994 {
                        …
                        clocks = <&i2s2>;
                        clock-names = "MCLK";
 
                        wm8994_port: port {
                                   wm8994_endpoint: endpoint {
                                               remote-endpoint = <&i2s2_endpoint>;
                                   };
                        };
            };

Hope it help

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.