Browse Source

dsp: fix reset logic during ADSP SSR for lsm

During ADSP SSR, unless all APR clients are de-registered, Glink
channel will not be closed, which will cause Glink channel to remain
in stale/unusable state after ADSP SSR. Fix this by adding APR reset
logic in LSM driver.

Change-Id: Idec26836cfa4ecbacc557996339facd84ac19668
Signed-off-by: Xiaoyu Ye <[email protected]>
Xiaoyu Ye 7 years ago
parent
commit
fb90eb6176
1 changed files with 13 additions and 0 deletions
  1. 13 0
      dsp/q6lsm.c

+ 13 - 0
dsp/q6lsm.c

@@ -148,6 +148,10 @@ static int q6lsm_callback(struct apr_client_data *data, void *priv)
 			 __func__, data->opcode, data->reset_event,
 			 data->reset_proc);
 
+		apr_reset(client->apr);
+		client->apr = NULL;
+		atomic_set(&client->cmd_state, CMD_STATE_CLEARED);
+		wake_up(&client->cmd_wait);
 		cal_utils_clear_cal_block_q6maps(LSM_MAX_CAL_IDX,
 			lsm_common.cal_data);
 		mutex_lock(&lsm_common.cal_data[LSM_CUSTOM_TOP_IDX]->lock);
@@ -368,6 +372,11 @@ static int q6lsm_apr_send_pkt(struct lsm_client *client, void *handle,
 	unsigned long flags = 0;
 	struct apr_hdr *msg_hdr = (struct apr_hdr *) data;
 
+	if (!handle) {
+		pr_err("%s: handle is NULL\n", __func__);
+		return -EINVAL;
+	}
+
 	pr_debug("%s: enter wait %d\n", __func__, wait);
 	if (wait)
 		mutex_lock(&lsm_common.apr_lock);
@@ -1341,6 +1350,10 @@ static int q6lsm_mmapcallback(struct apr_client_data *data, void *priv)
 		pr_debug("%s: SSR event received 0x%x, event 0x%x,\n"
 			 "proc 0x%x SID 0x%x\n", __func__, data->opcode,
 			 data->reset_event, data->reset_proc, sid);
+
+		apr_reset(lsm_common.apr);
+		lsm_common.apr = NULL;
+		atomic_set(&lsm_common.apr_users, 0);
 		lsm_common.common_client[sid].lsm_cal_phy_addr = 0;
 		cal_utils_clear_cal_block_q6maps(LSM_MAX_CAL_IDX,
 			lsm_common.cal_data);