From 50026e05db8b0e083ee1510b30bb84311b53820f Mon Sep 17 00:00:00 2001 From: Michael Adisumarta Date: Wed, 25 Sep 2019 12:28:21 -0700 Subject: [PATCH] msm: ipa: stop remote IPA channels if tethering is not enabled This fix stops the remote IPA MHIP channels from probe if tethering is not enabled, before unvoting host IPA clocks. Change-Id: Iae12f13a3297e2ed7898e7c3a5e0b39ab6793e55 Acked-by: Jyothi Jayanthi Signed-off-by: Michael Adisumarta --- drivers/platform/msm/ipa/ipa_v3/ipa_mpm.c | 27 +++++++++++++++++------ 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_mpm.c b/drivers/platform/msm/ipa/ipa_v3/ipa_mpm.c index b3d4bb41536a..31e411dab53c 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_mpm.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_mpm.c @@ -1523,9 +1523,20 @@ static void ipa_mpm_vote_unvote_ipa_clk(enum ipa_mpm_clk_vote_type vote, } } +/** + * @ipa_mpm_start_stop_remote_mhip_chan - Start/Stop Remote device side MHIP + * channels. + * @ipa_mpm_clk_vote_type - Vote or Unvote for PCIe Clock + * @probe_id - MHI probe_id per client. + * @ipa_mpm_start_stop_type - Start/Stop remote channels. + * @is_force - Forcebly casts remote channels to be started/stopped. + * should be true only in probe. + * Return value: 0 if success or error value. + */ static int ipa_mpm_start_stop_remote_mhip_chan( int probe_id, - enum ipa_mpm_start_stop_type start_stop) + enum ipa_mpm_start_stop_type start_stop, + bool is_force) { int ret = 0; struct mhi_device *mhi_dev = ipa_mpm_ctx->md[probe_id].mhi_dev; @@ -1535,7 +1546,7 @@ static int ipa_mpm_start_stop_remote_mhip_chan( * the remote channels so no need to start it from here. */ mutex_lock(&ipa_mpm_ctx->md[probe_id].mhi_mutex); - if (!ipa_mpm_ctx->md[probe_id].init_complete) { + if (!ipa_mpm_ctx->md[probe_id].init_complete && !is_force) { IPA_MPM_ERR("MHI not initialized yet, probe in progress\n"); mutex_unlock(&ipa_mpm_ctx->md[probe_id].mhi_mutex); return ret; @@ -1792,7 +1803,8 @@ int ipa_mpm_notify_wan_state(struct wan_ioctl_notify_wan_state *state) * Host IPA gets voted. */ ret = ipa_mpm_start_stop_remote_mhip_chan(probe_id, - MPM_MHIP_START); + MPM_MHIP_START, + false); if (ret) { /* * This can fail only when modem is in SSR state. @@ -1901,7 +1913,8 @@ int ipa_mpm_notify_wan_state(struct wan_ioctl_notify_wan_state *state) * Host IPA gets devoted. */ ret = ipa_mpm_start_stop_remote_mhip_chan(probe_id, - MPM_MHIP_STOP); + MPM_MHIP_STOP, + false); if (ret) { /* * This can fail only when modem is in SSR state. @@ -2381,7 +2394,7 @@ static int ipa_mpm_mhi_probe_cb(struct mhi_device *mhi_dev, * Host IPA gets unvoted. */ ret = ipa_mpm_start_stop_remote_mhip_chan(probe_id, - MPM_MHIP_STOP); + MPM_MHIP_STOP, true); if (ret) { /* * This can fail only when modem is in SSR. @@ -2706,7 +2719,7 @@ int ipa_mpm_mhip_xdci_pipe_enable(enum ipa_usb_teth_prot xdci_teth_prot) * Host IPA gets voted. */ ret = ipa_mpm_start_stop_remote_mhip_chan(probe_id, - MPM_MHIP_START); + MPM_MHIP_START, false); if (ret) { /* * This can fail only when modem is in SSR state. @@ -2828,7 +2841,7 @@ int ipa_mpm_mhip_xdci_pipe_disable(enum ipa_usb_teth_prot xdci_teth_prot) * Host IPA gets unvoted. */ ret = ipa_mpm_start_stop_remote_mhip_chan(probe_id, - MPM_MHIP_STOP); + MPM_MHIP_STOP, false); if (ret) { /* * This can fail only when modem is in SSR state.