From 8db438cca0db431202f773243586fb4a7c145ba8 Mon Sep 17 00:00:00 2001 From: Xing Wang Date: Tue, 27 Mar 2018 16:40:22 +0800 Subject: [PATCH] audio: auge: share buffer only for playback PD#162769: audio: auge: share buffer only for playback Change-Id: I5313a52ef493ee699a173370a82657bf27a43008 Signed-off-by: Xing Wang --- sound/soc/amlogic/auge/tdm.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sound/soc/amlogic/auge/tdm.c b/sound/soc/amlogic/auge/tdm.c index 9b72816469ac..c3d3b2d87c7e 100644 --- a/sound/soc/amlogic/auge/tdm.c +++ b/sound/soc/amlogic/auge/tdm.c @@ -490,8 +490,9 @@ 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 (p_tdm->chipinfo && - p_tdm->chipinfo->same_src_fn) { + if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + && p_tdm->chipinfo + && p_tdm->chipinfo->same_src_fn) { if (p_tdm->samesource_sel >= 0) sharebuffer_trigger(cmd, p_tdm->samesource_sel); } @@ -672,7 +673,8 @@ static int aml_dai_tdm_hw_params(struct snd_pcm_substream *substream, } /* share buffer trigger */ - if (p_tdm->chipinfo + if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + && p_tdm->chipinfo && (p_tdm->chipinfo->same_src_fn) && (p_tdm->samesource_sel >= 0)) { int mux = 0, ratio = 0; @@ -700,8 +702,10 @@ static int aml_dai_tdm_hw_free(struct snd_pcm_substream *substream, substream->stream, p_tdm->id, i, 0); /* share buffer free */ - if (p_tdm->chipinfo && - p_tdm->chipinfo->same_src_fn && fr) { + if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + && p_tdm->chipinfo + && p_tdm->chipinfo->same_src_fn + && fr) { if (p_tdm->samesource_sel >= 0) sharebuffer_free(substream, fr, p_tdm->samesource_sel);