summaryrefslogtreecommitdiff
path: root/sound/soc/fsl/fsl_sai.c
diff options
context:
space:
mode:
authorShengjiu Wang <shengjiu.wang@freescale.com>2014-12-29 13:40:08 +0800
committerDong Aisheng <aisheng.dong@nxp.com>2019-11-25 15:53:35 +0800
commit9401ad6c72f83e52b262812199dca0fd7c5203ad (patch)
tree5cdadba6afb317c6f361cbbde2766946a9762c41 /sound/soc/fsl/fsl_sai.c
parenta7e3a722ede6f28b4307dbe3c1a77c7662fb02a9 (diff)
MLK-9974: ASoC: fsl_sai: There is underrun detected in the beginning sometimes
Write initial words to SAI FIFO to reduce underrun error Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com> (cherry picked from commit 7ba8ae883d84540fac5ed4147d124399537bc0b3) (cherry picked from commit f4435f35aa2a97551d2c4a12ca316c354a880f85)
Diffstat (limited to 'sound/soc/fsl/fsl_sai.c')
-rw-r--r--sound/soc/fsl/fsl_sai.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index d58cc3ae90d8..b62c454e01cf 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -506,7 +506,9 @@ static int fsl_sai_trigger(struct snd_pcm_substream *substream, int cmd,
{
struct fsl_sai *sai = snd_soc_dai_get_drvdata(cpu_dai);
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ u8 channels = substream->runtime->channels;
u32 xcsr, count = 100;
+ int i;
/*
* Asynchronous mode: Clear SYNC for both Tx and Rx.
@@ -529,6 +531,11 @@ static int fsl_sai_trigger(struct snd_pcm_substream *substream, int cmd,
regmap_update_bits(sai->regmap, FSL_SAI_xCSR(tx),
FSL_SAI_CSR_FRDE, FSL_SAI_CSR_FRDE);
+ for (i = 0; tx && i < channels; i++)
+ regmap_write(sai->regmap, FSL_SAI_TDR, 0x0);
+ if (tx)
+ udelay(10);
+
regmap_update_bits(sai->regmap, FSL_SAI_RCSR,
FSL_SAI_CSR_TERE, FSL_SAI_CSR_TERE);
regmap_update_bits(sai->regmap, FSL_SAI_TCSR,