audio: audio glitch at tdm startup [1/1]

PD#SWPL-5219

Problem:
audio glitch at tdm startup

Solution:
Pad 0 data to clear the remaining data
in the module.

Verify:
Local tested.

Change-Id: Iab526c6893a32030799567b57e05e7bb11b8fea0
Signed-off-by: Shuai Li <shuai.li@amlogic.com>
This commit is contained in:
Shuai Li
2019-03-01 21:48:35 +08:00
committed by Luan Yuan
parent 636c60fcba
commit 47425f47c1
2 changed files with 24 additions and 13 deletions

View File

@@ -1175,6 +1175,9 @@ static int aml_dai_spdif_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
dev_info(substream->pcm->card->dev, "S/PDIF Playback disable\n");
memset(substream->runtime->dma_area,
0, substream->runtime->dma_bytes);
mdelay(3);
aml_frddr_enable(p_spdif->fddr, 0);
} else {
dev_info(substream->pcm->card->dev, "S/PDIF Capture disable\n");

View File

@@ -510,16 +510,6 @@ static int aml_dai_tdm_trigger(struct snd_pcm_substream *substream, int cmd,
{
struct aml_tdm *p_tdm = snd_soc_dai_get_drvdata(cpu_dai);
/* share buffer trigger */
if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
&& p_tdm->chipinfo
&& p_tdm->chipinfo->same_src_fn
&& (p_tdm->samesource_sel >= 0)
&& (aml_check_sharebuffer_valid(p_tdm->fddr,
p_tdm->samesource_sel))) {
sharebuffer_trigger(cmd, p_tdm->samesource_sel);
}
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
@@ -541,6 +531,14 @@ static int aml_dai_tdm_trigger(struct snd_pcm_substream *substream, int cmd,
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
dev_info(substream->pcm->card->dev, "tdm playback enable\n");
/* share buffer trigger */
if (p_tdm->chipinfo
&& p_tdm->chipinfo->same_src_fn
&& (p_tdm->samesource_sel >= 0)
&& (aml_check_sharebuffer_valid(p_tdm->fddr,
p_tdm->samesource_sel))) {
sharebuffer_trigger(cmd, p_tdm->samesource_sel);
}
aml_frddr_enable(p_tdm->fddr, 1);
} else {
dev_info(substream->pcm->card->dev, "tdm capture enable\n");
@@ -561,16 +559,26 @@ static int aml_dai_tdm_trigger(struct snd_pcm_substream *substream, int cmd,
break;
}
aml_tdm_enable(p_tdm->actrl,
substream->stream, p_tdm->id, false);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
dev_info(substream->pcm->card->dev, "tdm playback stop\n");
memset(substream->runtime->dma_area,
0, substream->runtime->dma_bytes);
mdelay(3);
aml_frddr_enable(p_tdm->fddr, 0);
/* share buffer trigger */
if (p_tdm->chipinfo
&& p_tdm->chipinfo->same_src_fn
&& (p_tdm->samesource_sel >= 0)
&& (aml_check_sharebuffer_valid(p_tdm->fddr,
p_tdm->samesource_sel))) {
sharebuffer_trigger(cmd, p_tdm->samesource_sel);
}
} else {
dev_info(substream->pcm->card->dev, "tdm capture stop\n");
aml_toddr_enable(p_tdm->tddr, 0);
}
aml_tdm_enable(p_tdm->actrl,
substream->stream, p_tdm->id, false);
break;
default:
return -EINVAL;