Просмотр исходного кода

Merge "msm: ipa3: start odl remote-ch based on ODL connect"

qctecmdr 3 лет назад
Родитель
Сommit
2c34341e8d

+ 52 - 12
drivers/platform/msm/ipa/ipa_v3/ipa_mpm.c

@@ -411,6 +411,7 @@ struct ipa_mpm_context {
 	atomic_t ipa_clk_total_cnt;
 	atomic_t flow_ctrl_mask;
 	atomic_t adpl_over_usb_available;
+	atomic_t adpl_over_odl_available;
 	struct device *parent_pdev;
 	struct ipa_smmu_cb_ctx carved_smmu_cb;
 	struct device *mhi_parent_dev;
@@ -2971,20 +2972,23 @@ int ipa_mpm_mhip_xdci_pipe_disable(enum ipa_usb_teth_prot xdci_teth_prot)
 	 * sure device side doesn't access host side IPA if
 	 * Host IPA gets unvoted.
 	 */
-	ret = ipa_mpm_start_stop_remote_mhip_chan(probe_id,
-						MPM_MHIP_STOP, false);
-	if (ret) {
-		/*
-		 * This can fail only when modem is in SSR state.
-		 * Eventually there would be a remove callback,
-		 * so return a failure.
-		 */
-		IPA_MPM_ERR("MHIP remote chan stop fail = %d\n", ret);
-		return ret;
+	if ((!atomic_read(&ipa_mpm_ctx->adpl_over_odl_available))
+		|| (probe_id != IPA_MPM_MHIP_CH_ID_2)) {
+		ret = ipa_mpm_start_stop_remote_mhip_chan(probe_id,
+					MPM_MHIP_STOP, false);
+		if (ret) {
+			/**
+			 * This can fail only when modem is in SSR state.
+			 * Eventually there would be a remove callback,
+			 * so return a failure.
+			 */
+			IPA_MPM_ERR("MHIP remote chan stop fail = %d\n", ret);
+			return ret;
+		}
+		IPA_MPM_DBG("MHIP remote channels are stopped(id=%d)\n",
+			probe_id);
 	}
 
-	IPA_MPM_DBG("MHIP remote channels are stopped\n");
-
 	switch (mhip_client) {
 	case IPA_MPM_MHIP_USB_RMNET:
 		ret = ipa_mpm_set_dma_mode(IPA_CLIENT_USB_PROD,
@@ -3375,9 +3379,45 @@ int ipa3_mpm_enable_adpl_over_odl(bool enable)
 			return ret;
 		}
 
+		/*start remote mhip-dpl ch */
+		ret = ipa_mpm_start_stop_remote_mhip_chan(IPA_MPM_MHIP_CH_ID_2,
+			MPM_MHIP_START, false);
+		if (ret) {
+			/**
+			 * This can fail only when modem is in SSR state.
+			 * Eventually there would be a remove callback,
+			 * so return a failure.
+			 */
+			IPA_MPM_ERR("MHIP remote chan start fail = %d\n",
+				ret);
+			return ret;
+		}
+		IPA_MPM_DBG("MHIP remote chan started(id=%d)\n",
+			IPA_MPM_MHIP_CH_ID_2);
+		atomic_set(&ipa_mpm_ctx->adpl_over_odl_available, 1);
+
 		ipa_mpm_change_teth_state(IPA_MPM_MHIP_CH_ID_2,
 			IPA_MPM_TETH_CONNECTED);
 	} else {
+		/* stop remote mhip-dpl ch if adpl not enable */
+		if (!atomic_read(&ipa_mpm_ctx->adpl_over_usb_available)) {
+			ret = ipa_mpm_start_stop_remote_mhip_chan(
+				IPA_MPM_MHIP_CH_ID_2, MPM_MHIP_STOP, false);
+			if (ret) {
+				/**
+				 * This can fail only when modem is in SSR state.
+				 * Eventually there would be a remove callback,
+				 * so return a failure.
+				 */
+				IPA_MPM_ERR("MHIP remote chan stop fail = %d\n",
+					ret);
+				return ret;
+			}
+			IPA_MPM_DBG("MHIP remote channels are stopped(id=%d)\n",
+				IPA_MPM_MHIP_CH_ID_2);
+		}
+		atomic_set(&ipa_mpm_ctx->adpl_over_odl_available, 0);
+
 		/* dec clk count and set DMA to USB */
 		IPA_MPM_DBG("mpm disabling ADPL over ODL\n");
 		ret = ipa_mpm_vote_unvote_pcie_clk(CLK_OFF,

+ 2 - 2
drivers/platform/msm/ipa/ipa_v3/ipa_qmi_service.c

@@ -1665,7 +1665,7 @@ static void ipa3_q6_clnt_install_firewall_rules_ind_cb(
 	}
 }
 
-static void ipa3_q6_clnt_bw_vhang_ind_cb(struct qmi_handle *handle,
+static void ipa3_q6_clnt_bw_change_ind_cb(struct qmi_handle *handle,
 	struct sockaddr_qrtr *sq,
 	struct qmi_txn *txn,
 	const void *data)
@@ -1958,7 +1958,7 @@ static struct qmi_msg_handler client_handlers[] = {
 		.msg_id = QMI_IPA_BW_CHANGE_INDICATION_V01,
 		.ei = ipa_bw_change_ind_msg_v01_ei,
 		.decoded_size = IPA_BW_CHANGE_IND_MSG_V01_MAX_MSG_LEN,
-		.fn = ipa3_q6_clnt_bw_vhang_ind_cb,
+		.fn = ipa3_q6_clnt_bw_change_ind_cb,
 	},
 };