Skip to main content
DGami.1
Associate II
January 4, 2021
Question

ES8388 codec and STM32MP1 audio routing

  • January 4, 2021
  • 1 reply
  • 1571 views

Hi All,

i want to use ES8388 audio coec with STM32MP157.

All hardware connections are tested, ad i can see MCLK on scope, also codec is visible on I2C bus.

But i'm facing dificulties with Device Tree configuration.

snippet from my dts file :

sound {
 compatible = "audio-graph-card";
		widgets =
			"Headphone", "Headphone Jack";
 routing =
		 "Headphone Jack", "LOUT1",
			"Headphone Jack", "ROUT1"; 
 dais = <&sai2a_port>;
 status = "okay";
 };
........
&sai2 {
 clocks = <&rcc SAI2>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
 clock-names = "pclk", "x8k", "x11k";
 pinctrl-names = "default", "sleep";
 pinctrl-0 = <&sai2a_pins_a>, <&sai2b_pins_b>;
 pinctrl-1 = <&sai2a_sleep_pins_a>, <&sai2b_sleep_pins_b>;
 status = "okay";
 
 sai2a: audio-controller@4400b004 {
 #clock-cells = <0>;
 dma-names = "tx";
 clocks = <&rcc SAI2_K>;
 clock-names = "sai_ck";
 status = "okay";
 
 sai2a_port: port {
 sai2a_endpoint: endpoint {
 remote-endpoint = <&es8388_tx_endpoint>;
 format = "i2s";
 mclk-fs = <272>;
 // dai-tdm-slot-num = <2>;
 // dai-tdm-slot-width = <32>;
 };
 };
 };
};
..................
&i2c1 {
 pinctrl-names = "default", "sleep";
 pinctrl-0 = <&i2c1_pins_a>;
 pinctrl-1 = <&i2c1_sleep_pins_a>;
 i2c-scl-rising-time-ns = <100>;
 i2c-scl-falling-time-ns = <7>;
 status = "okay";
 /delete-property/dmas;
 /delete-property/dma-names;
	
	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>; 
 clock-names = "MCLK";
 es8388_port: port@0 {
 #address-cells = <1>;
 #size-cells = <0>;
 es8388_tx_endpoint: endpoint@0 {
 reg = <0>;	 
			 remote-endpoint = <&sai2a_endpoint>;
				frame-master;
 bitclock-master;
 
 };
	};

Codec is connected on sai2 port. Audio device is visible through aplay -l.

Best regards,

Dimitar

This topic has been closed for replies.

1 reply

Christophe Guibout
ST Employee
January 11, 2021

Hi @DGami.1​ ,

In the codec node, I see a potential problem :

clocks = <&sai2a>; 
clock-names = "MCLK";

which means that the clock is provided by SAI.

frame-master;
bitclock-master;

which means that the clock is provided by codec.

Please have a look into SAI device tree configuration wiki page which could help.

BR,

Christophe

EDIT : my comment is not clear enough because of "clock" naming, and this is not an issue.

The configuration means that CODEC is clocked by MCLK provided by SAI, and frame-master and bitlock-master mean that these signals are managed by CODEC instead of SAI.

So, you DT looks good.

Sorry for the inconvenience.

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.