diff --git a/components/fw_offload/core/inc/wlan_fw_offload_main.h b/components/fw_offload/core/inc/wlan_fw_offload_main.h index 1047966cf2..2d97d5cca4 100644 --- a/components/fw_offload/core/inc/wlan_fw_offload_main.h +++ b/components/fw_offload/core/inc/wlan_fw_offload_main.h @@ -62,6 +62,8 @@ * @btc_mpta_helper_enable: Enable/Disable tri-radio MPTA helper * @bt_sco_allow_wlan_2g_scan: Enable/Disble wlan 2g scan when * BT SCO connection is on + * @btc_three_way_coex_config_legacy_enable: Enable/Disable tri-radio coex + * config legacy feature */ struct wlan_fwol_coex_config { uint8_t btc_mode; @@ -79,6 +81,9 @@ struct wlan_fwol_coex_config { bool btc_mpta_helper_enable; #endif bool bt_sco_allow_wlan_2g_scan; +#ifdef FEATURE_COEX_CONFIG + bool btc_three_way_coex_config_legacy_enable; +#endif }; #define FWOL_THERMAL_LEVEL_MAX 4 diff --git a/components/fw_offload/core/src/wlan_fw_offload_main.c b/components/fw_offload/core/src/wlan_fw_offload_main.c index b4da9d31f4..51a3432e05 100644 --- a/components/fw_offload/core/src/wlan_fw_offload_main.c +++ b/components/fw_offload/core/src/wlan_fw_offload_main.c @@ -52,6 +52,32 @@ fwol_mpta_helper_config_get(struct wlan_objmgr_psoc *psoc, } #endif +/** + * fwol_three_way_coex_config_legacy_config_get: Populate + * btc_three_way_coex_config_legacy_enable from cfg + * @psoc: The global psoc handler + * @coex_config: The cfg structure + * + * Return: none + */ +#ifdef FEATURE_COEX_CONFIG +static void +fwol_three_way_coex_config_legacy_config_get( + struct wlan_objmgr_psoc *psoc, + struct wlan_fwol_coex_config *coex_config) +{ + coex_config->btc_three_way_coex_config_legacy_enable = + cfg_get(psoc, CFG_THREE_WAY_COEX_CONFIG_LEGACY); +} +#else +static void +fwol_three_way_coex_config_legacy_config_get( + struct wlan_objmgr_psoc *psoc, + struct wlan_fwol_coex_config *coex_config) +{ +} +#endif + static void fwol_init_coex_config_in_cfg(struct wlan_objmgr_psoc *psoc, struct wlan_fwol_coex_config *coex_config) @@ -79,6 +105,7 @@ fwol_init_coex_config_in_cfg(struct wlan_objmgr_psoc *psoc, fwol_mpta_helper_config_get(psoc, coex_config); coex_config->bt_sco_allow_wlan_2g_scan = cfg_get(psoc, CFG_BT_SCO_ALLOW_WLAN_2G_SCAN); + fwol_three_way_coex_config_legacy_config_get(psoc, coex_config); } static void diff --git a/components/fw_offload/dispatcher/inc/cfg_coex.h b/components/fw_offload/dispatcher/inc/cfg_coex.h index 5c226f4b49..c3b665b3f0 100644 --- a/components/fw_offload/dispatcher/inc/cfg_coex.h +++ b/components/fw_offload/dispatcher/inc/cfg_coex.h @@ -273,7 +273,6 @@ * This ini is used to enable or disable wlan 2g scan * when BT SCO connection is on. * - * * Usage: External * * @@ -283,6 +282,37 @@ 1, \ "Bt Sco Allow Wlan 2G Scan") +#ifdef FEATURE_COEX_CONFIG +/* + * + * gThreeWayCoexConfigLegacyEnable - Enable coex config legacy feature + * @Min: 0 + * @Max: 1 + * @Default: 0 + * + * This ini is used to enable or disable three way coex config legacy feature. + * This feature is designed only for non-mobile solution. + * When the feature is disabled, Firmware use the default configuration to + * set the coex priority of three antenna(WLAN, BT, ZIGBEE). + * when enable this feature, customer can use the vendor command to set antenna + * coex priority dynamically. + * + * Supported Feature: three way coex config + * + * Usage: External + * + * + */ +#define CFG_THREE_WAY_COEX_CONFIG_LEGACY CFG_INI_BOOL( \ + "gThreeWayCoexConfigLegacyEnable", \ + 0, \ + "Enable/Disable COEX Config Legacy") + +#define THREE_WAY_COEX_CONFIG_LEGACY_CFG CFG(CFG_THREE_WAY_COEX_CONFIG_LEGACY) +#else +#define THREE_WAY_COEX_CONFIG_LEGACY_CFG +#endif + #define CFG_COEX_ALL \ CFG(CFG_BTC_MODE) \ CFG(CFG_ANTENNA_ISOLATION) \ @@ -296,5 +326,6 @@ CFG(CFG_BT_INTERFERENCE_HIGH_LL) \ CFG(CFG_BT_INTERFERENCE_HIGH_UL) \ COEX_MPTA_HELPER_CFG \ - CFG(CFG_BT_SCO_ALLOW_WLAN_2G_SCAN) + CFG(CFG_BT_SCO_ALLOW_WLAN_2G_SCAN) \ + THREE_WAY_COEX_CONFIG_LEGACY_CFG #endif diff --git a/core/hdd/src/wlan_hdd_coex_config.c b/core/hdd/src/wlan_hdd_coex_config.c index fe2755fc18..b4e83bb022 100644 --- a/core/hdd/src/wlan_hdd_coex_config.c +++ b/core/hdd/src/wlan_hdd_coex_config.c @@ -29,6 +29,7 @@ #include "qca_vendor.h" #include "wlan_osif_request_manager.h" #include "osif_sync.h" +#include "wlan_fwol_ucfg_api.h" static const struct nla_policy coex_config_three_way_policy[QCA_VENDOR_ATTR_COEX_CONFIG_THREE_WAY_MAX + 1] = { @@ -67,6 +68,7 @@ static int __wlan_hdd_cfg80211_set_coex_config(struct wiphy *wiphy, struct nlattr *tb[QCA_VENDOR_ATTR_COEX_CONFIG_THREE_WAY_MAX + 1]; uint32_t config_type; struct coex_config_params coex_cfg_params = {0}; + struct wlan_fwol_coex_config config = {0}; int errno; QDF_STATUS status; @@ -76,6 +78,16 @@ static int __wlan_hdd_cfg80211_set_coex_config(struct wiphy *wiphy, if (errno != 0) return errno; + status = ucfg_fwol_get_coex_config_params(hdd_ctx->psoc, &config); + if (QDF_IS_STATUS_ERROR(status)) { + hdd_err("Unable to get coex config params"); + return -EINVAL; + } + if (!config.btc_three_way_coex_config_legacy_enable) { + hdd_err("Coex legacy feature should be enable first"); + return -EINVAL; + } + if (wlan_cfg80211_nla_parse(tb, QCA_VENDOR_ATTR_COEX_CONFIG_THREE_WAY_MAX, data, data_len, diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index a14c3dc068..bae4e26d52 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -6757,6 +6757,34 @@ static inline void wma_init_dbr_params(t_wma_handle *wma_handle) } #endif +/** + * wma_set_coex_res_cfg() - Set target COEX resource configuration. + * @wma_handle: pointer to wma global structure + * @wlan_res_cfg: Pointer to target resource configuration + * + * Return: none + */ +#ifdef FEATURE_COEX_CONFIG +static void wma_set_coex_res_cfg(t_wma_handle *wma_handle, + struct wmi_unified *wmi_handle, + target_resource_config *wlan_res_cfg) +{ + if (cfg_get(wma_handle->psoc, CFG_THREE_WAY_COEX_CONFIG_LEGACY) && + wmi_service_enabled(wmi_handle, + wmi_service_three_way_coex_config_legacy)) { + wlan_res_cfg->three_way_coex_config_legacy_en = true; + } else { + wlan_res_cfg->three_way_coex_config_legacy_en = false; + } +} +#else +static void wma_set_coex_res_cfg(t_wma_handle *wma_handle, + struct wmi_unified *wmi_handle, + target_resource_config *wlan_res_cfg) +{ +} +#endif + /** * wma_rx_service_ready_ext_event() - evt handler for sevice ready ext event. * @handle: wma handle @@ -6865,6 +6893,8 @@ int wma_rx_service_ready_ext_event(void *handle, uint8_t *event, wma_init_dbr_params(wma_handle); + wma_set_coex_res_cfg(wma_handle, wmi_handle, wlan_res_cfg); + return 0; }