ASoC: qdsp6v2: Flush record session during stop
It is recommended for record session to be flushed during
stop to ensure that there is no problem after resuming the
session.
Change-Id: I0bfc22f335e141630d473fc0dd9437a0b47e0785
Signed-off-by: Sidipotu Ashok <sashok@codeaurora.org>
diff --git a/asoc/msm-pcm-q6-v2.c b/asoc/msm-pcm-q6-v2.c
index 3792021..672396f 100644
--- a/asoc/msm-pcm-q6-v2.c
+++ b/asoc/msm-pcm-q6-v2.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2019, 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
@@ -591,6 +591,9 @@
if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK) {
prtd->enabled = STOPPED;
ret = q6asm_cmd_nowait(prtd->audio_client, CMD_PAUSE);
+ if (!ret)
+ ret = q6asm_cmd_nowait(prtd->audio_client,
+ CMD_FLUSH);
break;
}
/* pending CMD_EOS isn't expected */
diff --git a/dsp/q6asm.c b/dsp/q6asm.c
index 4091faf..a9772e2 100644
--- a/dsp/q6asm.c
+++ b/dsp/q6asm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
* Author: Brian Swetland <swetland@google.com>
*
* This software is licensed under the terms of the GNU General Public
@@ -9736,6 +9736,12 @@
pr_debug("%s: CMD_PAUSE\n", __func__);
hdr.opcode = ASM_SESSION_CMD_PAUSE;
break;
+
+ case CMD_FLUSH:
+ pr_debug("%s: CMD_FLUSH\n", __func__);
+ hdr.opcode = ASM_STREAM_CMD_FLUSH;
+ break;
+
case CMD_EOS:
pr_debug("%s: CMD_EOS\n", __func__);
hdr.opcode = ASM_DATA_CMD_EOS;