diff --git a/hif/inc/hif.h b/hif/inc/hif.h index 612778ee6c..679ae846f4 100644 --- a/hif/inc/hif.h +++ b/hif/inc/hif.h @@ -1161,6 +1161,28 @@ int hif_apps_wake_irq_enable(struct hif_opaque_softc *hif_ctx); */ int hif_apps_wake_irq_disable(struct hif_opaque_softc *hif_ctx); +/** + * hif_apps_enable_irq_wake() - Enables the irq wake from the APPS side + * @hif_ctx: an opaque HIF handle to use + * + * This function always applies to the APPS side kernel interrupt handling + * to wake the system from suspend. + * + * Return: errno + */ +int hif_apps_enable_irq_wake(struct hif_opaque_softc *hif_ctx); + +/** + * hif_apps_disable_irq_wake() - Disables the wake irq from the APPS side + * @hif_ctx: an opaque HIF handle to use + * + * This function always applies to the APPS side kernel interrupt handling + * to disable the wake irq. + * + * Return: errno + */ +int hif_apps_disable_irq_wake(struct hif_opaque_softc *hif_ctx); + #ifdef FEATURE_RUNTIME_PM int hif_pre_runtime_suspend(struct hif_opaque_softc *hif_ctx); void hif_pre_runtime_resume(struct hif_opaque_softc *hif_ctx); diff --git a/hif/src/dispatcher/multibus.c b/hif/src/dispatcher/multibus.c index 7210841bc6..34c1c0f545 100644 --- a/hif/src/dispatcher/multibus.c +++ b/hif/src/dispatcher/multibus.c @@ -530,6 +530,30 @@ int hif_apps_wake_irq_enable(struct hif_opaque_softc *hif_ctx) return 0; } +int hif_apps_disable_irq_wake(struct hif_opaque_softc *hif_ctx) +{ + struct hif_softc *scn; + + QDF_BUG(hif_ctx); + scn = HIF_GET_SOFTC(hif_ctx); + if (!scn) + return -EINVAL; + + return disable_irq_wake(scn->wake_irq); +} + +int hif_apps_enable_irq_wake(struct hif_opaque_softc *hif_ctx) +{ + struct hif_softc *scn; + + QDF_BUG(hif_ctx); + scn = HIF_GET_SOFTC(hif_ctx); + if (!scn) + return -EINVAL; + + return enable_irq_wake(scn->wake_irq); +} + #ifdef WLAN_FEATURE_BMI bool hif_needs_bmi(struct hif_opaque_softc *scn) { diff --git a/hif/src/ipcie/if_ipci.c b/hif/src/ipcie/if_ipci.c index 1ec5c51084..373bee411c 100644 --- a/hif/src/ipcie/if_ipci.c +++ b/hif/src/ipcie/if_ipci.c @@ -289,39 +289,27 @@ void hif_ipci_prevent_linkdown(struct hif_softc *scn, bool flag) int hif_ipci_bus_suspend(struct hif_softc *scn) { - QDF_STATUS ret; - - hif_apps_irqs_disable(GET_HIF_OPAQUE_HDL(scn)); - - ret = hif_try_complete_tasks(scn); - if (QDF_IS_STATUS_ERROR(ret)) { - hif_apps_irqs_enable(GET_HIF_OPAQUE_HDL(scn)); - return -EBUSY; - } - - return 0; + return hif_apps_enable_irq_wake(GET_HIF_OPAQUE_HDL(scn)); } int hif_ipci_bus_resume(struct hif_softc *scn) { - hif_apps_irqs_enable(GET_HIF_OPAQUE_HDL(scn)); - - return 0; + return hif_apps_disable_irq_wake(GET_HIF_OPAQUE_HDL(scn)); } int hif_ipci_bus_suspend_noirq(struct hif_softc *scn) { - if (hif_can_suspend_link(GET_HIF_OPAQUE_HDL(scn))) - qdf_atomic_set(&scn->link_suspended, 1); + QDF_STATUS ret; + + ret = hif_try_complete_tasks(scn); + if (QDF_IS_STATUS_ERROR(ret)) + return -EBUSY; return 0; } int hif_ipci_bus_resume_noirq(struct hif_softc *scn) { - if (hif_can_suspend_link(GET_HIF_OPAQUE_HDL(scn))) - qdf_atomic_set(&scn->link_suspended, 0); - return 0; } @@ -440,9 +428,6 @@ static int hif_ce_msi_configure_irq(struct hif_softc *scn) if (!ce_sc->tasklets[ce_id].inited) continue; - if (ce_id == wake_ce_id) - irqflags |= IRQF_NO_SUSPEND; - ipci_sc->ce_msi_irq_num[ce_id] = irq; ret = pfrm_request_irq(scn->qdf_dev->dev, irq, hif_ce_interrupt_handler,