diff --git a/hif/src/ipcie/if_ipci.c b/hif/src/ipcie/if_ipci.c index 0fef23ae3e4f..78f63849be79 100644 --- a/hif/src/ipcie/if_ipci.c +++ b/hif/src/ipcie/if_ipci.c @@ -899,6 +899,7 @@ int hif_prevent_link_low_power_states(struct hif_opaque_softc *hif) struct hif_softc *scn = HIF_GET_SOFTC(hif); struct hif_ipci_softc *ipci_scn = HIF_GET_IPCI_SOFTC(scn); uint32_t start_time = 0, curr_time = 0; + uint32_t count = 0; if (pld_is_pci_ep_awake(scn->qdf_dev->dev) == -ENOTSUPP) return 0; @@ -906,10 +907,16 @@ int hif_prevent_link_low_power_states(struct hif_opaque_softc *hif) start_time = curr_time = qdf_system_ticks_to_msecs(qdf_system_ticks()); while (pld_is_pci_ep_awake(scn->qdf_dev->dev) && curr_time <= start_time + EP_WAKE_RESET_DELAY_TIMEOUT_MS) { - qdf_sleep_us(EP_WAKE_RESET_DELAY_US); + if (count < EP_VOTE_POLL_TIME_CNT) { + qdf_udelay(EP_VOTE_POLL_TIME_US); + count++; + } else { + qdf_sleep_us(EP_WAKE_RESET_DELAY_US); + } curr_time = qdf_system_ticks_to_msecs(qdf_system_ticks()); } + if (pld_is_pci_ep_awake(scn->qdf_dev->dev)) { hif_err_rl(" EP state reset is not done to prevent l1"); ipci_scn->ep_awake_reset_fail++; @@ -922,11 +929,18 @@ int hif_prevent_link_low_power_states(struct hif_opaque_softc *hif) return 0; } + count = 0; ipci_scn->prevent_l1 = true; start_time = curr_time = qdf_system_ticks_to_msecs(qdf_system_ticks()); while (!pld_is_pci_ep_awake(scn->qdf_dev->dev) && curr_time <= start_time + EP_WAKE_DELAY_TIMEOUT_MS) { - qdf_sleep_us(EP_WAKE_DELAY_US); + if (count < EP_VOTE_POLL_TIME_CNT) { + qdf_udelay(EP_WAKE_RESET_DELAY_US); + count++; + } else { + qdf_sleep_us(EP_WAKE_DELAY_US); + } + curr_time = qdf_system_ticks_to_msecs(qdf_system_ticks()); } diff --git a/hif/src/ipcie/if_ipci.h b/hif/src/ipcie/if_ipci.h index 000e1a350f9f..2270890f6f60 100644 --- a/hif/src/ipcie/if_ipci.h +++ b/hif/src/ipcie/if_ipci.h @@ -64,6 +64,8 @@ struct hif_ipci_stats { #endif /* FORCE_WAKE */ #ifdef FEATURE_HAL_DELAYED_REG_WRITE +#define EP_VOTE_POLL_TIME_US 50 +#define EP_VOTE_POLL_TIME_CNT 2 #ifdef HAL_CONFIG_SLUB_DEBUG_ON #define EP_WAKE_RESET_DELAY_TIMEOUT_MS 3 #define EP_WAKE_DELAY_TIMEOUT_MS 7