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);