From a545367d204ce78db5a48b30e5c457fd9f0ae12f Mon Sep 17 00:00:00 2001 From: Rajeev Kumar Date: Sun, 31 Jan 2021 18:30:17 -0800 Subject: [PATCH] qcacld-3.0: Add FW capability check for sap and go d3 wow Add WMI service FW capability check before enabling D0 and D3 WoW for SAP and GO clients connected mode. Change-Id: I878e4ee33807804e049bf1e8b8078d28fc1d4834 CRs-Fixed: 2869072 --- .../dispatcher/inc/wlan_pmo_obj_mgmt_api.h | 34 ++++++++++++- .../dispatcher/src/wlan_pmo_obj_mgmt_api.c | 24 +++++++++- core/wma/src/wma_dev_if.c | 48 ++++++++++++------- 3 files changed, 88 insertions(+), 18 deletions(-) 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 2ff6c1f00004..aefb6b7558c4 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 390a99e06ffe..d0efc3070080 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 46ffeb1e0a20..81ec9b0e949a 100644 --- a/core/wma/src/wma_dev_if.c +++ b/core/wma/src/wma_dev_if.c @@ -4740,11 +4740,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; @@ -4753,11 +4757,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; @@ -4826,11 +4834,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; @@ -4838,11 +4850,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;