Browse Source

qcacld-3.0: Fix check for firmware's chainmask capability

Fix condition checked before programming user's requested chainmask to
firwmare. Get current firmware advertised phy cap for non-dbs phymode
and check if it supports all chains for tx/rx 2g and 5g.

Change-Id: I3fcef315f478403955ce400b3ba6d138a8006a01
CRs-Fixed: 2202544
Naveen Rawat 7 years ago
parent
commit
9832247b07
3 changed files with 31 additions and 0 deletions
  1. 18 0
      core/hdd/src/wlan_hdd_main.c
  2. 8 0
      core/wma/inc/wma_api.h
  3. 5 0
      core/wma/src/wma_main.c

+ 18 - 0
core/hdd/src/wlan_hdd_main.c

@@ -4238,6 +4238,8 @@ static void hdd_set_fw_log_params(struct hdd_context *hdd_ctx,
 static int hdd_configure_chain_mask(struct hdd_adapter *adapter)
 {
 	int ret_val;
+	QDF_STATUS status;
+	struct wma_caps_per_phy non_dbs_phy_cap;
 	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 
 	hdd_debug("enable2x2: %d, lte_coex: %d, ChainMask1x1: tx: %d rx: %d",
@@ -4254,6 +4256,22 @@ static int hdd_configure_chain_mask(struct hdd_adapter *adapter)
 	hdd_debug("enable_bt_chain_separation %d",
 		  hdd_ctx->config->enable_bt_chain_separation);
 
+	status = wma_get_caps_for_phyidx_hwmode(&non_dbs_phy_cap,
+						HW_MODE_DBS_NONE,
+						CDS_BAND_ALL);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		hdd_err("couldn't get phy caps. skip chain mask programming");
+		return qdf_status_to_os_return(status);
+	}
+
+	if (non_dbs_phy_cap.tx_chain_mask_2G < 3 ||
+	    non_dbs_phy_cap.rx_chain_mask_2G < 3 ||
+	    non_dbs_phy_cap.tx_chain_mask_5G < 3 ||
+	    non_dbs_phy_cap.rx_chain_mask_5G < 3) {
+		hdd_info("firmware not capable. skip chain mask programming");
+		return 0;
+	}
+
 	if (hdd_ctx->config->enable2x2 &&
 	    !hdd_ctx->config->enable_bt_chain_separation) {
 		hdd_info("2x2 enabled. skip chain mask programming");

+ 8 - 0
core/wma/inc/wma_api.h

@@ -75,6 +75,10 @@ enum GEN_PARAM {
  * @vht_5g: entire VHT cap for 5G band in terms of 32 bit flag
  * @he_2g: entire HE cap for 2G band in terms of 32 bit flag
  * @he_5g: entire HE cap for 5G band in terms of 32 bit flag
+ * @tx_chain_mask_2G: tx chain mask for 2g
+ * @rx_chain_mask_2G: rx chain mask for 2g
+ * @tx_chain_mask_5G: tx chain mask for 5g
+ * @rx_chain_mask_5G: rx chain mask for 5g
  */
 struct wma_caps_per_phy {
 	uint32_t ht_2g;
@@ -83,6 +87,10 @@ struct wma_caps_per_phy {
 	uint32_t vht_5g;
 	uint32_t he_2g;
 	uint32_t he_5g;
+	uint32_t tx_chain_mask_2G;
+	uint32_t rx_chain_mask_2G;
+	uint32_t tx_chain_mask_5G;
+	uint32_t rx_chain_mask_5G;
 };
 
 

+ 5 - 0
core/wma/src/wma_main.c

@@ -5897,6 +5897,11 @@ QDF_STATUS wma_get_caps_for_phyidx_hwmode(struct wma_caps_per_phy *caps_per_phy,
 	caps_per_phy->he_2g = mac_phy_cap[phyid].he_cap_info_2G;
 	caps_per_phy->he_5g = mac_phy_cap[phyid].he_cap_info_5G;
 
+	caps_per_phy->tx_chain_mask_2G = mac_phy_cap->tx_chain_mask_2G;
+	caps_per_phy->rx_chain_mask_2G = mac_phy_cap->rx_chain_mask_2G;
+	caps_per_phy->tx_chain_mask_5G = mac_phy_cap->tx_chain_mask_5G;
+	caps_per_phy->rx_chain_mask_5G = mac_phy_cap->rx_chain_mask_5G;
+
 	return QDF_STATUS_SUCCESS;
 }