diff --git a/hif/src/pcie/if_pci.c b/hif/src/pcie/if_pci.c index 57b2bf2302f9..1f85530d5a03 100644 --- a/hif/src/pcie/if_pci.c +++ b/hif/src/pcie/if_pci.c @@ -3588,14 +3588,18 @@ bool hif_pci_needs_bmi(struct hif_softc *scn) #ifdef DEVICE_FORCE_WAKE_ENABLE int hif_force_wake_request(struct hif_opaque_softc *hif_handle) { - uint32_t timeout = 0, value; + uint32_t timeout, value; struct hif_softc *scn = (struct hif_softc *)hif_handle; struct hif_pci_softc *pci_scn = HIF_GET_PCI_SOFTC(scn); HIF_STATS_INC(pci_scn, mhi_force_wake_request_vote, 1); - if (pld_force_wake_request_sync(scn->qdf_dev->dev, - FORCE_WAKE_DELAY_TIMEOUT_MS * 1000)) { + if (qdf_in_interrupt()) + timeout = FORCE_WAKE_DELAY_TIMEOUT_MS * 1000; + else + timeout = 0; + + if (pld_force_wake_request_sync(scn->qdf_dev->dev, timeout)) { hif_err("force wake request send failed"); HIF_STATS_INC(pci_scn, mhi_force_wake_failure, 1); return -EINVAL; @@ -3623,6 +3627,7 @@ int hif_force_wake_request(struct hif_opaque_softc *hif_handle) * do not reset the timeout * total_wake_time = MHI_WAKE_TIME + PCI_WAKE_TIME < 50 ms */ + timeout = 0; do { value = hif_read32_mb(scn, @@ -3654,11 +3659,16 @@ int hif_force_wake_request(struct hif_opaque_softc *hif_handle) { struct hif_softc *scn = (struct hif_softc *)hif_handle; struct hif_pci_softc *pci_scn = HIF_GET_PCI_SOFTC(scn); + uint32_t timeout; HIF_STATS_INC(pci_scn, mhi_force_wake_request_vote, 1); - if (pld_force_wake_request_sync(scn->qdf_dev->dev, - FORCE_WAKE_DELAY_TIMEOUT_MS * 1000)) { + if (qdf_in_interrupt()) + timeout = FORCE_WAKE_DELAY_TIMEOUT_MS * 1000; + else + timeout = 0; + + if (pld_force_wake_request_sync(scn->qdf_dev->dev, timeout)) { hif_err("force wake request send failed"); HIF_STATS_INC(pci_scn, mhi_force_wake_failure, 1); return -EINVAL;