ASoC: msm: Return proper error codes

Return proper error codes back to ASoc framework if
trigger operations like flush, drain fails or gets interrupted.

Change-Id: I3e2a259b55d5619eac6122083a8936a85700d657
Signed-off-by: Eric Laurent <elaurent@google.com>
Git-commit: 3a14d1af02c52d19d698732f3772f07843c90f6c
Git-repo: https://android.googlesource.com/kernel/msm
[dhakumar@codeaurora.org: resolved merge conflicts]
Signed-off-by: Dhananjay Kumar <dhakumar@codeaurora.org>
This commit is contained in:
Eric Laurent 2013-11-11 14:11:59 +05:30 committed by David Keitel
parent 5cd46b0657
commit 0f65a07b71

View file

@ -562,7 +562,7 @@ static int msm_compr_trigger(struct snd_compr_stream *cstream, int cmd)
spin_unlock_irq(&prtd->lock); spin_unlock_irq(&prtd->lock);
spin_lock_irq(&prtd->lock); spin_lock_irq(&prtd->lock);
/* only reset if flush was successful */ /* FIXME. only reset if flush was successful */
prtd->byte_offset = 0; prtd->byte_offset = 0;
prtd->copied_total = 0; prtd->copied_total = 0;
prtd->app_pointer = 0; prtd->app_pointer = 0;
@ -589,6 +589,7 @@ static int msm_compr_trigger(struct snd_compr_stream *cstream, int cmd)
if (!atomic_read(&prtd->start)) { if (!atomic_read(&prtd->start)) {
pr_err("%s: stream is not in started state\n", pr_err("%s: stream is not in started state\n",
__func__); __func__);
rc = -EPERM;
spin_unlock_irq(&prtd->lock); spin_unlock_irq(&prtd->lock);
break; break;
} }
@ -601,12 +602,14 @@ static int msm_compr_trigger(struct snd_compr_stream *cstream, int cmd)
pr_debug("%s: wait till all the data is sent to dsp\n", pr_debug("%s: wait till all the data is sent to dsp\n",
__func__); __func__);
rc = wait_event_interruptible(prtd->drain_wait, rc = wait_event_interruptible(prtd->drain_wait,
prtd->drain_ready); prtd->cmd_interrupt || prtd->drain_ready);
} else } else
spin_unlock_irq(&prtd->lock); spin_unlock_irq(&prtd->lock);
if (!atomic_read(&prtd->start)) { if (!atomic_read(&prtd->start) || prtd->cmd_interrupt) {
pr_err("%s: stream is not started\n", __func__); pr_err("%s: stream is not started\n", __func__);
rc = -EINTR;
prtd->cmd_interrupt = 0;
break; break;
} }
@ -616,7 +619,7 @@ static int msm_compr_trigger(struct snd_compr_stream *cstream, int cmd)
q6asm_cmd_nowait(prtd->audio_client, CMD_EOS); q6asm_cmd_nowait(prtd->audio_client, CMD_EOS);
if (cmd == SND_COMPR_TRIGGER_PARTIAL_DRAIN) { if (cmd == SND_COMPR_TRIGGER_PARTIAL_DRAIN) {
pr_err("PARTIAL DRAIN, do not send EOS now, why!?"); pr_err("PARTIAL DRAIN, do not wait for EOS ack");
break; break;
} }
@ -640,7 +643,7 @@ static int msm_compr_trigger(struct snd_compr_stream *cstream, int cmd)
break; break;
} }
return 0; return rc;
} }
static int msm_compr_pointer(struct snd_compr_stream *cstream, static int msm_compr_pointer(struct snd_compr_stream *cstream,