Skip to content

Commit 14e8442

Browse files
TE-N-ShengjiuWangbroonie
authored andcommitted
ASoC: fsl_sai: Fix no frame sync clock issue on i.MX8MP
On i.MX8MP, when the TERE and FSD_MSTR enabled before configuring the word width, there will be no frame sync clock issue, because old word width impact the generation of frame sync. TERE enabled earlier only for i.MX8MP case for the hardware limitation, So need to disable FSD_MSTR before configuring word width, then enable FSD_MSTR bit for this specific case. Fixes: 3e4a826 ("ASoC: fsl_sai: MCLK bind with TX/RX enable bit") Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Link: https://lore.kernel.org/r/1700474735-3863-1-git-send-email-shengjiu.wang@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 3bdaf69 commit 14e8442

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

sound/soc/fsl/fsl_sai.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,13 +673,34 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream,
673673
FSL_SAI_CR3_TRCE_MASK,
674674
FSL_SAI_CR3_TRCE((dl_cfg[dl_cfg_idx].mask[tx] & trce_mask)));
675675

676+
/*
677+
* When the TERE and FSD_MSTR enabled before configuring the word width
678+
* There will be no frame sync clock issue, because word width impact
679+
* the generation of frame sync clock.
680+
*
681+
* TERE enabled earlier only for i.MX8MP case for the hardware limitation,
682+
* We need to disable FSD_MSTR before configuring word width, then enable
683+
* FSD_MSTR bit for this specific case.
684+
*/
685+
if (sai->soc_data->mclk_with_tere && sai->mclk_direction_output &&
686+
!sai->is_consumer_mode)
687+
regmap_update_bits(sai->regmap, FSL_SAI_xCR4(tx, ofs),
688+
FSL_SAI_CR4_FSD_MSTR, 0);
689+
676690
regmap_update_bits(sai->regmap, FSL_SAI_xCR4(tx, ofs),
677691
FSL_SAI_CR4_SYWD_MASK | FSL_SAI_CR4_FRSZ_MASK |
678692
FSL_SAI_CR4_CHMOD_MASK,
679693
val_cr4);
680694
regmap_update_bits(sai->regmap, FSL_SAI_xCR5(tx, ofs),
681695
FSL_SAI_CR5_WNW_MASK | FSL_SAI_CR5_W0W_MASK |
682696
FSL_SAI_CR5_FBT_MASK, val_cr5);
697+
698+
/* Enable FSD_MSTR after configuring word width */
699+
if (sai->soc_data->mclk_with_tere && sai->mclk_direction_output &&
700+
!sai->is_consumer_mode)
701+
regmap_update_bits(sai->regmap, FSL_SAI_xCR4(tx, ofs),
702+
FSL_SAI_CR4_FSD_MSTR, FSL_SAI_CR4_FSD_MSTR);
703+
683704
regmap_write(sai->regmap, FSL_SAI_xMR(tx),
684705
~0UL - ((1 << min(channels, slots)) - 1));
685706

0 commit comments

Comments
 (0)