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.