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.
Solved! Go to Solution.
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.
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.