cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP135: SAI missing clock error at boot time

OPetr.2
Associate II

I generated the device tree for the STM32MP135-DK to include the tlv320aic31xx audio codec connected to the sai1a port, but during the boot I get the following errors.

[  90.094282] st,stm32-sai 4400a000.sai: missing x8k parent clock: -2

[  90.155023] st,stm32-sai: probe of 4400a000.sai failed with error -2

The audio codec is connected to one speaker without microphones.

How can I solve the problem?

Below is an excerpt from the device tree:

sound: sound {
compatible = "audio-graph-card";
label = "STM32MP135F-DK";
routing = "Playback", "MCLK1"; 
dais = <&sai1a_port>;
status = "okay";
};
 
&i2c1{
tlv320aic31xx: tlv320aic31xx@18 {
	compatible = "ti,tlv320aic3120";
	reg = <0x18>;
	ai31xx-micbias-vg = <MICBIAS_2_5V>;
	reset-gpios = <&gpioe 5 GPIO_ACTIVE_LOW>;
	HPVDD-supply = <&scmi_vdd>;
	SPRVDD-supply = <&scmi_vdd>;
	SPLVDD-supply = <&scmi_vdd>;
	AVDD-supply = <&scmi_vdd>;
	IOVDD-supply = <&scmi_vdd>;
	DVDD-supply = <&scmi_v1v8_periph>;
	clocks = <&sai1a>;
	clock-names = "MCLK1";
 
	ports {
			#address-cells = <1>;
			#size-cells = <0>;
			tlv320aic31xx_tx_port: port@0 {
				reg = <0>;
	         		tlv320aic31xx_tx_endpoint: endpoint {
					remote-endpoint = <&sai1a_endpoint>;
				};
			};
 		};	
  };
};
 
&sai1{
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&sai1a_pins_mx>;
	pinctrl-1 = <&sai1a_sleep_pins_mx>;
	status = "okay";
	/* USER CODE BEGIN sai1 */
	clocks = <&rcc SAI1>, <&rcc PLL3_Q>, <&rcc PLL3_R>;	
	clock-names = "pclk", "x8k", "x11k";
	/* USER CODE END sai1 */
 
	sai1a:audio-controller@4400a004{
		status = "okay";
		/* USER CODE BEGIN sai1a */
		compatible = "st,stm32-sai-sub-a";
		#clock-cells = <0>;
		dma-names = "tx";
		clocks = <&rcc SAI1_K>;
		clock-names = "sai_ck";
 
		sai1a_port: port {
			sai1a_endpoint: endpoint {
				remote-endpoint = <&tlv320aic31xx_tx_endpoint>;
				format = "i2s";
				mclk-fs = <512>;
			};
		};
		/* USER CODE END sai1a */
	};
};
 

3 REPLIES 3
Erwan SZYMANSKI
ST Employee

Hello @OPetr.2​ ,

Can you try to change the clock provider in your device tree ?

Since OSTL v4.X, these clocks are provided by secure world, and not rcc directly.

So I would like to try this:

clocks = <&rcc SAI1>, <&scmi_clk CK_SCMI_PLL3_Q>, <&scmi_clk CK_SCMI_PLL3_R>;

Kind regards,

Erwan.

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.
OPetr.2
Associate II

After your suggestion, the previous error is no more present, but I see the following issues:


_legacyfs_online_stmicro_images_0693W00000bkScIQAU.pngthe sound card does not find the MCLK1 signal and sai1 clock are not enabled ( i do not understand the "?" in hardware enabled column).

The device tree is the same as before but with your line

clocks = <&rcc SAI1>, <&scmi_clk CK_SCMI_PLL3_Q>, <&scmi_clk CK_SCMI_PLL3_R>;

Regards,

Orlando

Hi @OPetr.2​ ,

It is highly possible that your codec's driver does not enable your master clock when you ask for a Playback. The best way to check it is the oscilloscope, that will answer you clearly.

So now, how to proceed ?

On STM32MP157x series, we have a cirrus codec included inside, and we so declare it and use it in our system. The driver is the cs42l51.c file in sound/soc/codecs/.

On the ST kernel, you can see our modification brought with the commit 318e741ee13b5a72f3051d9bb6852b1f4d02d0bb:

------------------------------------------

ASoC: cs42l51: fix mclk support

The MCLK clock is made optional for cs42l51 codec.

However, ASoC DAPM clock supply widget, expects the clock to be defined

unconditionally.

Register MCLK DAPM conditionally in codec driver,

depending on clock presence in DT.

Fixes: 5e8d63a726f8 ("ASoC: cs42l51: add mclk support")

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>

Signed-off-by: Mark Brown <broonie@kernel.org>

-------------------------------------------------

I advice you to bring the needed modifications in the driver, to enable the MCLK when you ask for a playback, and release it when your playback is over. As concerns the device tree configuration, it is given in the following article for the same example: https://wiki.st.com/stm32mpu/wiki/SAI_device_tree_configuration#Setting_SAI_as_a_master_clock_provider.

Please keep me in touch if you can go forward on this.

Kind regards,

Erwan.

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.