From 1c546b1de47e9f078f308c4caf81c361d9a17b3b Mon Sep 17 00:00:00 2001
From: Haynes Mathew George <hgeorge@codeaurora.org>
Date: Mon, 19 Jan 2015 15:24:33 -0800
Subject: [PATCH] ASoC: msm: qdsp6v2: Fix timestamp query during gapless
 transition

A query for the current playback position during a gapless transition
must return the most recent playback position until the first buffer
from the next stream has been sent to DSP.

Change-Id: I958a64e74995e6c1d8aaeda2c8cabf9a6d88c143
Bug: 18709620
Signed-off-by: Haynes Mathew George <hgeorge@codeaurora.org>
(cherry picked from commit db3f302aa4a662484340d2c93c9666e00b68cc5c)
---
 sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c b/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c
index 7174015e4e68..7c3f8735831f 100644
--- a/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c
+++ b/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c
@@ -1507,6 +1507,7 @@ static int msm_compr_pointer(struct snd_compr_stream *cstream,
 	uint64_t timestamp = 0;
 	int rc = 0, first_buffer;
 	unsigned long flags;
+	uint32_t gapless_transition;
 
 	pr_debug("%s\n", __func__);
 	memset(&tstamp, 0x0, sizeof(struct snd_compr_tstamp));
@@ -1526,13 +1527,17 @@ static int msm_compr_pointer(struct snd_compr_stream *cstream,
 		return -EINVAL;
 	}
 
+	gapless_transition = prtd->gapless_state.gapless_transition;
 	spin_unlock_irqrestore(&prtd->lock, flags);
 
 	/*
 	 Query timestamp from DSP if some data is with it.
 	 This prevents timeouts.
 	*/
-	if (!first_buffer) {
+	if (!first_buffer || gapless_transition) {
+		if (gapless_transition)
+			pr_debug("session time in gapless transition");
+
 		rc = q6asm_get_session_time(prtd->audio_client, &timestamp);
 		if (rc < 0) {
 			pr_err("%s: Get Session Time return value =%lld\n",
-- 
GitLab