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 <vgutta@codeaurora.org>
This commit is contained in:
Venkata Narendra Kumar Gutta 2016-02-04 20:03:10 +05:30 committed by David Keitel
parent efbb7b3442
commit 80dd2957b7

View file

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