Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: fsl_sai: Enable BCI bit if SAI works on synchronous mode with BYP asserted

There's an issue on SAI synchronous mode that TX/RX side can't get BCLK
from RX/TX it sync with if BYP bit is asserted. It's a workaround to
fix it that enable SION of IOMUX pad control and assert BCI.

For example if TX sync with RX which means both TX and RX are using clk
form RX and BYP=1. TX can get BCLK only if the following two conditions
are valid:
1. SION of RX BCLK IOMUX pad is set to 1
2. BCI of TX is set to 1

Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://lore.kernel.org/r/20230530103012.3448838-1-chancel.liu@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Chancel Liu and committed by
Mark Brown
32cf0046 635071f5

+10 -2
+9 -2
sound/soc/fsl/fsl_sai.c
··· 491 491 regmap_update_bits(sai->regmap, reg, FSL_SAI_CR2_MSEL_MASK, 492 492 FSL_SAI_CR2_MSEL(sai->mclk_id[tx])); 493 493 494 - if (savediv == 1) 494 + if (savediv == 1) { 495 495 regmap_update_bits(sai->regmap, reg, 496 496 FSL_SAI_CR2_DIV_MASK | FSL_SAI_CR2_BYP, 497 497 FSL_SAI_CR2_BYP); 498 - else 498 + if (fsl_sai_dir_is_synced(sai, adir)) 499 + regmap_update_bits(sai->regmap, FSL_SAI_xCR2(tx, ofs), 500 + FSL_SAI_CR2_BCI, FSL_SAI_CR2_BCI); 501 + else 502 + regmap_update_bits(sai->regmap, FSL_SAI_xCR2(tx, ofs), 503 + FSL_SAI_CR2_BCI, 0); 504 + } else { 499 505 regmap_update_bits(sai->regmap, reg, 500 506 FSL_SAI_CR2_DIV_MASK | FSL_SAI_CR2_BYP, 501 507 savediv / 2 - 1); 508 + } 502 509 503 510 if (sai->soc_data->max_register >= FSL_SAI_MCTL) { 504 511 /* SAI is in master mode at this point, so enable MCLK */
+1
sound/soc/fsl/fsl_sai.h
··· 116 116 117 117 /* SAI Transmit and Receive Configuration 2 Register */ 118 118 #define FSL_SAI_CR2_SYNC BIT(30) 119 + #define FSL_SAI_CR2_BCI BIT(28) 119 120 #define FSL_SAI_CR2_MSEL_MASK (0x3 << 26) 120 121 #define FSL_SAI_CR2_MSEL_BUS 0 121 122 #define FSL_SAI_CR2_MSEL_MCLK1 BIT(26)