From f4df90b9ce6c354048662056161d1daa0eaca709 Mon Sep 17 00:00:00 2001 From: Iuliana Prodan Date: Sun, 9 Apr 2023 00:23:33 +0300 Subject: [PATCH] imx: sai: enable transmitter to output MCLK On i.MX8MP, the SAI MCLK is bound with TX enable bit. Therefore, in order to enable MCLK, we need to enable the transmitter. This fixes a "wm8962 2-001a: DC servo timed out" - a Linux Kernel error with wm8962 codec. Signed-off-by: Laurentiu Mihalcea Signed-off-by: Iuliana Prodan --- src/drivers/imx/sai.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/drivers/imx/sai.c b/src/drivers/imx/sai.c index 4e7366e2200e..6ab240b49e95 100644 --- a/src/drivers/imx/sai.c +++ b/src/drivers/imx/sai.c @@ -89,10 +89,6 @@ static void sai_start(struct dai *dai, int direction) /* enable DMA requests */ dai_update_bits(dai, REG_SAI_XCSR(direction), REG_SAI_CSR_FRDE, REG_SAI_CSR_FRDE); -#ifdef CONFIG_IMX8M - dai_update_bits(dai, REG_SAI_MCTL, REG_SAI_MCTL_MCLK_EN, - REG_SAI_MCTL_MCLK_EN); -#endif chan_idx = BIT(0); /* RX3 supports capture on imx8ulp */ @@ -364,6 +360,17 @@ static inline int sai_set_config(struct dai *dai, struct ipc_config_dai *common_ dai_update_bits(dai, REG_SAI_XMR(REG_RX_DIR), REG_SAI_XMR_MASK, twm); +#ifdef CONFIG_IMX8M + /* + * For i.MX8MP, MCLK is bound with TX enable bit. + * Therefore, enable transmitter to output MCLK + */ + dai_update_bits(dai, REG_SAI_XCSR(DAI_DIR_PLAYBACK), + REG_SAI_CSR_TERE, REG_SAI_CSR_TERE); + dai_update_bits(dai, REG_SAI_MCTL, REG_SAI_MCTL_MCLK_EN, + REG_SAI_MCTL_MCLK_EN); +#endif + return 0; }