Jelajahi Sumber

qcacld-3.0: Add fixed FDD mode to btc_chain_mode

Previously when chains of BT and WLAN 2.4 GHz are separated,
hybrid mode will be used for BTC. Now adding fixed FDD mode
to fulfill different BTC scenarios.

Change-Id: I3a4d6919319f0f66e6b816566f24f4ac11b2c669
CRs-Fixed: 3244045
Xiaoning Ma 2 tahun lalu
induk
melakukan
a7fcc140bb

+ 5 - 3
components/coex/core/inc/wlan_coex_main.h

@@ -55,7 +55,7 @@ struct wlan_coex_callback {
  * @cb: structure to dbam callback
  */
 struct coex_psoc_obj {
-	uint8_t btc_chain_mode;
+	enum coex_btc_chain_mode btc_chain_mode;
 	update_coex_cb coex_config_updated[COEX_CONFIG_TYPE_MAX];
 #ifdef WLAN_FEATURE_DBAM_CONFIG
 	struct wlan_coex_callback cb;
@@ -161,7 +161,8 @@ QDF_STATUS wlan_coex_psoc_destroyed_notification(struct wlan_objmgr_psoc *psoc,
  * Return : status of operation
  */
 QDF_STATUS
-wlan_coex_psoc_set_btc_chain_mode(struct wlan_objmgr_psoc *psoc, uint8_t val);
+wlan_coex_psoc_set_btc_chain_mode(struct wlan_objmgr_psoc *psoc,
+				  enum coex_btc_chain_mode val);
 
 /**
  * wlan_coex_psoc_get_btc_chain_mode() - private API to get BT coex chain mode
@@ -172,7 +173,8 @@ wlan_coex_psoc_set_btc_chain_mode(struct wlan_objmgr_psoc *psoc, uint8_t val);
  * Return : status of operation
  */
 QDF_STATUS
-wlan_coex_psoc_get_btc_chain_mode(struct wlan_objmgr_psoc *psoc, uint8_t *val);
+wlan_coex_psoc_get_btc_chain_mode(struct wlan_objmgr_psoc *psoc,
+				  enum coex_btc_chain_mode *val);
 #endif
 
 #ifdef WLAN_FEATURE_DBAM_CONFIG

+ 4 - 2
components/coex/core/src/wlan_coex_main.c

@@ -129,7 +129,8 @@ wlan_coex_config_updated(struct wlan_objmgr_vdev *vdev, uint8_t type)
 }
 
 QDF_STATUS
-wlan_coex_psoc_set_btc_chain_mode(struct wlan_objmgr_psoc *psoc, uint8_t val)
+wlan_coex_psoc_set_btc_chain_mode(struct wlan_objmgr_psoc *psoc,
+				  enum coex_btc_chain_mode val)
 {
 	struct coex_psoc_obj *coex_obj;
 
@@ -143,7 +144,8 @@ wlan_coex_psoc_set_btc_chain_mode(struct wlan_objmgr_psoc *psoc, uint8_t val)
 }
 
 QDF_STATUS
-wlan_coex_psoc_get_btc_chain_mode(struct wlan_objmgr_psoc *psoc, uint8_t *val)
+wlan_coex_psoc_get_btc_chain_mode(struct wlan_objmgr_psoc *psoc,
+				  enum coex_btc_chain_mode *val)
 {
 	struct coex_psoc_obj *coex_obj;
 

+ 25 - 9
components/coex/dispatcher/inc/wlan_coex_ucfg_api.h

@@ -25,12 +25,23 @@
 #include "qdf_status.h"
 #include <wlan_objmgr_vdev_obj.h>
 #include <wlan_objmgr_psoc_obj.h>
-#include "qca_vendor.h"
 #include "wlan_coex_public_structs.h"
 
-#define WLAN_COEX_BTC_CHAIN_MODE_SHARED QCA_BTC_CHAIN_SHARED
-#define WLAN_COEX_BTC_CHAIN_MODE_SEPARATED QCA_BTC_CHAIN_SEPARATED
-#define WLAN_COEX_BTC_CHAIN_MODE_UNSETTLED 0xFF
+/**
+ * enum coex_btc_chain_mode - btc chain mode definitions
+ * @WLAN_COEX_BTC_CHAIN_MODE_SHARED: chains of BT and WLAN 2.4 GHz are shared.
+ * @WLAN_COEX_BTC_CHAIN_MODE_FDD: chains of BT and WLAN 2.4 GHz are
+ * separated, FDD mode.
+ * @WLAN_COEX_BTC_CHAIN_MODE_HYBRID: chains of BT and WLAN 2.4 GHz are
+ * separated, hybrid mode.
+ * @WLAN_COEX_BTC_CHAIN_MODE_UNSETTLED: chain mode is not set.
+ */
+enum coex_btc_chain_mode {
+	WLAN_COEX_BTC_CHAIN_MODE_SHARED = 0,
+	WLAN_COEX_BTC_CHAIN_MODE_FDD,
+	WLAN_COEX_BTC_CHAIN_MODE_HYBRID,
+	WLAN_COEX_BTC_CHAIN_MODE_UNSETTLED = 0xFF,
+};
 
 /**
  * enum coex_config_type - coex config type definitions
@@ -74,7 +85,8 @@ ucfg_coex_register_cfg_updated_handler(struct wlan_objmgr_psoc *psoc,
  * Return : status of operation
  */
 QDF_STATUS
-ucfg_coex_psoc_set_btc_chain_mode(struct wlan_objmgr_psoc *psoc, uint8_t val);
+ucfg_coex_psoc_set_btc_chain_mode(struct wlan_objmgr_psoc *psoc,
+				  enum coex_btc_chain_mode val);
 
 /**
  * ucfg_coex_psoc_get_btc_chain_mode() - API to get BT coex chain mode from psoc
@@ -84,7 +96,8 @@ ucfg_coex_psoc_set_btc_chain_mode(struct wlan_objmgr_psoc *psoc, uint8_t val);
  * Return : status of operation
  */
 QDF_STATUS
-ucfg_coex_psoc_get_btc_chain_mode(struct wlan_objmgr_psoc *psoc, uint8_t *val);
+ucfg_coex_psoc_get_btc_chain_mode(struct wlan_objmgr_psoc *psoc,
+				  enum coex_btc_chain_mode *val);
 
 /**
  * ucfg_coex_send_btc_chain_mode() - API to send BT coex config to target if
@@ -94,7 +107,8 @@ ucfg_coex_psoc_get_btc_chain_mode(struct wlan_objmgr_psoc *psoc, uint8_t *val);
  * Return: status of operation
  */
 QDF_STATUS
-ucfg_coex_send_btc_chain_mode(struct wlan_objmgr_vdev *vdev, uint8_t mode);
+ucfg_coex_send_btc_chain_mode(struct wlan_objmgr_vdev *vdev,
+			      enum coex_btc_chain_mode mode);
 #else
 static inline QDF_STATUS
 ucfg_coex_register_cfg_updated_handler(struct wlan_objmgr_psoc *psoc,
@@ -105,7 +119,8 @@ ucfg_coex_register_cfg_updated_handler(struct wlan_objmgr_psoc *psoc,
 }
 
 static inline QDF_STATUS
-ucfg_coex_psoc_get_btc_chain_mode(struct wlan_objmgr_psoc *psoc, uint8_t *val)
+ucfg_coex_psoc_get_btc_chain_mode(struct wlan_objmgr_psoc *psoc,
+				  enum coex_btc_chain_mode *val)
 {
 	if (val)
 		*val = WLAN_COEX_BTC_CHAIN_MODE_UNSETTLED;
@@ -114,7 +129,8 @@ ucfg_coex_psoc_get_btc_chain_mode(struct wlan_objmgr_psoc *psoc, uint8_t *val)
 }
 
 static inline QDF_STATUS
-ucfg_coex_send_btc_chain_mode(struct wlan_objmgr_vdev *vdev, uint8_t mode)
+ucfg_coex_send_btc_chain_mode(struct wlan_objmgr_vdev *vdev,
+			      enum coex_btc_chain_mode mode)
 {
 	return QDF_STATUS_SUCCESS;
 }

+ 7 - 5
components/coex/dispatcher/src/wlan_coex_ucfg_api.c

@@ -46,24 +46,26 @@ ucfg_coex_register_cfg_updated_handler(struct wlan_objmgr_psoc *psoc,
 }
 
 QDF_STATUS
-ucfg_coex_psoc_set_btc_chain_mode(struct wlan_objmgr_psoc *psoc, uint8_t val)
+ucfg_coex_psoc_set_btc_chain_mode(struct wlan_objmgr_psoc *psoc,
+				  enum coex_btc_chain_mode val)
 {
 	return wlan_coex_psoc_set_btc_chain_mode(psoc, val);
 }
 
 QDF_STATUS
-ucfg_coex_psoc_get_btc_chain_mode(struct wlan_objmgr_psoc *psoc, uint8_t *val)
+ucfg_coex_psoc_get_btc_chain_mode(struct wlan_objmgr_psoc *psoc,
+				  enum coex_btc_chain_mode *val)
 {
 	return wlan_coex_psoc_get_btc_chain_mode(psoc, val);
 }
 
 QDF_STATUS
-ucfg_coex_send_btc_chain_mode(struct wlan_objmgr_vdev *vdev, uint8_t mode)
+ucfg_coex_send_btc_chain_mode(struct wlan_objmgr_vdev *vdev,
+			      enum coex_btc_chain_mode mode)
 {
 	struct coex_config_params param = {0};
 
-	if (mode != WLAN_COEX_BTC_CHAIN_MODE_SHARED &&
-	    mode != WLAN_COEX_BTC_CHAIN_MODE_SEPARATED)
+	if (mode > WLAN_COEX_BTC_CHAIN_MODE_HYBRID)
 		return QDF_STATUS_E_INVAL;
 
 	param.vdev_id = wlan_vdev_get_id(vdev);

+ 2 - 3
components/coex/dispatcher/src/wlan_coex_utils_api.c

@@ -90,7 +90,7 @@ QDF_STATUS wlan_coex_deinit(void)
 static void
 wlan_coex_set_btc_chain_mode_with_ini(struct wlan_objmgr_psoc *psoc)
 {
-	uint8_t btc_chain_mode;
+	enum coex_btc_chain_mode btc_chain_mode;
 	QDF_STATUS status;
 
 	status = wlan_coex_psoc_get_btc_chain_mode(psoc, &btc_chain_mode);
@@ -101,8 +101,7 @@ wlan_coex_set_btc_chain_mode_with_ini(struct wlan_objmgr_psoc *psoc)
 
 	if (btc_chain_mode == WLAN_COEX_BTC_CHAIN_MODE_UNSETTLED) {
 		btc_chain_mode = cfg_get(psoc, CFG_SET_INIT_CHAIN_MODE_FOR_BTC);
-		if (btc_chain_mode != WLAN_COEX_BTC_CHAIN_MODE_SHARED &&
-		    btc_chain_mode != WLAN_COEX_BTC_CHAIN_MODE_SEPARATED &&
+		if (btc_chain_mode > WLAN_COEX_BTC_CHAIN_MODE_HYBRID &&
 		    btc_chain_mode != WLAN_COEX_BTC_CHAIN_MODE_UNSETTLED) {
 			coex_err("invalid ini config %d for btc chain mode",
 				 btc_chain_mode);

+ 5 - 1
components/fw_offload/dispatcher/inc/cfg_coex.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2012 - 2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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
@@ -349,7 +350,10 @@
  * only below values can be set:
  * 0 - init WLAN 2.4G to support 2x2.
  *     It means chains of BT and WLAN 2.4G are shared, or BT is OFF.
- * 1 - init WLAN 2.4G as 1x1, chains of BT and WLAN 2.4G are separated.
+ * 1 - init WLAN 2.4G as 1x1, chains of BT and WLAN 2.4G are separated,
+ *     fixed FDD.
+ * 2 - init WLAN 2.4G as 1x1, chains of BT and WLAN 2.4G are separated,
+ *     hybrid mode
  * 0xFF - no need to send init chain mode for BTC to firmware.
  *
  * Supported Feature: init chain mode for BTC

+ 4 - 2
core/hdd/src/wlan_hdd_btc_chain_mode.c

@@ -35,7 +35,8 @@ wlan_hdd_btc_chain_mode_handler(struct wlan_objmgr_vdev *vdev)
 	QDF_STATUS status;
 	struct hdd_adapter *adapter;
 	mac_handle_t mac_handle;
-	uint8_t nss, mode, band;
+	uint8_t nss, band;
+	enum coex_btc_chain_mode mode;
 	uint8_t vdev_id;
 	uint32_t freq;
 	struct wlan_objmgr_psoc *psoc;
@@ -73,7 +74,8 @@ wlan_hdd_btc_chain_mode_handler(struct wlan_objmgr_vdev *vdev)
 		return -EINVAL;
 	}
 
-	nss = ((mode == QCA_BTC_CHAIN_SEPARATED) ? 1 : 2);
+	nss = ((mode == WLAN_COEX_BTC_CHAIN_MODE_FDD ||
+		mode == WLAN_COEX_BTC_CHAIN_MODE_HYBRID) ? 1 : 2);
 
 	hdd_debug("update nss to %d for vdev %d, device mode %d",
 		  nss, adapter->vdev_id, adapter->device_mode);

+ 6 - 10
core/hdd/src/wlan_hdd_main.c

@@ -6859,7 +6859,7 @@ static int hdd_send_coex_config_params(struct hdd_context *hdd_ctx,
 	struct coex_config_params coex_cfg_params = {0};
 	struct wlan_fwol_coex_config config = {0};
 	struct wlan_objmgr_psoc *psoc = hdd_ctx->psoc;
-	uint8_t btc_chain_mode;
+	enum coex_btc_chain_mode btc_chain_mode;
 	QDF_STATUS status;
 
 	if (!adapter) {
@@ -6908,16 +6908,12 @@ static int hdd_send_coex_config_params(struct hdd_context *hdd_ctx,
 		hdd_err("Failed to get btc chain mode");
 		btc_chain_mode = WLAN_COEX_BTC_CHAIN_MODE_UNSETTLED;
 	}
-	switch (btc_chain_mode) {
-	case WLAN_COEX_BTC_CHAIN_MODE_SHARED:
-		coex_cfg_params.config_arg1 = 0;
-		break;
-	case WLAN_COEX_BTC_CHAIN_MODE_SEPARATED:
-		coex_cfg_params.config_arg1 = 2;
-		break;
-	default:
+
+	if (btc_chain_mode <= WLAN_COEX_BTC_CHAIN_MODE_HYBRID)
+		coex_cfg_params.config_arg1 = btc_chain_mode;
+	else
 		coex_cfg_params.config_arg1 = config.btc_mode;
-	}
+
 	hdd_debug("Configured BTC mode is %d, BTC chain mode is 0x%x, set BTC mode to %d",
 		  config.btc_mode, btc_chain_mode,
 		  coex_cfg_params.config_arg1);

+ 4 - 2
core/sme/src/common/sme_api.c

@@ -4085,8 +4085,9 @@ sme_fill_nss_chain_params(struct mac_context *mac_ctx,
 			  enum nss_chains_band_info band,
 			  uint8_t rf_chains_supported)
 {
-	uint8_t nss_chain_shift, btc_chain_mode;
+	uint8_t nss_chain_shift;
 	uint8_t max_supported_nss;
+	enum coex_btc_chain_mode btc_chain_mode;
 	struct wlan_mlme_nss_chains *nss_chains_ini_cfg =
 					&mac_ctx->mlme_cfg->nss_chains_ini_cfg;
 	QDF_STATUS status;
@@ -4111,7 +4112,8 @@ sme_fill_nss_chain_params(struct mac_context *mac_ctx,
 	}
 
 	if (band == NSS_CHAINS_BAND_2GHZ &&
-	    btc_chain_mode == QCA_BTC_CHAIN_SEPARATED)
+	    (btc_chain_mode == WLAN_COEX_BTC_CHAIN_MODE_FDD ||
+	     btc_chain_mode == WLAN_COEX_BTC_CHAIN_MODE_HYBRID))
 		max_supported_nss = NSS_1x1_MODE;
 
 	/* If the fw doesn't support two chains, num rf chains can max be 1 */

+ 1 - 1
core/wma/src/wma_dev_if.c

@@ -3135,7 +3135,7 @@ QDF_STATUS wma_vdev_pre_start(uint8_t vdev_id, bool restart)
 	struct wlan_objmgr_vdev *vdev;
 	struct wlan_channel *des_chan;
 	QDF_STATUS status;
-	uint8_t btc_chain_mode;
+	enum coex_btc_chain_mode btc_chain_mode;
 	struct wlan_mlme_qos *qos_aggr;
 	uint8_t amsdu_val;
 

+ 32 - 5
os_if/coex/src/wlan_cfg80211_coex.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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 above
@@ -31,12 +32,28 @@ btc_chain_mode_policy[QCA_VENDOR_ATTR_BTC_CHAIN_MODE_MAX + 1] = {
 	[QCA_VENDOR_ATTR_BTC_CHAIN_MODE_RESTART] = {.type = NLA_FLAG},
 };
 
+static enum coex_btc_chain_mode
+__wlan_cfg80211_coex_map_btc_chain_mode(enum qca_btc_chain_mode mode)
+{
+	switch (mode) {
+	case QCA_BTC_CHAIN_SHARED:
+		return WLAN_COEX_BTC_CHAIN_MODE_SHARED;
+	case QCA_BTC_CHAIN_SEPARATED_HYBRID:
+		return WLAN_COEX_BTC_CHAIN_MODE_HYBRID;
+	case QCA_BTC_CHAIN_SEPARATED_FDD:
+		return WLAN_COEX_BTC_CHAIN_MODE_FDD;
+	default:
+		return WLAN_COEX_BTC_CHAIN_MODE_UNSETTLED;
+	}
+}
+
 static int
 __wlan_cfg80211_coex_set_btc_chain_mode(struct wlan_objmgr_vdev *vdev,
-					uint8_t mode, bool do_restart)
+					enum coex_btc_chain_mode mode,
+					bool do_restart)
 {
 	QDF_STATUS status;
-	uint8_t cur_mode;
+	enum coex_btc_chain_mode cur_mode;
 	int err;
 	struct wlan_objmgr_psoc *psoc;
 	struct wlan_objmgr_vdev *vdev_tmp;
@@ -107,6 +124,7 @@ int wlan_cfg80211_coex_set_btc_chain_mode(struct wlan_objmgr_vdev *vdev,
 {
 	struct nlattr *tb[QCA_VENDOR_ATTR_BTC_CHAIN_MODE_MAX + 1];
 	uint32_t mode;
+	enum coex_btc_chain_mode chain_mode;
 	bool restart;
 
 	if (wlan_cfg80211_nla_parse(tb, QCA_VENDOR_ATTR_BTC_CHAIN_MODE_MAX,
@@ -121,15 +139,24 @@ int wlan_cfg80211_coex_set_btc_chain_mode(struct wlan_objmgr_vdev *vdev,
 	}
 
 	mode = nla_get_u32(tb[QCA_VENDOR_ATTR_BTC_CHAIN_MODE]);
-	if (mode < QCA_BTC_CHAIN_SHARED || mode > QCA_BTC_CHAIN_SEPARATED) {
+	if (mode > QCA_BTC_CHAIN_SEPARATED_FDD) {
 		coex_err("Invalid btc chain mode %d", mode);
 		return -EINVAL;
 	}
 
 	restart = nla_get_flag(tb[QCA_VENDOR_ATTR_BTC_CHAIN_MODE_RESTART]);
 
+	/* map to internal mode definitions */
+	chain_mode = __wlan_cfg80211_coex_map_btc_chain_mode(mode);
+	if (chain_mode == WLAN_COEX_BTC_CHAIN_MODE_UNSETTLED) {
+		coex_err("Invalid wlan btc chain mode %d", chain_mode);
+		return -EINVAL;
+	}
+
 	coex_debug("vdev_id %u mode %u restart %u",
-		   wlan_vdev_get_id(vdev), mode, restart);
+		   wlan_vdev_get_id(vdev), chain_mode, restart);
 
-	return __wlan_cfg80211_coex_set_btc_chain_mode(vdev, mode, restart);
+	return __wlan_cfg80211_coex_set_btc_chain_mode(vdev,
+						       chain_mode,
+						       restart);
 }