Skip to content

Commit 32cf004

Browse files
Chancel Liubroonie
authored andcommitted
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>
1 parent 635071f commit 32cf004

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

sound/soc/fsl/fsl_sai.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,14 +491,21 @@ static int fsl_sai_set_bclk(struct snd_soc_dai *dai, bool tx, u32 freq)
491491
regmap_update_bits(sai->regmap, reg, FSL_SAI_CR2_MSEL_MASK,
492492
FSL_SAI_CR2_MSEL(sai->mclk_id[tx]));
493493

494-
if (savediv == 1)
494+
if (savediv == 1) {
495495
regmap_update_bits(sai->regmap, reg,
496496
FSL_SAI_CR2_DIV_MASK | FSL_SAI_CR2_BYP,
497497
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 {
499505
regmap_update_bits(sai->regmap, reg,
500506
FSL_SAI_CR2_DIV_MASK | FSL_SAI_CR2_BYP,
501507
savediv / 2 - 1);
508+
}
502509

503510
if (sai->soc_data->max_register >= FSL_SAI_MCTL) {
504511
/* SAI is in master mode at this point, so enable MCLK */

sound/soc/fsl/fsl_sai.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116

117117
/* SAI Transmit and Receive Configuration 2 Register */
118118
#define FSL_SAI_CR2_SYNC BIT(30)
119+
#define FSL_SAI_CR2_BCI BIT(28)
119120
#define FSL_SAI_CR2_MSEL_MASK (0x3 << 26)
120121
#define FSL_SAI_CR2_MSEL_BUS 0
121122
#define FSL_SAI_CR2_MSEL_MCLK1 BIT(26)

0 commit comments

Comments
 (0)