Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 34503ab2 authored by Venkata Narendra Kumar Gutta's avatar Venkata Narendra Kumar Gutta Committed by Gerrit - the friendly Code Review server
Browse files

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: default avatarVenkata Narendra Kumar Gutta <vgutta@codeaurora.org>
parent 1c10389d
Loading
Loading
Loading
Loading
+11 −3
Original line number Original line Diff line number Diff line
/* 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
 * 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
 * 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",
		pr_err("%s: Received reset events CB, move to error state",
			__func__);
			__func__);
		spin_lock_irqsave(&prtd->lock, flags);
		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;
		prtd->copied_total = prtd->bytes_received;
		snd_compr_fragment_elapsed(cstream);
		atomic_set(&prtd->error, 1);
		atomic_set(&prtd->error, 1);
		wake_up(&prtd->drain_wait);
		wake_up(&prtd->drain_wait);
		if (atomic_cmpxchg(&prtd->eos, 1, 0)) {
		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;
	tstamp.copied_total = prtd->copied_total;
	first_buffer = prtd->first_buffer;
	first_buffer = prtd->first_buffer;
	if (atomic_read(&prtd->error)) {
	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__);
			__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;
		tstamp.pcm_io_frames = 0;
		memcpy(arg, &tstamp, sizeof(struct snd_compr_tstamp));
		memcpy(arg, &tstamp, sizeof(struct snd_compr_tstamp));
		spin_unlock_irqrestore(&prtd->lock, flags);
		spin_unlock_irqrestore(&prtd->lock, flags);