Clock signal not generating in MCLK_SAI3 Pin in Android 15

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Clock signal not generating in MCLK_SAI3 Pin in Android 15

Jump to solution
181 Views
subash_p
Contributor III

Hi,

I'm trying to enable the SGTL5000 audio chip on my custom i.MX8MP board running Android 15. For the SGTL5000 to work, the MCLK signal needs to remain in an "always-on" state. When I reboot the board, I can see the clock signal being generated for about 5 seconds, but after that, it goes low. I will share the device tree nodes and debug results below.

codec: sgtl5000@a {
compatible = "fsl,sgtl5000";
reg = <0x0a>;
clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1>;
clock-names = "mclk";
pinctrl-names = "default";
};


&sai3 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai3>;
assigned-clocks = <&clk IMX8MP_CLK_SAI3>;
assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
assigned-clock-rates = <12288000>;
clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI3_IPG>, <&clk IMX8MP_CLK_DUMMY>,
<&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1>, <&clk IMX8MP_CLK_DUMMY>,
<&clk IMX8MP_CLK_DUMMY>;
clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
fsl,sai-mclk-direction-output;
fsl,sai-mclk-always-on;
status = "okay";
};

pinctrl_sai3: sai3grp {
fsl,pins = <
MX8MP_IOMUXC_SAI3_TXFS__AUDIOMIX_SAI3_TX_SYNC 0xd6
MX8MP_IOMUXC_SAI3_TXC__AUDIOMIX_SAI3_TX_BCLK 0xd6
MX8MP_IOMUXC_SAI3_RXD__AUDIOMIX_SAI3_RX_DATA00 0xd6
MX8MP_IOMUXC_SAI3_TXD__AUDIOMIX_SAI3_TX_DATA00 0xd6
MX8MP_IOMUXC_SAI3_MCLK__AUDIOMIX_SAI3_MCLK 0xd6
MX8MP_IOMUXC_SAI3_RXFS__GPIO4_IO28 0xd6
MX8MP_IOMUXC_SAI3_RXC__GPIO4_IO29 0xd6
>;
};
0 Kudos
Reply
1 Solution
160 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

By default, SAI MCLK is active after SAI driver is called, and de-active when the callback is ended.

e.g when aplay starts, MCLK is active; when aplay stops, MLCK is de-active.

In this customer's case, we need to enable MCLK at system bootup.

Solution:
We can enable sai MCLK in sai probe stage, add the following in fsl_sai.c -> fsl_sai_probe:

clk_prepare_enable(sai->bus_clk);
clk_prepare_enable(sai->mclk_clk[1]);
regmap_update_bits(sai->regmap, FSL_SAI_MCTL,
FSL_SAI_MCTL_MCLK_EN, FSL_SAI_MCTL_MCLK_EN);
regmap_update_bits(sai->regmap, FSL_SAI_TCSR(8),
FSL_SAI_CSR_TERE, FSL_SAI_CSR_TERE);

Then SAI MCLK can be active when the system bootup.

But, after SAI driver callback ends (e.g aplay ends), MCLK will be de-active again. The reason is that in sai trigger stop, the transmitter is disabled. To keep the MCLK always on, need to keep transmitter always on. To be more specific, do not clear FSL_SAI_CSR_TERE in trigger stop.

Best regards.

View solution in original post

0 Kudos
Reply
1 Reply
161 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

By default, SAI MCLK is active after SAI driver is called, and de-active when the callback is ended.

e.g when aplay starts, MCLK is active; when aplay stops, MLCK is de-active.

In this customer's case, we need to enable MCLK at system bootup.

Solution:
We can enable sai MCLK in sai probe stage, add the following in fsl_sai.c -> fsl_sai_probe:

clk_prepare_enable(sai->bus_clk);
clk_prepare_enable(sai->mclk_clk[1]);
regmap_update_bits(sai->regmap, FSL_SAI_MCTL,
FSL_SAI_MCTL_MCLK_EN, FSL_SAI_MCTL_MCLK_EN);
regmap_update_bits(sai->regmap, FSL_SAI_TCSR(8),
FSL_SAI_CSR_TERE, FSL_SAI_CSR_TERE);

Then SAI MCLK can be active when the system bootup.

But, after SAI driver callback ends (e.g aplay ends), MCLK will be de-active again. The reason is that in sai trigger stop, the transmitter is disabled. To keep the MCLK always on, need to keep transmitter always on. To be more specific, do not clear FSL_SAI_CSR_TERE in trigger stop.

Best regards.

0 Kudos
Reply