dsp: rtac: use accurate stream id during rtac asm apr call

Hard coded stream id fails rtac call for subsequential gapless stream
which uses stream id other than default value. To get/set rtac for
gapless session successfully, we need to update the stream_id as a part
of asm apr header with correct value populated from asm session table.

Change-Id: If4afd73b4cf11bf91730a58ae6dff03efb04519d
Signed-off-by: Weiyin Jiang <wjiang@codeaurora.org>
This commit is contained in:
Weiyin Jiang 2019-06-04 07:02:29 +08:00 • committed by Gerrit - the friendly Code Review server
commit fcf3cc05fb
3 changed files with 31 additions and 2 deletions

View file

@ -10820,6 +10820,26 @@ int q6asm_get_apr_service_id(int session_id)
return ((struct apr_svc *)(session[session_id].ac)->apr)->id;
}
uint8_t q6asm_get_asm_stream_id(int session_id)
{
uint8_t stream_id = 1;
pr_debug("%s:\n", __func__);
if (session_id <= 0 || session_id > ASM_ACTIVE_STREAMS_ALLOWED) {
pr_err("%s: invalid session_id = %d\n", __func__, session_id);
goto done;
}
if (session[session_id].ac == NULL) {
pr_err("%s: session not created for session id = %d\n",
__func__, session_id);
goto done;
}
stream_id = (session[session_id].ac)->stream_id;
done:
return stream_id;
}
int q6asm_get_asm_topology(int session_id)
{
int topology = -EINVAL;

View file

@ -985,6 +985,7 @@ int send_rtac_asm_apr(void *buf, u32 opcode)
u32 user_buf_size = 0;
u32 bytes_returned = 0;
u32 session_id = 0;
u8 stream_id = 0;
u32 payload_size;
u32 data_size = 0;
struct apr_hdr asm_params;
@ -1044,6 +1045,13 @@ int send_rtac_asm_apr(void *buf, u32 opcode)
goto err;
}
stream_id = q6asm_get_asm_stream_id(session_id);
if ((stream_id != 1) && (stream_id != 2)) {
pr_err("%s: Invalid stream id %u\n", __func__, stream_id);
result = -EINVAL;
goto err;
}
switch (opcode) {
case ASM_STREAM_CMD_SET_PP_PARAMS_V2:
case ASM_STREAM_CMD_SET_PP_PARAMS_V3:
@ -1103,10 +1111,10 @@ int send_rtac_asm_apr(void *buf, u32 opcode)
payload_size);
asm_params.src_svc = q6asm_get_apr_service_id(session_id);
asm_params.src_domain = APR_DOMAIN_APPS;
asm_params.src_port = (session_id << 8) | 0x0001;
asm_params.src_port = (session_id << 8) | stream_id;
asm_params.dest_svc = APR_SVC_ASM;
asm_params.dest_domain = APR_DOMAIN_ADSP;
asm_params.dest_port = (session_id << 8) | 0x0001;
asm_params.dest_port = (session_id << 8) | stream_id;
asm_params.token = session_id;
asm_params.opcode = opcode;

View file

@ -711,6 +711,7 @@ int q6asm_send_meta_data(struct audio_client *ac, uint32_t initial_samples,
int q6asm_stream_send_meta_data(struct audio_client *ac, uint32_t stream_id,
uint32_t initial_samples, uint32_t trailing_samples);
uint8_t q6asm_get_asm_stream_id(int session_id);
int q6asm_get_asm_topology(int session_id);
int q6asm_get_asm_app_type(int session_id);