From 54d42ba9df3fb76c39bb808e372a12fcd8cface1 Mon Sep 17 00:00:00 2001 From: Satish Babu Patakokila Date: Tue, 31 Mar 2020 21:15:45 +0530 Subject: [PATCH] dsp: Add support for EOS V2 Use EOS V2 to avoid time out for EOS when afe port is closed before EOS Change-Id: I3be0aa33384d2015354b8f9a307f3e0cb200c040 Signed-off-by: Satish Babu Patakokila --- asoc/msm-compress-q6-v2.c | 1 + asoc/msm-pcm-q6-v2.c | 1 + dsp/codecs/q6audio_v2.c | 1 + dsp/codecs/q6audio_v2_aio.c | 2 ++ dsp/q6asm.c | 7 +++++-- include/dsp/apr_audio-v2.h | 3 +++ 6 files changed, 13 insertions(+), 2 deletions(-) diff --git a/asoc/msm-compress-q6-v2.c b/asoc/msm-compress-q6-v2.c index 8b33b8ee0c..109224a4cf 100644 --- a/asoc/msm-compress-q6-v2.c +++ b/asoc/msm-compress-q6-v2.c @@ -728,6 +728,7 @@ static void compr_event_handler(uint32_t opcode, break; case ASM_DATA_EVENT_RENDERED_EOS: + case ASM_DATA_EVENT_RENDERED_EOS_V2: spin_lock_irqsave(&prtd->lock, flags); pr_debug("%s: ASM_DATA_CMDRSP_EOS token 0x%x,stream id %d\n", __func__, token, stream_id); diff --git a/asoc/msm-pcm-q6-v2.c b/asoc/msm-pcm-q6-v2.c index a75a56485b..1da9f7ecd8 100644 --- a/asoc/msm-pcm-q6-v2.c +++ b/asoc/msm-pcm-q6-v2.c @@ -176,6 +176,7 @@ static void event_handler(uint32_t opcode, break; } case ASM_DATA_EVENT_RENDERED_EOS: + case ASM_DATA_EVENT_RENDERED_EOS_V2: pr_debug("ASM_DATA_EVENT_RENDERED_EOS\n"); clear_bit(CMD_EOS, &prtd->cmd_pending); wake_up(&the_locks.eos_wait); diff --git a/dsp/codecs/q6audio_v2.c b/dsp/codecs/q6audio_v2.c index 6a402f538b..e25a5e786a 100644 --- a/dsp/codecs/q6audio_v2.c +++ b/dsp/codecs/q6audio_v2.c @@ -39,6 +39,7 @@ void q6asm_in_cb(uint32_t opcode, uint32_t token, wake_up(&audio->write_wait); break; case ASM_DATA_EVENT_RENDERED_EOS: + case ASM_DATA_EVENT_RENDERED_EOS_V2: audio->eos_rsp = 1; wake_up(&audio->read_wait); break; diff --git a/dsp/codecs/q6audio_v2_aio.c b/dsp/codecs/q6audio_v2_aio.c index ecd14dadfe..fac9f9747a 100644 --- a/dsp/codecs/q6audio_v2_aio.c +++ b/dsp/codecs/q6audio_v2_aio.c @@ -24,6 +24,7 @@ void q6_audio_cb(uint32_t opcode, uint32_t token, case ASM_DATA_EVENT_WRITE_DONE_V2: case ASM_DATA_EVENT_READ_DONE_V2: case ASM_DATA_EVENT_RENDERED_EOS: + case ASM_DATA_EVENT_RENDERED_EOS_V2: case ASM_DATA_CMD_MEDIA_FMT_UPDATE_V2: case ASM_STREAM_CMD_SET_ENCDEC_PARAM: case ASM_DATA_EVENT_SR_CM_CHANGE_NOTIFY: @@ -60,6 +61,7 @@ void audio_aio_cb(uint32_t opcode, uint32_t token, audio_aio_async_read_ack(audio, token, payload); break; case ASM_DATA_EVENT_RENDERED_EOS: + case ASM_DATA_EVENT_RENDERED_EOS_V2: /* EOS Handle */ pr_debug("%s[%pK]:ASM_DATA_CMDRSP_EOS\n", __func__, audio); if (audio->feedback) { /* Non-Tunnel mode */ diff --git a/dsp/q6asm.c b/dsp/q6asm.c index 2b481a439e..26b188a6c5 100644 --- a/dsp/q6asm.c +++ b/dsp/q6asm.c @@ -1984,6 +1984,7 @@ static int32_t q6asm_callback(struct apr_client_data *data, void *priv) data->token, data->payload_size, data->src_port, data->dest_port); if ((data->opcode != ASM_DATA_EVENT_RENDERED_EOS) && + (data->opcode != ASM_DATA_EVENT_RENDERED_EOS_V2) && (data->opcode != ASM_DATA_EVENT_EOS) && (data->opcode != ASM_SESSION_EVENTX_OVERFLOW) && (data->opcode != ASM_SESSION_EVENT_RX_UNDERFLOW)) { @@ -2010,6 +2011,7 @@ static int32_t q6asm_callback(struct apr_client_data *data, void *priv) case ASM_SESSION_CMD_PAUSE: case ASM_SESSION_CMD_SUSPEND: case ASM_DATA_CMD_EOS: + case ASM_DATA_CMD_EOS_V2: case ASM_STREAM_CMD_CLOSE: case ASM_STREAM_CMD_FLUSH: case ASM_SESSION_CMD_RUN_V2: @@ -2347,6 +2349,7 @@ static int32_t q6asm_callback(struct apr_client_data *data, void *priv) } case ASM_DATA_EVENT_EOS: case ASM_DATA_EVENT_RENDERED_EOS: + case ASM_DATA_EVENT_RENDERED_EOS_V2: pr_debug("%s: EOS ACK received: rxed session %d opcode 0x%x token 0x%x src %d dest %d\n", __func__, ac->session, data->opcode, data->token, @@ -10374,7 +10377,7 @@ static int __q6asm_cmd(struct audio_client *ac, int cmd, uint32_t stream_id) break; case CMD_EOS: pr_debug("%s: CMD_EOS\n", __func__); - hdr.opcode = ASM_DATA_CMD_EOS; + hdr.opcode = ASM_DATA_CMD_EOS_V2; atomic_set(&ac->cmd_state, 0); state = &ac->cmd_state; break; @@ -10524,7 +10527,7 @@ static int __q6asm_cmd_nowait(struct audio_client *ac, int cmd, break; case CMD_EOS: pr_debug("%s: CMD_EOS\n", __func__); - hdr.opcode = ASM_DATA_CMD_EOS; + hdr.opcode = ASM_DATA_CMD_EOS_V2; break; case CMD_CLOSE: pr_debug("%s: CMD_CLOSE\n", __func__); diff --git a/include/dsp/apr_audio-v2.h b/include/dsp/apr_audio-v2.h index 72b11e2fbd..3e3b573550 100644 --- a/include/dsp/apr_audio-v2.h +++ b/include/dsp/apr_audio-v2.h @@ -7246,6 +7246,9 @@ struct asm_data_cmd_read_v2 { #define ASM_DATA_EVENT_RENDERED_EOS 0x00010C1C #define ASM_DATA_EVENT_EOS 0x00010BDD +#define ASM_DATA_CMD_EOS_V2 0x00012F3C +#define ASM_DATA_EVENT_RENDERED_EOS_V2 0x00012F3D + #define ASM_DATA_EVENT_WRITE_DONE_V2 0x00010D99 struct asm_data_event_write_done_v2 { u32 buf_addr_lsw;