Browse Source

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

qctecmdr 5 years ago
parent
commit
7cd81eea83
3 changed files with 31 additions and 2 deletions
  1. 20 0
      dsp/q6asm.c
  2. 10 2
      dsp/rtac.c
  3. 1 0
      include/dsp/q6asm-v2.h

+ 20 - 0
dsp/q6asm.c

@@ -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;

+ 10 - 2
dsp/rtac.c

@@ -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;
 

+ 1 - 0
include/dsp/q6asm-v2.h

@@ -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);