From 9d023aee8697daed0170e1b8d4ef4d08036b3a5c Mon Sep 17 00:00:00 2001 From: Sivakanth vaka Date: Thu, 16 Jul 2020 19:19:16 +0530 Subject: [PATCH] msm: ipa3: Enable holb as part of usb suspend When USB is suspended there are DL packets on consumer channel leading to stall. to avoid the stall enabling the holb as part of suspend and removing it in resume. Change-Id: I08e2fe248ee675698da16b6df6aec8f109c73608 Signed-off-by: sivakanth vaka --- drivers/platform/msm/ipa/ipa_v3/ipa_client.c | 24 ++++++++++++++++++++ drivers/platform/msm/ipa/ipa_v3/ipa_i.h | 1 + 2 files changed, 25 insertions(+) diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_client.c b/drivers/platform/msm/ipa/ipa_v3/ipa_client.c index fd8339c15c57..ea349e49d297 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_client.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_client.c @@ -1570,6 +1570,7 @@ int ipa3_xdci_suspend(u32 ul_clnt_hdl, u32 dl_clnt_hdl, struct ipa_ep_cfg_ctrl ep_cfg_ctrl; u32 holb_max_cnt = ipa3_ctx->uc_ctx.holb_monitor.max_cnt_usb; int res = 0; + struct ipa_ep_cfg_holb holb_cfg; /* In case of DPL, dl is the DPL channel/client */ @@ -1655,6 +1656,14 @@ int ipa3_xdci_suspend(u32 ul_clnt_hdl, u32 dl_clnt_hdl, goto unsuspend_dl_and_exit; } + /*enable holb to discard the packets*/ + if (IPA_CLIENT_IS_CONS(dl_ep->client) && !is_dpl) { + memset(&holb_cfg, 0, sizeof(holb_cfg)); + holb_cfg.en = IPA_HOLB_TMR_EN; + holb_cfg.tmr_val = IPA_HOLB_TMR_VAL_4_5; + result = ipa3_cfg_ep_holb(dl_clnt_hdl, &holb_cfg); + } + /* Stop DL channel */ result = ipa3_stop_gsi_channel(dl_clnt_hdl); if (result) { @@ -1692,6 +1701,13 @@ start_dl_and_exit: dl_ep->gsi_chan_hdl); } ipa3_start_gsi_debug_monitor(dl_clnt_hdl); + /*disable holb to allow packets*/ + if (IPA_CLIENT_IS_CONS(dl_ep->client) && !is_dpl) { + memset(&holb_cfg, 0, sizeof(holb_cfg)); + holb_cfg.en = IPA_HOLB_TMR_DIS; + holb_cfg.tmr_val = 0; + ipa3_cfg_ep_holb(dl_clnt_hdl, &holb_cfg); + } unsuspend_dl_and_exit: if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_0) { /* Unsuspend the DL EP */ @@ -1762,6 +1778,7 @@ int ipa3_xdci_resume(u32 ul_clnt_hdl, u32 dl_clnt_hdl, bool is_dpl) struct ipa_ep_cfg_ctrl ep_cfg_ctrl; int result; u32 holb_max_cnt = ipa3_ctx->uc_ctx.holb_monitor.max_cnt_usb; + struct ipa_ep_cfg_holb holb_cfg; /* In case of DPL, dl is the DPL channel/client */ @@ -1790,6 +1807,13 @@ int ipa3_xdci_resume(u32 ul_clnt_hdl, u32 dl_clnt_hdl, bool is_dpl) gsi_res = gsi_start_channel(dl_ep->gsi_chan_hdl); if (gsi_res != GSI_STATUS_SUCCESS) IPAERR("Error starting DL channel: %d\n", gsi_res); + /*disable holb to allow packets*/ + if (IPA_CLIENT_IS_CONS(dl_ep->client) && !is_dpl) { + memset(&holb_cfg, 0, sizeof(holb_cfg)); + holb_cfg.en = IPA_HOLB_TMR_DIS; + holb_cfg.tmr_val = 0; + ipa3_cfg_ep_holb(dl_clnt_hdl, &holb_cfg); + } if (!is_dpl) { result = ipa3_uc_client_add_holb_monitor(dl_ep->gsi_chan_hdl, HOLB_MONITOR_MASK, diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h index ff3502096797..2320677468b5 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h @@ -62,6 +62,7 @@ #define IPA_UC_FINISH_MAX 6 #define IPA_UC_WAIT_MIN_SLEEP 1000 #define IPA_UC_WAII_MAX_SLEEP 1200 +#define IPA_HOLB_TMR_VAL_4_5 31 /* * The transport descriptor size was changed to GSI_CHAN_RE_SIZE_16B, but * IPA users still use sps_iovec size as FIFO element size.