<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 30, 2023 at 6:30 PM Chancel Liu <<a href="mailto:chancel.liu@nxp.com">chancel.liu@nxp.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">There's an issue on SAI synchronous mode that TX/RX side can't get BCLK<br>
from RX/TX it sync with if BYP bit is asserted. It's a workaround to<br>
fix it that enable SION of IOMUX pad control and assert BCI.<br>
<br>
For example if TX sync with RX which means both TX and RX are using clk<br>
form RX and BYP=1. TX can get BCLK only if the following two conditions<br>
are valid:<br>
1. SION of RX BCLK IOMUX pad is set to 1<br>
2. BCI of TX is set to 1<br>
<br>
Signed-off-by: Chancel Liu <<a href="mailto:chancel.liu@nxp.com" target="_blank">chancel.liu@nxp.com</a>><br></blockquote><div><br></div><div>Acked-by: Shengjiu Wang <<a href="mailto:shengjiu.wang@gmail.com">shengjiu.wang@gmail.com</a>></div><div><br></div><div>Best regards</div><div>Wang Shengjiu </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
sound/soc/fsl/fsl_sai.c | 11 +++++++++--<br>
sound/soc/fsl/fsl_sai.h | 1 +<br>
2 files changed, 10 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c<br>
index d9344025dc16..5e09f634c61b 100644<br>
--- a/sound/soc/fsl/fsl_sai.c<br>
+++ b/sound/soc/fsl/fsl_sai.c<br>
@@ -491,14 +491,21 @@ static int fsl_sai_set_bclk(struct snd_soc_dai *dai, bool tx, u32 freq)<br>
regmap_update_bits(sai->regmap, reg, FSL_SAI_CR2_MSEL_MASK,<br>
FSL_SAI_CR2_MSEL(sai->mclk_id[tx]));<br>
<br>
- if (savediv == 1)<br>
+ if (savediv == 1) {<br>
regmap_update_bits(sai->regmap, reg,<br>
FSL_SAI_CR2_DIV_MASK | FSL_SAI_CR2_BYP,<br>
FSL_SAI_CR2_BYP);<br>
- else<br>
+ if (fsl_sai_dir_is_synced(sai, adir))<br>
+ regmap_update_bits(sai->regmap, FSL_SAI_xCR2(tx, ofs),<br>
+ FSL_SAI_CR2_BCI, FSL_SAI_CR2_BCI);<br>
+ else<br>
+ regmap_update_bits(sai->regmap, FSL_SAI_xCR2(tx, ofs),<br>
+ FSL_SAI_CR2_BCI, 0);<br>
+ } else {<br>
regmap_update_bits(sai->regmap, reg,<br>
FSL_SAI_CR2_DIV_MASK | FSL_SAI_CR2_BYP,<br>
savediv / 2 - 1);<br>
+ }<br>
<br>
if (sai->soc_data->max_register >= FSL_SAI_MCTL) {<br>
/* SAI is in master mode at this point, so enable MCLK */<br>
diff --git a/sound/soc/fsl/fsl_sai.h b/sound/soc/fsl/fsl_sai.h<br>
index 3eb994aef36a..8254c3547b87 100644<br>
--- a/sound/soc/fsl/fsl_sai.h<br>
+++ b/sound/soc/fsl/fsl_sai.h<br>
@@ -116,6 +116,7 @@<br>
<br>
/* SAI Transmit and Receive Configuration 2 Register */<br>
#define FSL_SAI_CR2_SYNC BIT(30)<br>
+#define FSL_SAI_CR2_BCI BIT(28)<br>
#define FSL_SAI_CR2_MSEL_MASK (0x3 << 26)<br>
#define FSL_SAI_CR2_MSEL_BUS 0<br>
#define FSL_SAI_CR2_MSEL_MCLK1 BIT(26)<br>
-- <br>
2.25.1<br>
<br>
</blockquote></div></div>