Browse Source

dsp: afe: get apr handle before sending apr pkt

Make sure to get apr handle before sending a packet
so that it does not end up with no handle to send
the apr packet.

Change-Id: Iaaebee3ddc6c83896e4cb9dc8149d310fc7d67f1
Signed-off-by: Karthikeyan Mani <[email protected]>
Karthikeyan Mani 6 years ago
parent
commit
5670cbd6e3
2 changed files with 14 additions and 1 deletions
  1. 12 0
      dsp/q6afe.c
  2. 2 1
      ipc/apr.c

+ 12 - 0
dsp/q6afe.c

@@ -8827,6 +8827,12 @@ int afe_vote_lpass_core_hw(uint32_t hw_block_id, char *client_name,
 		return -EINVAL;
 	}
 
+	ret = afe_q6_interface_prepare();
+	if(ret) {
+		pr_err("%s: Q6 interface prepare failed %d\n", __func__, ret);
+		return ret;
+	}
+
 	mutex_lock(&this_afe.afe_cmd_lock);
 
 	memset(cmd_ptr, 0, sizeof(hw_vote_cfg));
@@ -8902,6 +8908,12 @@ int afe_unvote_lpass_core_hw(uint32_t hw_block_id, uint32_t client_handle)
 						&hw_vote_cfg;
 	int ret = 0;
 
+	ret = afe_q6_interface_prepare();
+	if(ret) {
+		pr_err("%s: Q6 interface prepare failed %d\n", __func__, ret);
+		return ret;
+	}
+
 	mutex_lock(&this_afe.afe_cmd_lock);
 
 	memset(cmd_ptr, 0, sizeof(hw_vote_cfg));

+ 2 - 1
ipc/apr.c

@@ -364,7 +364,8 @@ int apr_send_pkt(void *handle, uint32_t *buf)
 	unsigned long flags;
 
 	if (!handle || !buf) {
-		pr_err("APR: Wrong parameters\n");
+		pr_err("APR: Wrong parameters for %s\n",
+				!handle ? "handle" : "buf");
 		return -EINVAL;
 	}
 	if (svc->need_reset) {