From 28feaa0fea6afd065d6cf45a5fd8f95d38aa5f70 Mon Sep 17 00:00:00 2001 From: Laxminath Kasam Date: Tue, 5 Jun 2012 19:01:54 +0530 Subject: [PATCH] msm: Asoc: LPA: Fix pause and next clip play issue - When paused and press next button to play next song, sometimes CMD_EOS fails to get Ack from LPASS and is wait timeout for 5sec causing delay for next playback start. - In the failure case, even before trigger start of driver is done,LPA driver receives pcm_close. In this case, though EOS is issued, it is not getting honored from LPASS. - If trigger start not happen in LPA driver, avoid CMD_EOS to LPASS as it will not be handled. CRs-Fixed: 368519, 366926 Change-Id: Ib5ff21925bb44849b27ed4709b72efcccf412b5d Signed-off-by: Laxminath Kasam --- sound/soc/msm/msm-pcm-lpa.c | 7 ++++++- sound/soc/msm/msm-pcm-q6.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sound/soc/msm/msm-pcm-lpa.c b/sound/soc/msm/msm-pcm-lpa.c index 3cab34f90dd..66a88540ff1 100644 --- a/sound/soc/msm/msm-pcm-lpa.c +++ b/sound/soc/msm/msm-pcm-lpa.c @@ -232,10 +232,12 @@ static int msm_pcm_trigger(struct snd_pcm_substream *substream, int cmd) pr_debug("SNDRV_PCM_TRIGGER_START\n"); q6asm_run_nowait(prtd->audio_client, 0, 0, 0); atomic_set(&prtd->start, 1); + atomic_set(&prtd->stop, 0); break; case SNDRV_PCM_TRIGGER_STOP: pr_debug("SNDRV_PCM_TRIGGER_STOP\n"); atomic_set(&prtd->start, 0); + atomic_set(&prtd->stop, 1); if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK) break; break; @@ -323,6 +325,7 @@ static int msm_pcm_open(struct snd_pcm_substream *substream) prtd->dsp_cnt = 0; atomic_set(&prtd->pending_buffer, 1); + atomic_set(&prtd->stop, 1); runtime->private_data = prtd; lpa_audio.prtd = prtd; lpa_set_volume(lpa_audio.volume); @@ -366,7 +369,8 @@ static int msm_pcm_playback_close(struct snd_pcm_substream *substream) To issue EOS to dsp, we need to be run state otherwise EOS is not honored. */ - if (msm_routing_check_backend_enabled(soc_prtd->dai_link->be_id)) { + if (msm_routing_check_backend_enabled(soc_prtd->dai_link->be_id) && + (!atomic_read(&prtd->stop))) { rc = q6asm_run(prtd->audio_client, 0, 0, 0); atomic_set(&prtd->pending_buffer, 0); prtd->cmd_ack = 0; @@ -386,6 +390,7 @@ static int msm_pcm_playback_close(struct snd_pcm_substream *substream) q6asm_audio_client_buf_free_contiguous(dir, prtd->audio_client); + atomic_set(&prtd->stop, 1); pr_debug("%s\n", __func__); msm_pcm_routing_dereg_phy_stream(soc_prtd->dai_link->be_id, SNDRV_PCM_STREAM_PLAYBACK); diff --git a/sound/soc/msm/msm-pcm-q6.h b/sound/soc/msm/msm-pcm-q6.h index e5551ea68f7..9e743a73f91 100644 --- a/sound/soc/msm/msm-pcm-q6.h +++ b/sound/soc/msm/msm-pcm-q6.h @@ -71,6 +71,7 @@ struct msm_audio { int close_ack; int cmd_ack; atomic_t start; + atomic_t stop; atomic_t out_count; atomic_t in_count; atomic_t out_needed;