Jelajahi Sumber

qcacld-3.0: Add ini to set init chain mode for BTC

Add ini to set init chain mode for BTC, default value should
be set to the same as macro WLAN_COEX_BTC_CHAIN_MODE_UNSETTLED
that means no need to send init chain mode for BTC to firmware
in wma_vdev_pre_start() process.

Change-Id: I3051a7f8a0c708c7df40d1b95b46e0bfa6892f6c
CRs-Fixed: 2837173
hqu 4 tahun lalu
induk
melakukan
4b3b2782e7

+ 47 - 0
components/coex/dispatcher/src/wlan_coex_utils_api.c

@@ -24,6 +24,7 @@
 #include <wlan_coex_main.h>
 #include <wlan_objmgr_global_obj.h>
 #include <wlan_coex_utils_api.h>
+#include "cfg_ucfg_api.h"
 
 QDF_STATUS wlan_coex_init(void)
 {
@@ -75,9 +76,55 @@ QDF_STATUS wlan_coex_deinit(void)
 	return status;
 }
 
+#ifdef FEATURE_BTC_CHAIN_MODE
+/**
+ * wlan_coex_set_btc_chain_mode_with_ini() - set BTC init chain mode
+ * with ini
+ * @psoc: pointer to psoc object
+ *
+ * This function is used to set BTC init chain mode with ini
+ *
+ * Return: None
+ */
+static void
+wlan_coex_set_btc_chain_mode_with_ini(struct wlan_objmgr_psoc *psoc)
+{
+	uint8_t btc_chain_mode;
+	QDF_STATUS status;
+
+	status = wlan_coex_psoc_get_btc_chain_mode(psoc, &btc_chain_mode);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		coex_err("error for getting btc chain mode");
+		return;
+	}
+
+	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 &&
+		    btc_chain_mode != WLAN_COEX_BTC_CHAIN_MODE_UNSETTLED) {
+			coex_err("invalid ini config %d for btc chain mode",
+				 btc_chain_mode);
+			return;
+		}
+
+		status = wlan_coex_psoc_set_btc_chain_mode(psoc,
+							   btc_chain_mode);
+		if (QDF_IS_STATUS_ERROR(status))
+			coex_err("error for setting btc init chain mode from ini");
+	}
+}
+#else
+static void
+wlan_coex_set_btc_chain_mode_with_ini(struct wlan_objmgr_psoc *psoc)
+{
+}
+#endif
+
 QDF_STATUS
 wlan_coex_psoc_open(struct wlan_objmgr_psoc *psoc)
 {
+	wlan_coex_set_btc_chain_mode_with_ini(psoc);
 	return wlan_coex_psoc_init(psoc);
 }
 

+ 38 - 2
components/fw_offload/dispatcher/inc/cfg_coex.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012 - 2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012 - 2020 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
@@ -313,6 +313,41 @@
 #define THREE_WAY_COEX_CONFIG_LEGACY_CFG
 #endif
 
+#ifdef FEATURE_BTC_CHAIN_MODE
+/*
+ * <ini>
+ * gSetInitChainModeForBTC - Used to set init chain mode for BTC
+ * @Min: 0
+ * @Max: 0xFF
+ * @Default: 0xFF
+ *
+ * This ini is used to set init chain mode for BTC, default value
+ * should be set to the same as macro WLAN_COEX_BTC_CHAIN_MODE_UNSETTLED(0xFF),
+ * 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.
+ * 0xFF - no need to send init chain mode for BTC to firmware.
+ *
+ * Supported Feature: init chain mode for BTC
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SET_INIT_CHAIN_MODE_FOR_BTC CFG_INI_UINT( \
+		"gSetInitChainModeForBTC", \
+		0, \
+		0xFF, \
+		0xFF, \
+		CFG_VALUE_OR_DEFAULT, \
+		"Init Chain Mode For BTC")
+
+#define SET_INIT_CHAIN_MODE_FOR_BTC_CFG CFG(CFG_SET_INIT_CHAIN_MODE_FOR_BTC)
+#else
+#define SET_INIT_CHAIN_MODE_FOR_BTC_CFG
+#endif
+
 #define CFG_COEX_ALL \
 	CFG(CFG_BTC_MODE) \
 	CFG(CFG_ANTENNA_ISOLATION) \
@@ -327,5 +362,6 @@
 	CFG(CFG_BT_INTERFERENCE_HIGH_UL) \
 	COEX_MPTA_HELPER_CFG \
 	CFG(CFG_BT_SCO_ALLOW_WLAN_2G_SCAN) \
-	THREE_WAY_COEX_CONFIG_LEGACY_CFG
+	THREE_WAY_COEX_CONFIG_LEGACY_CFG \
+	SET_INIT_CHAIN_MODE_FOR_BTC_CFG
 #endif