From 80dd2957b7118d920f9a60d137e240dc6cd7dba8 Mon Sep 17 00:00:00 2001 From: Venkata Narendra Kumar Gutta Date: Thu, 4 Feb 2016 20:03:10 +0530 Subject: ASoC: msm: qdsp6v2: Fix compress offload playback failures during SSR Compress offload playback failures observed if SSR is triggered during playback. Compress_write is blocked as there are no bytes consumed by the DSP. During SSR, based on the reset events, driver has to update the bytes copied by the DSP so that write gets unblocked. CRs-Fixed: 966659 Change-Id: I24d5bf09b3453f101adb9487298e6fbdfeb15e4a Signed-off-by: Venkata Narendra Kumar Gutta --- sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c b/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c index 77520c6addec..796fbe6d1e8a 100755 --- a/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c +++ b/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -588,8 +588,12 @@ static void compr_event_handler(uint32_t opcode, pr_err("%s: Received reset events CB, move to error state", __func__); spin_lock_irqsave(&prtd->lock, flags); - snd_compr_fragment_elapsed(cstream); + /* + * Since ADSP is down, let this driver pretend that it copied + * all the bytes received, so that next write will be triggered + */ prtd->copied_total = prtd->bytes_received; + snd_compr_fragment_elapsed(cstream); atomic_set(&prtd->error, 1); wake_up(&prtd->drain_wait); if (atomic_cmpxchg(&prtd->eos, 1, 0)) { @@ -1891,8 +1895,12 @@ static int msm_compr_pointer(struct snd_compr_stream *cstream, tstamp.copied_total = prtd->copied_total; first_buffer = prtd->first_buffer; if (atomic_read(&prtd->error)) { - pr_err("%s Got RESET EVENTS notification, return error", + pr_err("%s Got RESET EVENTS notification, return error\n", __func__); + if (cstream->direction == SND_COMPRESS_PLAYBACK) + runtime->total_bytes_transferred = tstamp.copied_total; + else + runtime->total_bytes_available = tstamp.copied_total; tstamp.pcm_io_frames = 0; memcpy(arg, &tstamp, sizeof(struct snd_compr_tstamp)); spin_unlock_irqrestore(&prtd->lock, flags); -- cgit v1.2.3