soc: msm: Fix offload may be no sound when user resumes music

Send compress data by q6asm_run callback when user resumes music,
if the write_done event has been callback at offload pause state.

Bug: 30101878
Signed-off-by: Eric Laurent <elaurent@google.com>
This commit is contained in:
Eric Laurent 2016-07-12 17:44:31 +08:00 committed by syphyr
parent 75b8cbf0c3
commit dce0df919e
1 changed files with 14 additions and 9 deletions

View File

@ -462,7 +462,8 @@ static void compr_event_handler(uint32_t opcode,
if (!atomic_read(&prtd->start)) {
/* Writes must be restarted from _copy() */
pr_debug("write_done received while not started, treat as xrun");
atomic_set(&prtd->xrun, 1);
if (prtd->dsp_fragments_sent == 0)
atomic_set(&prtd->xrun, 1);
spin_unlock_irqrestore(&prtd->lock, flags);
break;
}
@ -561,16 +562,20 @@ static void compr_event_handler(uint32_t opcode,
* WRITE_DONE(X)
* RESUME
*/
if ((prtd->copied_total == prtd->bytes_sent) &&
atomic_read(&prtd->drain)) {
pr_debug("RUN ack, wake up & continue pending drain\n");
if ((prtd->copied_total == prtd->bytes_sent)) {
if (atomic_read(&prtd->drain)) {
pr_debug("RUN ack, wake up & continue pending drain\n");
if (prtd->last_buffer)
prtd->last_buffer = 0;
if (prtd->last_buffer)
prtd->last_buffer = 0;
prtd->drain_ready = 1;
wake_up(&prtd->drain_wait);
atomic_set(&prtd->drain, 0);
prtd->drain_ready = 1;
wake_up(&prtd->drain_wait);
atomic_set(&prtd->drain, 0);
} else if (prtd->dsp_fragments_sent) {
pr_info("RUN ack, resume for pending frames\n");
msm_compr_send_buffer(prtd);
}
}
spin_unlock_irqrestore(&prtd->lock, flags);