aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammed Javid <mjavid@codeaurora.org>2018-12-16 18:00:27 +0530
committerMohammed Javid <mjavid@codeaurora.org>2018-12-18 16:39:12 +0530
commit96f6ec68803717e60aa5c00bce6e850d947a7906 (patch)
treeeb9ac0359156d5778527ec578cbef3582604cfa4
parent92d44bbb79980a71aa3fb7584f091193fef242f5 (diff)
ipa3: fix suspend sequence for MHI ADPL pipeLE.UM.2.3.2-04700-SDX24
Make changes to suspend both the DL pipes (data pipe and ADPL pipe) whenever MHI pipes are suspended to avoid stale access from IPA HW. Change-Id: I0592bd92bab1fda4b7a51c7bcd2712f95cec9e6b Acked-by: Chaitanya Pratapa <cpratapa@qti.qualcomm.com> Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
-rw-r--r--drivers/platform/msm/ipa/ipa_clients/ipa_mhi_client.c51
1 files changed, 32 insertions, 19 deletions
diff --git a/drivers/platform/msm/ipa/ipa_clients/ipa_mhi_client.c b/drivers/platform/msm/ipa/ipa_clients/ipa_mhi_client.c
index 6c666005f279..34ddd639742c 100644
--- a/drivers/platform/msm/ipa/ipa_clients/ipa_mhi_client.c
+++ b/drivers/platform/msm/ipa/ipa_clients/ipa_mhi_client.c
@@ -1743,13 +1743,14 @@ static int ipa_mhi_wait_for_cons_release(void)
return 0;
}
-static int ipa_mhi_suspend_channels(struct ipa_mhi_channel_ctx *channels)
+static int ipa_mhi_suspend_channels(struct ipa_mhi_channel_ctx *channels,
+ int max_channels)
{
int i;
int res;
IPA_MHI_FUNC_ENTRY();
- for (i = 0; i < IPA_MHI_MAX_UL_CHANNELS; i++) {
+ for (i = 0; i < max_channels; i++) {
if (!channels[i].valid)
continue;
if (channels[i].state !=
@@ -1779,7 +1780,7 @@ static int ipa_mhi_suspend_channels(struct ipa_mhi_channel_ctx *channels)
}
static int ipa_mhi_stop_event_update_channels(
- struct ipa_mhi_channel_ctx *channels)
+ struct ipa_mhi_channel_ctx *channels, int max_channels)
{
int i;
int res;
@@ -1788,7 +1789,7 @@ static int ipa_mhi_stop_event_update_channels(
return 0;
IPA_MHI_FUNC_ENTRY();
- for (i = 0; i < IPA_MHI_MAX_UL_CHANNELS; i++) {
+ for (i = 0; i < max_channels; i++) {
if (!channels[i].valid)
continue;
if (channels[i].state !=
@@ -1847,14 +1848,14 @@ static bool ipa_mhi_check_pending_packets_from_host(void)
}
static int ipa_mhi_resume_channels(bool LPTransitionRejected,
- struct ipa_mhi_channel_ctx *channels)
+ struct ipa_mhi_channel_ctx *channels, int max_channels)
{
int i;
int res;
struct ipa_mhi_channel_ctx *channel;
IPA_MHI_FUNC_ENTRY();
- for (i = 0; i < IPA_MHI_MAX_UL_CHANNELS; i++) {
+ for (i = 0; i < max_channels; i++) {
if (!channels[i].valid)
continue;
if (channels[i].state !=
@@ -1903,7 +1904,8 @@ static int ipa_mhi_suspend_ul(bool force, bool *empty, bool *force_clear)
*force_clear = false;
- res = ipa_mhi_suspend_channels(ipa_mhi_client_ctx->ul_channels);
+ res = ipa_mhi_suspend_channels(ipa_mhi_client_ctx->ul_channels,
+ IPA_MHI_MAX_UL_CHANNELS);
if (res) {
IPA_MHI_ERR("ipa_mhi_suspend_ul_channels failed %d\n", res);
goto fail_suspend_ul_channel;
@@ -1964,7 +1966,7 @@ static int ipa_mhi_suspend_ul(bool force, bool *empty, bool *force_clear)
}
res = ipa_mhi_stop_event_update_channels(
- ipa_mhi_client_ctx->ul_channels);
+ ipa_mhi_client_ctx->ul_channels, IPA_MHI_MAX_UL_CHANNELS);
if (res) {
IPA_MHI_ERR(
"ipa_mhi_stop_event_update_ul_channels failed %d\n",
@@ -2080,7 +2082,8 @@ static int ipa_mhi_suspend_dl(bool force)
{
int res;
- res = ipa_mhi_suspend_channels(ipa_mhi_client_ctx->dl_channels);
+ res = ipa_mhi_suspend_channels(ipa_mhi_client_ctx->dl_channels,
+ IPA_MHI_MAX_DL_CHANNELS);
if (res) {
IPA_MHI_ERR(
"ipa_mhi_suspend_channels for dl failed %d\n", res);
@@ -2088,7 +2091,8 @@ static int ipa_mhi_suspend_dl(bool force)
}
res = ipa_mhi_stop_event_update_channels
- (ipa_mhi_client_ctx->dl_channels);
+ (ipa_mhi_client_ctx->dl_channels,
+ IPA_MHI_MAX_DL_CHANNELS);
if (res) {
IPA_MHI_ERR("failed to stop event update on DL %d\n", res);
goto fail_stop_event_update_dl_channel;
@@ -2113,7 +2117,8 @@ static int ipa_mhi_suspend_dl(bool force)
fail_stop_event_update_dl_channel:
ipa_mhi_resume_channels(true,
- ipa_mhi_client_ctx->dl_channels);
+ ipa_mhi_client_ctx->dl_channels,
+ IPA_MHI_MAX_DL_CHANNELS);
fail_suspend_dl_channel:
return res;
}
@@ -2226,7 +2231,8 @@ fail_deactivate_pm:
#endif
IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
fail_suspend_ul_channel:
- ipa_mhi_resume_channels(true, ipa_mhi_client_ctx->ul_channels);
+ ipa_mhi_resume_channels(true, ipa_mhi_client_ctx->ul_channels,
+ IPA_MHI_MAX_UL_CHANNELS);
if (force_clear) {
if (
ipa_mhi_disable_force_clear(ipa_mhi_client_ctx->qmi_req_id)) {
@@ -2237,7 +2243,8 @@ fail_suspend_ul_channel:
ipa_mhi_client_ctx->qmi_req_id++;
}
fail_suspend_dl_channel:
- ipa_mhi_resume_channels(true, ipa_mhi_client_ctx->dl_channels);
+ ipa_mhi_resume_channels(true, ipa_mhi_client_ctx->dl_channels,
+ IPA_MHI_MAX_DL_CHANNELS);
ipa_mhi_set_state(IPA_MHI_STATE_STARTED);
return res;
}
@@ -2272,7 +2279,8 @@ int ipa_mhi_resume(void)
if (ipa_mhi_client_ctx->rm_cons_state == IPA_MHI_RM_STATE_REQUESTED) {
/* resume all DL channels */
res = ipa_mhi_resume_channels(false,
- ipa_mhi_client_ctx->dl_channels);
+ ipa_mhi_client_ctx->dl_channels,
+ IPA_MHI_MAX_DL_CHANNELS);
if (res) {
IPA_MHI_ERR("ipa_mhi_resume_dl_channels failed %d\n",
res);
@@ -2310,7 +2318,8 @@ int ipa_mhi_resume(void)
/* resume all UL channels */
res = ipa_mhi_resume_channels(false,
- ipa_mhi_client_ctx->ul_channels);
+ ipa_mhi_client_ctx->ul_channels,
+ IPA_MHI_MAX_UL_CHANNELS);
if (res) {
IPA_MHI_ERR("ipa_mhi_resume_ul_channels failed %d\n", res);
goto fail_resume_ul_channels;
@@ -2318,7 +2327,8 @@ int ipa_mhi_resume(void)
if (!dl_channel_resumed) {
res = ipa_mhi_resume_channels(false,
- ipa_mhi_client_ctx->dl_channels);
+ ipa_mhi_client_ctx->dl_channels,
+ IPA_MHI_MAX_DL_CHANNELS);
if (res) {
IPA_MHI_ERR("ipa_mhi_resume_dl_channels failed %d\n",
res);
@@ -2339,9 +2349,11 @@ int ipa_mhi_resume(void)
return 0;
fail_set_state:
- ipa_mhi_suspend_channels(ipa_mhi_client_ctx->dl_channels);
+ ipa_mhi_suspend_channels(ipa_mhi_client_ctx->dl_channels,
+ IPA_MHI_MAX_DL_CHANNELS);
fail_resume_dl_channels2:
- ipa_mhi_suspend_channels(ipa_mhi_client_ctx->ul_channels);
+ ipa_mhi_suspend_channels(ipa_mhi_client_ctx->ul_channels,
+ IPA_MHI_MAX_UL_CHANNELS);
fail_resume_ul_channels:
if (!ipa_pm_is_used())
ipa_mhi_release_prod();
@@ -2354,7 +2366,8 @@ fail_pm_activate_modem:
ipa_pm_deactivate_sync(ipa_mhi_client_ctx->pm_hdl);
fail_pm_activate:
#endif
- ipa_mhi_suspend_channels(ipa_mhi_client_ctx->dl_channels);
+ ipa_mhi_suspend_channels(ipa_mhi_client_ctx->dl_channels,
+ IPA_MHI_MAX_DL_CHANNELS);
fail_resume_dl_channels:
ipa_mhi_set_state(IPA_MHI_STATE_SUSPENDED);
return res;