diff --git a/Kbuild b/Kbuild index 6e44f69c1efe..1082fd1a9a04 100644 --- a/Kbuild +++ b/Kbuild @@ -3303,6 +3303,7 @@ cppflags-y += -DDP_RX_DESC_COOKIE_INVALIDATE cppflags-y += -DMON_ENABLE_DROP_FOR_MAC cppflags-y += -DPCI_LINK_STATUS_SANITY cppflags-y += -DDP_MON_RSSI_IN_DBM +cppflags-y += -DSYSTEM_PM_CHECK endif # Enable Low latency optimisation mode diff --git a/components/pmo/core/inc/wlan_pmo_suspend_resume.h b/components/pmo/core/inc/wlan_pmo_suspend_resume.h index dc66f7673f1a..799f691ec2c3 100644 --- a/components/pmo/core/inc/wlan_pmo_suspend_resume.h +++ b/components/pmo/core/inc/wlan_pmo_suspend_resume.h @@ -360,6 +360,20 @@ QDF_STATUS pmo_core_txrx_resume(struct wlan_objmgr_psoc *psoc); */ QDF_STATUS pmo_core_config_forced_dtim(struct wlan_objmgr_vdev *vdev, uint32_t dynamic_dtim); + +#ifdef SYSTEM_PM_CHECK +/** + * pmo_core_system_resume() - function to handle system resume notification + * @psoc: objmgr psoc handle + * + * Return: None + */ +void pmo_core_system_resume(struct wlan_objmgr_psoc *psoc); +#else +static inline void pmo_core_system_resume(struct wlan_objmgr_psoc *psoc) +{ +} +#endif #endif /* WLAN_POWER_MANAGEMENT_OFFLOAD */ #endif /* end of _WLAN_PMO_SUSPEND_RESUME_H_ */ diff --git a/components/pmo/core/src/wlan_pmo_suspend_resume.c b/components/pmo/core/src/wlan_pmo_suspend_resume.c index 8c1023bad311..6c07d981c251 100644 --- a/components/pmo/core/src/wlan_pmo_suspend_resume.c +++ b/components/pmo/core/src/wlan_pmo_suspend_resume.c @@ -1810,3 +1810,28 @@ out: pmo_exit(); return status; } + +#ifdef SYSTEM_PM_CHECK +void pmo_core_system_resume(struct wlan_objmgr_psoc *psoc) +{ + struct pmo_psoc_priv_obj *psoc_ctx; + QDF_STATUS status; + + if (!psoc) { + pmo_err("psoc is NULL"); + return; + } + + status = pmo_psoc_get_ref(psoc); + if (status != QDF_STATUS_SUCCESS) { + pmo_err("pmo cannot get the reference out of psoc"); + return; + } + + psoc_ctx = pmo_psoc_get_priv(psoc); + + htc_system_resume(psoc_ctx->htc_hdl); + + pmo_psoc_put_ref(psoc); +} +#endif diff --git a/components/pmo/dispatcher/inc/wlan_pmo_ucfg_api.h b/components/pmo/dispatcher/inc/wlan_pmo_ucfg_api.h index 07807a53ba7d..99033a698383 100644 --- a/components/pmo/dispatcher/inc/wlan_pmo_ucfg_api.h +++ b/components/pmo/dispatcher/inc/wlan_pmo_ucfg_api.h @@ -2028,4 +2028,19 @@ ucfg_pmo_get_sap_mode_bus_suspend(struct wlan_objmgr_psoc *psoc); bool ucfg_pmo_get_go_mode_bus_suspend(struct wlan_objmgr_psoc *psoc); +#ifdef SYSTEM_PM_CHECK +/** + * ucfg_pmo_notify_system_resume() - system resume notification to pmo + * @psoc: pointer to psoc object + * + * Return: None + */ +void +ucfg_pmo_notify_system_resume(struct wlan_objmgr_psoc *psoc); +#else +static inline +void ucfg_pmo_notify_system_resume(struct wlan_objmgr_psoc *psoc) +{ +} +#endif #endif /* end of _WLAN_PMO_UCFG_API_H_ */ diff --git a/components/pmo/dispatcher/src/wlan_pmo_ucfg_api.c b/components/pmo/dispatcher/src/wlan_pmo_ucfg_api.c index 6c08e65418b1..1ce956fca195 100644 --- a/components/pmo/dispatcher/src/wlan_pmo_ucfg_api.c +++ b/components/pmo/dispatcher/src/wlan_pmo_ucfg_api.c @@ -895,3 +895,10 @@ QDF_STATUS ucfg_pmo_core_txrx_resume(struct wlan_objmgr_psoc *psoc) { return pmo_core_txrx_resume(psoc); } + +#ifdef SYSTEM_PM_CHECK +void ucfg_pmo_notify_system_resume(struct wlan_objmgr_psoc *psoc) +{ + pmo_core_system_resume(psoc); +} +#endif diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c index 73e9e25b1d4e..6b2b7b7e4b44 100644 --- a/core/hdd/src/wlan_hdd_driver_ops.c +++ b/core/hdd/src/wlan_hdd_driver_ops.c @@ -1217,6 +1217,8 @@ static int __wlan_hdd_bus_suspend(struct wow_enable_params wow_params) goto late_hif_resume; } + hif_system_pm_set_state_suspended(hif_ctx); + err = hif_bus_suspend(hif_ctx); if (err) { hdd_err("Failed hif bus suspend: %d", err); @@ -1266,6 +1268,7 @@ late_hif_resume: resume_cdp: status = cdp_bus_resume(dp_soc, OL_TXRX_PDEV_ID); QDF_BUG(QDF_IS_STATUS_SUCCESS(status)); + hif_system_pm_set_state_on(hif_ctx); return err; } @@ -1431,6 +1434,8 @@ int wlan_hdd_bus_resume(void) goto out; } + hif_system_pm_set_state_resuming(hif_ctx); + qdf_status = ucfg_pmo_psoc_bus_resume_req(hdd_ctx->psoc, QDF_SYSTEM_SUSPEND); status = qdf_status_to_os_return(qdf_status); @@ -1439,6 +1444,8 @@ int wlan_hdd_bus_resume(void) goto out; } + hif_system_pm_set_state_on(hif_ctx); + status = hif_bus_late_resume(hif_ctx); if (status) { hdd_err("Failed hif bus late resume"); @@ -1457,6 +1464,7 @@ int wlan_hdd_bus_resume(void) return 0; out: + hif_system_pm_set_state_suspended(hif_ctx); if (cds_is_driver_recovering() || cds_is_driver_in_bad_state() || cds_is_fw_down()) return 0; diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index dba3e491c41b..5e6ac65c98f2 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -1926,6 +1926,8 @@ static int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) } } + ucfg_pmo_notify_system_resume(hdd_ctx->psoc); + qdf_mtrace(QDF_MODULE_ID_HDD, QDF_MODULE_ID_HDD, TRACE_CODE_HDD_CFG80211_RESUME_WLAN, NO_SESSION, hdd_ctx->is_wiphy_suspended);