Prechádzať zdrojové kódy

qcacmn: Fix 4.9GHz issue for legacy devices

In the scan channel list, host sends both 2.4GHz and 4.9GHz channels to FW
because there are ieee channels which have same value in 2.4 GHz and 5GHz
bands.  Example: channel 1 is 2.412 in 2.4GHz and 4.942 in 5 GHz.
When converting a channel to freq, the host uses low/high 2GHz and 5GHz
frequency ranges. For a partial-offload 5GHz pdev, both low/high 2.4 GHz
and 5 GHz frequencies are set and hence 4.9 GHz channel is converted to
2.4GHz frequency.

To fix the above issue, based on the wireless modes remove either low/high
2.4 GHz or low/high 5 GHz frequency based on the wireless modes.

Change-Id: I1fb0a56c70d1dc0ffc2731da3f25c910af46bb41
CRs-Fixed: 2239771
Shashikala Prabhu 6 rokov pred
rodič
commit
d50f3a6b05

+ 7 - 0
target_if/init_deinit/src/init_cmd_api.c

@@ -32,6 +32,7 @@
 #include <init_cmd_api.h>
 #include <wlan_defs.h>
 #include <target_if_scan.h>
+#include <target_if_reg.h>
 
 /**
  *  init_deinit_alloc_host_mem_chunk() - allocates chunk of memory requested
@@ -462,6 +463,12 @@ void init_deinit_prepare_send_init_cmd(
 
 		init_deinit_derive_band_to_mac_param(psoc, tgt_hdl,
 						     init_param.band_to_mac);
+	} else {
+		ret_val = tgt_if_regulatory_modify_freq_range(psoc);
+		if (QDF_IS_STATUS_ERROR(ret_val)) {
+			target_if_err("Modify freq range is failed");
+			return;
+		}
 	}
 
 	ret_val = target_if_alloc_pdevs(psoc, tgt_hdl);

+ 5 - 0
target_if/regulatory/inc/target_if_reg.h

@@ -41,4 +41,9 @@ QDF_STATUS target_if_register_regulatory_tx_ops(struct wlan_lmac_if_tx_ops
  */
 QDF_STATUS target_if_reg_set_offloaded_info(struct wlan_objmgr_psoc *psoc);
 
+/**
+ * tgt_if_regulatory_modify_freq_range() - Modify low and high freq ranges based
+ * on wireless mode.
+ */
+QDF_STATUS tgt_if_regulatory_modify_freq_range(struct wlan_objmgr_psoc *psoc);
 #endif /* __TARGET_IF_REG_H__ */

+ 32 - 0
target_if/regulatory/src/target_if_reg.c

@@ -29,6 +29,7 @@
 #include <target_if.h>
 #include <target_if_reg.h>
 #include <wmi_unified_reg_api.h>
+#include <wlan_reg_ucfg_api.h>
 
 static inline uint32_t get_chan_list_cc_event_id(void)
 {
@@ -334,6 +335,37 @@ static QDF_STATUS tgt_if_regulatory_stop_11d_scan(
 						  reg_stop_11d_scan_req);
 }
 
+QDF_STATUS tgt_if_regulatory_modify_freq_range(struct wlan_objmgr_psoc *psoc)
+{
+	struct wlan_psoc_host_hal_reg_capabilities_ext *reg_cap;
+
+	reg_cap = ucfg_reg_get_hal_reg_cap(psoc);
+	if (!reg_cap) {
+		target_if_err("reg cap is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	if (!(reg_cap->wireless_modes & WMI_HOST_REGDMN_MODE_11A)) {
+		reg_cap->low_5ghz_chan = 0;
+		reg_cap->high_5ghz_chan = 0;
+	}
+
+	if (!(reg_cap->wireless_modes &
+	     (WMI_HOST_REGDMN_MODE_11B | WMI_HOST_REGDMN_MODE_PUREG))) {
+		reg_cap->low_2ghz_chan = 0;
+		reg_cap->high_2ghz_chan = 0;
+	}
+
+	target_if_info(
+			"phy_id = %d - low_2ghz_chan = %d high_2ghz_chan = %d low_5ghz_chan = %d high_5ghz_chan = %d",
+			reg_cap->phy_id,
+			reg_cap->low_2ghz_chan,
+			reg_cap->high_2ghz_chan,
+			reg_cap->low_5ghz_chan,
+			reg_cap->high_5ghz_chan);
+
+	return QDF_STATUS_SUCCESS;
+}
 
 QDF_STATUS target_if_register_regulatory_tx_ops(struct wlan_lmac_if_tx_ops
 						*tx_ops)