diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h
index 70a45437452e..6c5ae768487b 100644
--- a/core/hdd/inc/wlan_hdd_cfg.h
+++ b/core/hdd/inc/wlan_hdd_cfg.h
@@ -5311,7 +5311,7 @@ enum hdd_link_speed_rpt_type {
*/
#define CFG_VHT_ENABLE_1x1_TX_CHAINMASK "gSetTxChainmask1x1"
-#define CFG_VHT_ENABLE_1x1_TX_CHAINMASK_MIN (1)
+#define CFG_VHT_ENABLE_1x1_TX_CHAINMASK_MIN (0)
#define CFG_VHT_ENABLE_1x1_TX_CHAINMASK_MAX (2)
#define CFG_VHT_ENABLE_1x1_TX_CHAINMASK_DEFAULT (1)
@@ -5339,7 +5339,7 @@ enum hdd_link_speed_rpt_type {
*/
#define CFG_VHT_ENABLE_1x1_RX_CHAINMASK "gSetRxChainmask1x1"
-#define CFG_VHT_ENABLE_1x1_RX_CHAINMASK_MIN (1)
+#define CFG_VHT_ENABLE_1x1_RX_CHAINMASK_MIN (0)
#define CFG_VHT_ENABLE_1x1_RX_CHAINMASK_MAX (2)
#define CFG_VHT_ENABLE_1x1_RX_CHAINMASK_DEFAULT (1)
@@ -13781,6 +13781,129 @@ enum hdd_external_acs_freq_band {
#define CFG_ENABLE_ESP_FEATURE_MAX (1)
#define CFG_ENABLE_ESP_FEATURE_DEFAULT (0)
+/*
+ *
+ * tx_chain_mask_2g - tx chain mask for 2g
+ * @Min: 0
+ * @Max: 3
+ * @Default: 0
+ *
+ * This ini will set tx chain mask for 2g. To use the ini, make sure:
+ * gSetTxChainmask1x1/gSetRxChainmask1x1 = 0,
+ * gDualMacFeatureDisable = 1
+ * gEnable2x2 = 0
+ *
+ * tx_chain_mask_2g=0 : don't care
+ * tx_chain_mask_2g=1 : for 2g tx use chain 0
+ * tx_chain_mask_2g=2 : for 2g tx use chain 1
+ * tx_chain_mask_2g=3 : for 2g tx can use either chain
+ *
+ * Related: None
+ *
+ * Supported Feature: All profiles
+ *
+ * Usage: External
+ *
+ *
+ */
+#define CFG_TX_CHAIN_MASK_2G_NAME "tx_chain_mask_2g"
+#define CFG_TX_CHAIN_MASK_2G_MIN (0)
+#define CFG_TX_CHAIN_MASK_2G_MAX (3)
+#define CFG_TX_CHAIN_MASK_2G_DEFAULT (0)
+
+
+/*
+ *
+ * tx_chain_mask_5g - tx chain mask for 5g
+ * @Min: 0
+ * @Max: 3
+ * @Default: 0
+ *
+ * This ini will set tx chain mask for 5g. To use the ini, make sure:
+ * gSetTxChainmask1x1/gSetRxChainmask1x1 = 0,
+ * gDualMacFeatureDisable = 1
+ * gEnable2x2 = 0
+ *
+ * tx_chain_mask_5g=0 : don't care
+ * tx_chain_mask_5g=1 : for 5g tx use chain 0
+ * tx_chain_mask_5g=2 : for 5g tx use chain 1
+ * tx_chain_mask_5g=3 : for 5g tx can use either chain
+ *
+ * Related: None
+ *
+ * Supported Feature: All profiles
+ *
+ * Usage: External
+ *
+ *
+ */
+#define CFG_TX_CHAIN_MASK_5G_NAME "tx_chain_mask_5g"
+#define CFG_TX_CHAIN_MASK_5G_MIN (0)
+#define CFG_TX_CHAIN_MASK_5G_MAX (3)
+#define CFG_TX_CHAIN_MASK_5G_DEFAULT (0)
+
+
+/*
+ *
+ * rx_chain_mask_2g - rx chain mask for 2g
+ * @Min: 0
+ * @Max: 3
+ * @Default: 0
+ *
+ * This ini will set rx chain mask for 2g. To use the ini, make sure:
+ * gSetTxChainmask1x1/gSetRxChainmask1x1 = 0,
+ * gDualMacFeatureDisable = 1
+ * gEnable2x2 = 0
+ *
+ * rx_chain_mask_2g=0 : don't care
+ * rx_chain_mask_2g=1 : for 2g rx use chain 0
+ * rx_chain_mask_2g=2 : for 2g rx use chain 1
+ * rx_chain_mask_2g=3 : for 2g rx can use either chain
+ *
+ * Related: None
+ *
+ * Supported Feature: All profiles
+ *
+ * Usage: External
+ *
+ *
+ */
+#define CFG_RX_CHAIN_MASK_2G_NAME "rx_chain_mask_2g"
+#define CFG_RX_CHAIN_MASK_2G_MIN (0)
+#define CFG_RX_CHAIN_MASK_2G_MAX (3)
+#define CFG_RX_CHAIN_MASK_2G_DEFAULT (0)
+
+
+/*
+ *
+ * rx_chain_mask_5g - rx chain mask for 5g
+ * @Min: 0
+ * @Max: 3
+ * @Default: 0
+ *
+ * This ini will set rx chain mask for 5g. To use the ini, make sure:
+ * gSetTxChainmask1x1/gSetRxChainmask1x1 = 0,
+ * gDualMacFeatureDisable = 1
+ * gEnable2x2 = 0
+ *
+ * rx_chain_mask_5g=0 : don't care
+ * rx_chain_mask_5g=1 : for 5g rx use chain 0
+ * rx_chain_mask_5g=2 : for 5g rx use chain 1
+ * rx_chain_mask_5g=3 : for 5g rx can use either chain
+ *
+ * Related: None
+ *
+ * Supported Feature: All profiles
+ *
+ * Usage: External
+ *
+ *
+ */
+#define CFG_RX_CHAIN_MASK_5G_NAME "rx_chain_mask_5g"
+#define CFG_RX_CHAIN_MASK_5G_MIN (0)
+#define CFG_RX_CHAIN_MASK_5G_MAX (3)
+#define CFG_RX_CHAIN_MASK_5G_DEFAULT (0)
+
/*
* Type declarations
*/
@@ -14667,6 +14790,10 @@ struct hdd_config {
bool probe_req_deferral_enabled;
bool fils_discovery_sap_enabled;
bool esp_for_roam_enabled;
+ uint8_t tx_chain_mask_2g;
+ uint8_t rx_chain_mask_2g;
+ uint8_t tx_chain_mask_5g;
+ uint8_t rx_chain_mask_5g;
};
#define VAR_OFFSET(_Struct, _Var) (offsetof(_Struct, _Var))
diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h
index 2c6f858a4843..81e785243334 100644
--- a/core/hdd/inc/wlan_hdd_main.h
+++ b/core/hdd/inc/wlan_hdd_main.h
@@ -1707,6 +1707,7 @@ struct hdd_context {
qdf_atomic_t disable_lro_in_low_tput;
bool en_tcp_delack_no_lro;
qdf_wake_lock_t monitor_mode_wakelock;
+ bool lte_coex_ant_share;
};
/**
diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c
index 52b6c67d8bbb..285bedf7e96c 100644
--- a/core/hdd/src/wlan_hdd_cfg.c
+++ b/core/hdd/src/wlan_hdd_cfg.c
@@ -5361,6 +5361,33 @@ struct reg_table_entry g_registry_table[] = {
CFG_ENABLE_ESP_FEATURE_MIN,
CFG_ENABLE_ESP_FEATURE_MAX),
+ REG_VARIABLE(CFG_TX_CHAIN_MASK_2G_NAME, WLAN_PARAM_Integer,
+ struct hdd_config, tx_chain_mask_2g,
+ VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+ CFG_TX_CHAIN_MASK_2G_DEFAULT,
+ CFG_TX_CHAIN_MASK_2G_MIN,
+ CFG_TX_CHAIN_MASK_2G_MAX),
+
+ REG_VARIABLE(CFG_RX_CHAIN_MASK_2G_NAME, WLAN_PARAM_Integer,
+ struct hdd_config, rx_chain_mask_2g,
+ VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+ CFG_RX_CHAIN_MASK_2G_DEFAULT,
+ CFG_RX_CHAIN_MASK_2G_MIN,
+ CFG_RX_CHAIN_MASK_2G_MAX),
+
+ REG_VARIABLE(CFG_TX_CHAIN_MASK_5G_NAME, WLAN_PARAM_Integer,
+ struct hdd_config, tx_chain_mask_5g,
+ VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+ CFG_TX_CHAIN_MASK_5G_DEFAULT,
+ CFG_TX_CHAIN_MASK_5G_MIN,
+ CFG_TX_CHAIN_MASK_5G_MAX),
+
+ REG_VARIABLE(CFG_RX_CHAIN_MASK_5G_NAME, WLAN_PARAM_Integer,
+ struct hdd_config, rx_chain_mask_5g,
+ VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+ CFG_RX_CHAIN_MASK_5G_DEFAULT,
+ CFG_RX_CHAIN_MASK_5G_MIN,
+ CFG_RX_CHAIN_MASK_5G_MAX),
};
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index 6e48000993c8..4a0fd662d2ad 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -1831,6 +1831,7 @@ void hdd_update_tgt_cfg(void *context, void *param)
/* Configure NAN datapath features */
hdd_nan_datapath_target_config(hdd_ctx, cfg);
hdd_ctx->dfs_cac_offload = cfg->dfs_cac_offload;
+ hdd_ctx->lte_coex_ant_share = cfg->services.lte_coex_ant_share;
}
bool hdd_dfs_indicate_radar(struct hdd_context *hdd_ctx)
@@ -3881,6 +3882,107 @@ static void hdd_set_fw_log_params(struct hdd_context *hdd_ctx,
#endif
+/**
+ * hdd_configure_chain_mask() - programs chain mask to firmware
+ * @adapter: HDD adapter
+ *
+ * Return: 0 on success or errno on failure
+ */
+static int hdd_configure_chain_mask(struct hdd_adapter *adapter)
+{
+ int ret_val;
+ struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+
+ hdd_debug("enable2x2: %d, lte_coex: %d, ChainMask1x1: tx: %d rx: %d",
+ hdd_ctx->config->enable2x2, hdd_ctx->lte_coex_ant_share,
+ hdd_ctx->config->txchainmask1x1,
+ hdd_ctx->config->rxchainmask1x1);
+ hdd_debug("disable_DBS: %d, tx_chain_mask_2g: %d, rx_chain_mask_2g: %d",
+ hdd_ctx->config->dual_mac_feature_disable,
+ hdd_ctx->config->tx_chain_mask_2g,
+ hdd_ctx->config->rx_chain_mask_2g);
+ hdd_debug("tx_chain_mask_5g: %d, rx_chain_mask_5g: %d",
+ hdd_ctx->config->tx_chain_mask_5g,
+ hdd_ctx->config->rx_chain_mask_5g);
+
+ if (hdd_ctx->config->enable2x2) {
+ hdd_info("2x2 enabled. skip chain mask programming");
+ return 0;
+ }
+
+ if (hdd_ctx->config->txchainmask1x1) {
+ ret_val = sme_cli_set_command(adapter->session_id,
+ WMI_PDEV_PARAM_TX_CHAIN_MASK,
+ hdd_ctx->config->txchainmask1x1,
+ PDEV_CMD);
+ if (ret_val)
+ goto error;
+ }
+
+ if (hdd_ctx->config->rxchainmask1x1) {
+ ret_val = sme_cli_set_command(adapter->session_id,
+ WMI_PDEV_PARAM_RX_CHAIN_MASK,
+ hdd_ctx->config->rxchainmask1x1,
+ PDEV_CMD);
+ if (ret_val)
+ goto error;
+ }
+
+ if (hdd_ctx->lte_coex_ant_share) {
+ hdd_info("lte ant sharing enabled. skip per band chain mask");
+ return 0;
+ }
+
+ if (hdd_ctx->config->txchainmask1x1 ||
+ hdd_ctx->config->rxchainmask1x1) {
+ hdd_info("band agnostic tx/rx chain mask set. skip per band chain mask");
+ return 0;
+ }
+
+ if (!hdd_ctx->config->dual_mac_feature_disable) {
+ hdd_info("DBS enabled. skip per band chain mask");
+ return 0;
+ }
+
+ if (hdd_ctx->config->tx_chain_mask_2g) {
+ ret_val = sme_cli_set_command(adapter->session_id,
+ WMI_PDEV_PARAM_TX_CHAIN_MASK_2G,
+ hdd_ctx->config->tx_chain_mask_2g, PDEV_CMD);
+ if (0 != ret_val)
+ goto error;
+ }
+
+ if (hdd_ctx->config->rx_chain_mask_2g) {
+ ret_val = sme_cli_set_command(adapter->session_id,
+ WMI_PDEV_PARAM_RX_CHAIN_MASK_2G,
+ hdd_ctx->config->rx_chain_mask_2g, PDEV_CMD);
+ if (0 != ret_val)
+ goto error;
+ }
+
+ if (hdd_ctx->config->tx_chain_mask_5g) {
+ ret_val = sme_cli_set_command(adapter->session_id,
+ WMI_PDEV_PARAM_TX_CHAIN_MASK_5G,
+ hdd_ctx->config->tx_chain_mask_5g, PDEV_CMD);
+ if (0 != ret_val)
+ goto error;
+ }
+
+ if (hdd_ctx->config->rx_chain_mask_5g) {
+ ret_val = sme_cli_set_command(adapter->session_id,
+ WMI_PDEV_PARAM_RX_CHAIN_MASK_5G,
+ hdd_ctx->config->rx_chain_mask_5g, PDEV_CMD);
+ if (0 != ret_val)
+ goto error;
+ }
+
+ return 0;
+
+error:
+ hdd_err("WMI PDEV set param failed %d", ret_val);
+ return -EINVAL;
+}
+
/**
* hdd_set_fw_params() - Set parameters to firmware
* @adapter: HDD adapter
@@ -3961,27 +4063,11 @@ int hdd_set_fw_params(struct hdd_adapter *adapter)
goto error;
}
- ret = sme_cli_set_command(adapter->session_id,
- WMI_PDEV_PARAM_TX_CHAIN_MASK,
- hdd_ctx->config->txchainmask1x1,
- PDEV_CMD);
- if (ret) {
- hdd_err("WMI_PDEV_PARAM_TX_CHAIN_MASK set failed %d",
- ret);
- goto error;
- }
-
- ret = sme_cli_set_command(adapter->session_id,
- WMI_PDEV_PARAM_RX_CHAIN_MASK,
- hdd_ctx->config->rxchainmask1x1,
- PDEV_CMD);
- if (ret) {
- hdd_err("WMI_PDEV_PARAM_RX_CHAIN_MASK set failed %d",
- ret);
- goto error;
- }
#undef HDD_DTIM_1CHAIN_RX_ID
#undef HDD_SMPS_PARAM_VALUE_S
+
+ if (hdd_configure_chain_mask(adapter))
+ goto error;
}
ret = sme_cli_set_command(adapter->session_id,