summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaynes Mathew George <hgeorge@codeaurora.org>2016-08-05 19:04:57 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-09-16 03:18:24 -0700
commit8a52055cdef35e63eb4e052f6853d6bc0d8730ca (patch)
treec4b8ca936c8375ec57358eeb90d9aa63b967e9bd
parentd2afad6a903bdda2f803fae49f0b0001d12f8600 (diff)
ASoC: msm: qdsp6v2: Change device switch handling
First cut of NOIRQ driver used a sequence of trigger commands (PAUSE, STOP, RESUME) to handle device switch. This led to a state transition issue where after resume trigger, the state of the stream would change to OPEN instead of RUNNING. To fix this, clients are expected to do RESET ioctl instead. RESET ioctl does not change the state of the stream. Bug: 30615611 CRs-Fixed: 1051762 Change-Id: Ife6146d28c8bc834a79e861959eca03e58e12d5e Signed-off-by: Haynes Mathew George <hgeorge@codeaurora.org>
-rw-r--r--sound/soc/msm/qdsp6v2/msm-pcm-q6-noirq.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-q6-noirq.c b/sound/soc/msm/qdsp6v2/msm-pcm-q6-noirq.c
index 972cacb50f47..1fdb878a1a1f 100644
--- a/sound/soc/msm/qdsp6v2/msm-pcm-q6-noirq.c
+++ b/sound/soc/msm/qdsp6v2/msm-pcm-q6-noirq.c
@@ -395,6 +395,30 @@ static int msm_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
return ret;
}
+static int msm_pcm_ioctl(struct snd_pcm_substream *substream,
+ unsigned int cmd, void *arg)
+{
+ struct snd_pcm_runtime *runtime = substream->runtime;
+ struct msm_audio *prtd = runtime->private_data;
+ int dir = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? 0 : 1;
+ struct audio_buffer *buf;
+
+ switch (cmd) {
+ case SNDRV_PCM_IOCTL1_RESET:
+ pr_debug("%s: %s SNDRV_PCM_IOCTL1_RESET\n", __func__,
+ dir == 0 ? "P" : "C");
+ buf = q6asm_shared_io_buf(prtd->audio_client, dir);
+
+ if (buf && buf->data)
+ memset(buf->data, 0, buf->actual_size);
+ break;
+ default:
+ break;
+ }
+
+ return snd_pcm_lib_ioctl(substream, cmd, arg);
+}
+
static snd_pcm_uframes_t msm_pcm_pointer(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
@@ -728,7 +752,7 @@ static struct snd_pcm_ops msm_pcm_ops = {
.prepare = msm_pcm_prepare,
.copy = msm_pcm_copy,
.hw_params = msm_pcm_hw_params,
- .ioctl = snd_pcm_lib_ioctl,
+ .ioctl = msm_pcm_ioctl,
.trigger = msm_pcm_trigger,
.pointer = msm_pcm_pointer,
.mmap = msm_pcm_mmap,