From a9a470290f5ea19d0ed2b23feaeabd30b6b88f19 Mon Sep 17 00:00:00 2001 From: Alan Chen Date: Thu, 21 Jan 2021 19:04:00 -0800 Subject: [PATCH] qcacld-3.0: Add PMO config for PCIe bus suspend in beaconing mode By default, PCIe bus suspend is not allowed in beaconing modes (SAP/P2PGO/NDP) with one or more clients connected. Some OEMs need PCIe bus suspend in this mode. Hence, add a config item to serve both types of requests. Change-Id: Ia2d990f17f605036d43db75ecd4df57701b4ba1f CRs-Fixed: 2860495 --- components/pmo/core/src/wlan_pmo_main.c | 4 ++- .../pmo/dispatcher/inc/wlan_pmo_common_cfg.h | 33 +++++++++++++++++-- .../inc/wlan_pmo_common_public_struct.h | 3 +- .../pmo/dispatcher/inc/wlan_pmo_ucfg_api.h | 13 +++++++- .../pmo/dispatcher/src/wlan_pmo_ucfg_api.c | 11 ++++++- core/wma/src/wma_dev_if.c | 29 +++++++++++++--- 6 files changed, 82 insertions(+), 11 deletions(-) diff --git a/components/pmo/core/src/wlan_pmo_main.c b/components/pmo/core/src/wlan_pmo_main.c index 5dc92677d0..67458c20b8 100644 --- a/components/pmo/core/src/wlan_pmo_main.c +++ b/components/pmo/core/src/wlan_pmo_main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-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 @@ -206,6 +206,8 @@ static void wlan_pmo_init_cfg(struct wlan_objmgr_psoc *psoc, psoc_cfg->power_save_mode = cfg_get(psoc, CFG_PMO_POWERSAVE_MODE); psoc_cfg->is_mod_dtim_on_sys_suspend_enabled = cfg_get(psoc, CFG_PMO_MOD_DTIM_ON_SYS_SUSPEND); + psoc_cfg->is_bus_suspend_enabled_in_beaconing_mode = + cfg_get(psoc, CFG_ENABLE_BUS_SUSPEND_IN_BEACONING_MODE); psoc_cfg->default_power_save_mode = psoc_cfg->power_save_mode; psoc_cfg->max_ps_poll = cfg_get(psoc, CFG_PMO_MAX_PS_POLL); diff --git a/components/pmo/dispatcher/inc/wlan_pmo_common_cfg.h b/components/pmo/dispatcher/inc/wlan_pmo_common_cfg.h index cc185ad3eb..8fd2d8f271 100644 --- a/components/pmo/dispatcher/inc/wlan_pmo_common_cfg.h +++ b/components/pmo/dispatcher/inc/wlan_pmo_common_cfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-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 @@ -404,6 +404,34 @@ CFG_VALUE_OR_DEFAULT, \ "RA rate limit interval") +/* + * + * enable_bus_suspend_in_beaconing_mode - enable PCIe bus suspend as part of + * platform system suspend for SAP/P2PGO/NDP with one or more clients connected + * @Min: 0 + * @Max: 1 + * @Default: 0 + * + * This ini is used to PCIe bus suspend as part of platform system suspend for + * SAP/P2PGO/NDP with one or more clients connected + * + * 0: PCIe Bus suspend is not supported in beaconing mode (SAP/P2PGO/NDP) with + * one or more clients connected + * 1: PCIe Bus suspend is supported in beaconing mode (SAP/P2PGO/NDP) with one + * or more clients connected + * Related: None + * + * Supported Feature: Power Save + * + * Usage: Internal + * + * + */ +#define CFG_ENABLE_BUS_SUSPEND_IN_BEACONING_MODE CFG_INI_BOOL( \ + "enable_bus_suspend_in_beaconing_mode", \ + 0, \ + "This ini is used to enable bus suspend in beaconing mode") + #define CFG_PMO_COMMON_ALL \ CFG(CFG_ENABLE_SAP_SUSPEND) \ CFG(CFG_PMO_ENABLE_HOST_ARPOFFLOAD) \ @@ -420,6 +448,7 @@ CFG(CFG_PMO_PWR_FAILURE) \ CFG(CFG_PMO_WOW_DATA_INACTIVITY_TIMEOUT) \ CFG(CFG_RA_RATE_LIMIT_INTERVAL) \ - CFG(CFG_PMO_MOD_DTIM_ON_SYS_SUSPEND) + CFG(CFG_PMO_MOD_DTIM_ON_SYS_SUSPEND) \ + CFG(CFG_ENABLE_BUS_SUSPEND_IN_BEACONING_MODE) #endif /* WLAN_PMO_COMMON_CFG_H__ */ diff --git a/components/pmo/dispatcher/inc/wlan_pmo_common_public_struct.h b/components/pmo/dispatcher/inc/wlan_pmo_common_public_struct.h index 3da65ca773..00c6decc85 100644 --- a/components/pmo/dispatcher/inc/wlan_pmo_common_public_struct.h +++ b/components/pmo/dispatcher/inc/wlan_pmo_common_public_struct.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-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 @@ -390,6 +390,7 @@ struct pmo_psoc_cfg { enum active_apf_mode active_mc_bc_apf_mode; uint8_t ito_repeat_count; bool is_mod_dtim_on_sys_suspend_enabled; + bool is_bus_suspend_enabled_in_beaconing_mode; #ifdef WLAN_ENABLE_GPIO_WAKEUP bool enable_gpio_wakeup; uint32_t gpio_wakeup_pin; diff --git a/components/pmo/dispatcher/inc/wlan_pmo_ucfg_api.h b/components/pmo/dispatcher/inc/wlan_pmo_ucfg_api.h index d2701e7dcc..26afb3ff1d 100644 --- a/components/pmo/dispatcher/inc/wlan_pmo_ucfg_api.h +++ b/components/pmo/dispatcher/inc/wlan_pmo_ucfg_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-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 @@ -2027,4 +2027,15 @@ ucfg_pmo_get_runtime_pm_delay(struct wlan_objmgr_psoc *psoc) */ bool ucfg_pmo_get_enable_sap_suspend(struct wlan_objmgr_psoc *psoc); + +/** + * ucfg_pmo_get_beacoing_mode_bus_suspend() - get PMO config for PCIe bus + * suspend in beaconing mode (SAP/P2PGO/NDP) with one or more clients + * @psoc: pointer to psoc object + * + * Return: bool + */ +bool +ucfg_pmo_get_beaconing_mode_bus_suspend(struct wlan_objmgr_psoc *psoc); + #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 6287722f9c..767895ebdf 100644 --- a/components/pmo/dispatcher/src/wlan_pmo_ucfg_api.c +++ b/components/pmo/dispatcher/src/wlan_pmo_ucfg_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-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 @@ -893,3 +893,12 @@ ucfg_pmo_get_gpio_wakeup_mode(struct wlan_objmgr_psoc *psoc) return pmo_psoc_ctx->psoc_cfg.gpio_wakeup_mode; } #endif + +bool +ucfg_pmo_get_beaconing_mode_bus_suspend(struct wlan_objmgr_psoc *psoc) +{ + struct pmo_psoc_priv_obj *pmo_psoc_ctx = pmo_psoc_get_priv(psoc); + + return pmo_psoc_ctx->psoc_cfg.is_bus_suspend_enabled_in_beaconing_mode; +} + diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c index e63996cd60..b0f7410465 100644 --- a/core/wma/src/wma_dev_if.c +++ b/core/wma/src/wma_dev_if.c @@ -4735,6 +4735,8 @@ void wma_add_sta(tp_wma_handle wma, tpAddStaParams add_sta) { uint8_t oper_mode = BSS_OPERATIONAL_MODE_STA; void *htc_handle; + bool is_bus_suspend_allowed_in_beaconing_mode = + ucfg_pmo_get_beaconing_mode_bus_suspend(wma->psoc); htc_handle = lmac_get_htc_hdl(wma->psoc); if (!htc_handle) { @@ -4763,9 +4765,17 @@ void wma_add_sta(tp_wma_handle wma, tpAddStaParams add_sta) break; } - /* handle wow for sap and nan with 1 or more peer in same way */ - if (BSS_OPERATIONAL_MODE_AP == oper_mode || - BSS_OPERATIONAL_MODE_NDI == oper_mode) { + /* handle wow for sap/p2pgo with 1 or more peer in same way */ + if (BSS_OPERATIONAL_MODE_AP == oper_mode) { + wma_debug("disable runtime pm and bus suspend: %d", + is_bus_suspend_allowed_in_beaconing_mode); + if (!is_bus_suspend_allowed_in_beaconing_mode) + htc_vote_link_up(htc_handle); + wma_sap_prevent_runtime_pm(wma); + } + + /* handle wow for nan with 1 or more peer in same way */ + if (BSS_OPERATIONAL_MODE_NDI == oper_mode) { wma_debug("disable runtime pm and vote for link up"); htc_vote_link_up(htc_handle); wma_sap_prevent_runtime_pm(wma); @@ -4781,6 +4791,8 @@ void wma_delete_sta(tp_wma_handle wma, tpDeleteStaParams del_sta) uint8_t smesession_id = del_sta->smesessionId; bool rsp_requested = del_sta->respReqd; void *htc_handle; + bool is_bus_suspend_allowed_in_beaconing_mode = + ucfg_pmo_get_beaconing_mode_bus_suspend(wma->psoc); htc_handle = lmac_get_htc_hdl(wma->psoc); if (!htc_handle) { @@ -4828,8 +4840,15 @@ void wma_delete_sta(tp_wma_handle wma, tpDeleteStaParams del_sta) qdf_mem_free(del_sta); } - if (BSS_OPERATIONAL_MODE_AP == oper_mode || - BSS_OPERATIONAL_MODE_NDI == oper_mode) { + if (BSS_OPERATIONAL_MODE_AP == oper_mode) { + wma_debug("allow runtime pm and bus suspend: %d", + is_bus_suspend_allowed_in_beaconing_mode); + if (!is_bus_suspend_allowed_in_beaconing_mode) + htc_vote_link_down(htc_handle); + wma_sap_allow_runtime_pm(wma); + } + + if (BSS_OPERATIONAL_MODE_NDI == oper_mode) { wma_debug("allow runtime pm and vote for link down"); htc_vote_link_down(htc_handle); wma_sap_allow_runtime_pm(wma);