diff --git a/components/pmo/dispatcher/inc/wlan_pmo_obj_mgmt_api.h b/components/pmo/dispatcher/inc/wlan_pmo_obj_mgmt_api.h index 2ff6c1f000..aefb6b7558 100644 --- a/components/pmo/dispatcher/inc/wlan_pmo_obj_mgmt_api.h +++ b/components/pmo/dispatcher/inc/wlan_pmo_obj_mgmt_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2019, 2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -271,6 +271,26 @@ QDF_STATUS pmo_register_is_device_in_low_pwr_mode(struct wlan_objmgr_psoc *psoc, QDF_STATUS pmo_unregister_is_device_in_low_pwr_mode(struct wlan_objmgr_psoc *psoc); +/** + * wlan_pmo_get_sap_mode_bus_suspend(): API to get SAP bus suspend config + * @psoc: objmgr psoc handle + * + * Return true in case of peer connected SAP bus suspend is allowed + * else return false + */ +bool +wlan_pmo_get_sap_mode_bus_suspend(struct wlan_objmgr_psoc *psoc); + +/** + * wlan_pmo_get_go_mode_bus_suspend(): API to get GO bus suspend config + * @psoc: objmgr psoc handle + * + * Return true in case of peer connected GO bus suspend is allowed + * else return false + */ +bool +wlan_pmo_get_go_mode_bus_suspend(struct wlan_objmgr_psoc *psoc); + #else /* WLAN_POWER_MANAGEMENT_OFFLOAD */ static inline QDF_STATUS pmo_init(void) @@ -422,6 +442,18 @@ pmo_unregister_get_beacon_interval_callback(struct wlan_objmgr_psoc *psoc) return QDF_STATUS_SUCCESS; } +static inline bool +wlan_pmo_get_sap_mode_bus_suspend(struct wlan_objmgr_psoc *psoc) +{ + return false; +} + +static inline bool +wlan_pmo_get_go_mode_bus_suspend(struct wlan_objmgr_psoc *psoc) +{ + return false; +} + #endif /* WLAN_POWER_MANAGEMENT_OFFLOAD */ #endif /* end of _WLAN_PMO_OBJ_MGMT_API_H_ */ diff --git a/components/pmo/dispatcher/src/wlan_pmo_obj_mgmt_api.c b/components/pmo/dispatcher/src/wlan_pmo_obj_mgmt_api.c index 390a99e06f..d0efc30700 100644 --- a/components/pmo/dispatcher/src/wlan_pmo_obj_mgmt_api.c +++ b/components/pmo/dispatcher/src/wlan_pmo_obj_mgmt_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -842,3 +842,25 @@ pmo_unregister_get_beacon_interval_callback(struct wlan_objmgr_psoc *psoc) return QDF_STATUS_SUCCESS; } + +bool +wlan_pmo_get_sap_mode_bus_suspend(struct wlan_objmgr_psoc *psoc) +{ + struct pmo_psoc_priv_obj *pmo_psoc_ctx = pmo_psoc_get_priv(psoc); + + if (!pmo_psoc_ctx) + return false; + + return pmo_psoc_ctx->psoc_cfg.is_bus_suspend_enabled_in_sap_mode; +} + +bool +wlan_pmo_get_go_mode_bus_suspend(struct wlan_objmgr_psoc *psoc) +{ + struct pmo_psoc_priv_obj *pmo_psoc_ctx = pmo_psoc_get_priv(psoc); + + if (!pmo_psoc_ctx) + return false; + + return pmo_psoc_ctx->psoc_cfg.is_bus_suspend_enabled_in_go_mode; +} diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c index 2de8a65275..8d65c120cb 100644 --- a/core/wma/src/wma_dev_if.c +++ b/core/wma/src/wma_dev_if.c @@ -4812,11 +4812,15 @@ void wma_add_sta(tp_wma_handle wma, tpAddStaParams add_sta) /* handle wow for sap with 1 or more peer in same way */ if (wma_is_vdev_in_sap_mode(wma, add_sta->smesessionId)) { bool is_bus_suspend_allowed_in_sap_mode = - ucfg_pmo_get_sap_mode_bus_suspend(wma->psoc); - wma_info("sap mode: disable runtime pm and bus suspend: %d", - is_bus_suspend_allowed_in_sap_mode); - if (!is_bus_suspend_allowed_in_sap_mode) + (wlan_pmo_get_sap_mode_bus_suspend(wma->psoc) && + wmi_service_enabled(wma->wmi_handle, + wmi_service_sap_connected_d3_wow)); + if (!is_bus_suspend_allowed_in_sap_mode) { htc_vote_link_up(htc_handle); + wmi_info("sap d0 wow"); + } else { + wmi_info("sap d3 wow"); + } wma_sap_prevent_runtime_pm(wma); return; @@ -4825,11 +4829,15 @@ void wma_add_sta(tp_wma_handle wma, tpAddStaParams add_sta) /* handle wow for p2pgo with 1 or more peer in same way */ if (wma_is_vdev_in_go_mode(wma, add_sta->smesessionId)) { bool is_bus_suspend_allowed_in_go_mode = - ucfg_pmo_get_go_mode_bus_suspend(wma->psoc); - wma_info("p2pgo mode: disable runtime pm and bus suspend: %d", - is_bus_suspend_allowed_in_go_mode); - if (!is_bus_suspend_allowed_in_go_mode) + (wlan_pmo_get_go_mode_bus_suspend(wma->psoc) && + wmi_service_enabled(wma->wmi_handle, + wmi_service_go_connected_d3_wow)); + if (!is_bus_suspend_allowed_in_go_mode) { htc_vote_link_up(htc_handle); + wmi_info("p2p go d0 wow"); + } else { + wmi_info("p2p go d3 wow"); + } wma_sap_prevent_runtime_pm(wma); return; @@ -4901,11 +4909,15 @@ void wma_delete_sta(tp_wma_handle wma, tpDeleteStaParams del_sta) if (wma_is_vdev_in_sap_mode(wma, del_sta->smesessionId)) { bool is_bus_suspend_allowed_in_sap_mode = - ucfg_pmo_get_sap_mode_bus_suspend(wma->psoc); - wma_info("sap mode: allow runtime pm and bus suspend: %d", - is_bus_suspend_allowed_in_sap_mode); - if (!is_bus_suspend_allowed_in_sap_mode) + (wlan_pmo_get_sap_mode_bus_suspend(wma->psoc) && + wmi_service_enabled(wma->wmi_handle, + wmi_service_sap_connected_d3_wow)); + if (!is_bus_suspend_allowed_in_sap_mode) { htc_vote_link_down(htc_handle); + wmi_info("sap d0 wow"); + } else { + wmi_info("sap d3 wow"); + } wma_sap_allow_runtime_pm(wma); return; @@ -4913,11 +4925,15 @@ void wma_delete_sta(tp_wma_handle wma, tpDeleteStaParams del_sta) if (wma_is_vdev_in_go_mode(wma, del_sta->smesessionId)) { bool is_bus_suspend_allowed_in_go_mode = - ucfg_pmo_get_go_mode_bus_suspend(wma->psoc); - wma_info("p2pgo mode: allow runtime pm and bus suspend: %d", - is_bus_suspend_allowed_in_go_mode); - if (!is_bus_suspend_allowed_in_go_mode) + (wlan_pmo_get_go_mode_bus_suspend(wma->psoc) && + wmi_service_enabled(wma->wmi_handle, + wmi_service_go_connected_d3_wow)); + if (!is_bus_suspend_allowed_in_go_mode) { htc_vote_link_down(htc_handle); + wmi_info("p2p go d0 wow"); + } else { + wmi_info("p2p go d3 wow"); + } wma_sap_allow_runtime_pm(wma); return;