浏览代码

qcacmn: Regulatory add 4.9 channel support

Add 4.9 channel support. Populate 4.9 channel to
channel list

Change-Id: I5a8f990fd28cba027b5200cb3dd8dc1949a7db7c
CRs-Fixed: 2105631
Kai Chen 7 年之前
父节点
当前提交
7df3f4f74b

+ 2 - 0
umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h

@@ -604,6 +604,8 @@ struct wlan_lmac_if_reg_rx_ops {
 			enum dfs_reg *dfs_reg);
 	QDF_STATUS (*reg_ch_avoid_event_handler)(struct wlan_objmgr_psoc *psoc,
 			struct ch_avoid_ind_type *ch_avoid_ind);
+	uint32_t (*reg_freq_to_chan)(struct wlan_objmgr_pdev *pdev,
+			uint32_t freq);
 };
 
 #ifdef CONVERGED_P2P_ENABLE

+ 3 - 0
umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c

@@ -211,6 +211,9 @@ static void wlan_lmac_if_umac_reg_rx_ops_register(
 
 	rx_ops->reg_rx_ops.reg_ch_avoid_event_handler =
 		tgt_reg_process_ch_avoid_event;
+
+	rx_ops->reg_rx_ops.reg_freq_to_chan =
+		wlan_reg_freq_to_chan;
 }
 
 #ifdef CONVERGED_P2P_ENABLE

+ 17 - 5
umac/regulatory/core/src/reg_services.c

@@ -1750,7 +1750,7 @@ static void reg_populate_band_channels(enum channel_enum start_chan,
 				       enum channel_enum end_chan,
 				       struct cur_reg_rule *rule_start_ptr,
 				       uint32_t num_reg_rules,
-				       uint16_t min_bw,
+				       uint16_t min_reg_bw,
 				       struct regulatory_channel *mas_chan_list)
 {
 	struct cur_reg_rule *found_rule_ptr;
@@ -1759,19 +1759,23 @@ static void reg_populate_band_channels(enum channel_enum start_chan,
 	enum channel_enum chan_enum;
 	uint32_t rule_num, bw;
 	uint16_t max_bw;
+	uint16_t min_bw;
 
 	for (chan_enum = start_chan; chan_enum <= end_chan; chan_enum++) {
 		found_rule_ptr = NULL;
 
 		max_bw = QDF_MIN((uint16_t)20, channel_map[chan_enum].max_bw);
-		min_bw = QDF_MAX(min_bw, channel_map[chan_enum].min_bw);
+		min_bw = QDF_MAX(min_reg_bw, channel_map[chan_enum].min_bw);
 
-		for (bw = max_bw; ((bw >= min_bw) && (NULL == found_rule_ptr));
-		     bw = bw/2) {
+		if (channel_map[chan_enum].chan_num == INVALID_CHANNEL_NUM)
+			continue;
+
+		for (bw = max_bw; bw >= min_bw; bw = bw/2) {
 			for (rule_num = 0, cur_rule_ptr =
 				     rule_start_ptr;
 			     rule_num < num_reg_rules;
 			     cur_rule_ptr++, rule_num++) {
+
 				if ((cur_rule_ptr->start_freq <=
 				     mas_chan_list[chan_enum].center_freq -
 				     bw/2) &&
@@ -1782,11 +1786,13 @@ static void reg_populate_band_channels(enum channel_enum start_chan,
 					break;
 				}
 			}
-			break;
+			if (found_rule_ptr)
+				break;
 		}
 
 		if (found_rule_ptr) {
 			mas_chan_list[chan_enum].max_bw = bw;
+
 			reg_fill_channel_info(chan_enum, found_rule_ptr,
 					      mas_chan_list, min_bw);
 		}
@@ -2610,6 +2616,12 @@ QDF_STATUS reg_process_master_chan_list(struct cur_regulatory_info
 					   reg_rule_5g, num_5g_reg_rules,
 					   min_bw_5g, mas_chan_list);
 
+	if (num_5g_reg_rules != 0)
+		reg_populate_band_channels(MIN_49GHZ_CHANNEL,
+					MAX_49GHZ_CHANNEL,
+					reg_rule_5g, num_5g_reg_rules,
+					min_bw_5g, mas_chan_list);
+
 	soc_reg->cc_src = SOURCE_DRIVER;
 	if (soc_reg->new_user_ctry_pending == true) {
 		soc_reg->new_user_ctry_pending = false;

+ 9 - 0
umac/regulatory/core/src/reg_services.h

@@ -47,6 +47,15 @@
 	((chan_num >= REG_MIN_24GHZ_CH_NUM) &&	\
 	 (chan_num <= REG_MAX_24GHZ_CH_NUM))
 
+#ifndef CONFIG_LEGACY_CHAN_ENUM
+#define REG_MIN_49GHZ_CH_FREQ channel_map[MIN_49GHZ_CHANNEL].center_freq
+#define REG_MAX_49GHZ_CH_FREQ channel_map[MAX_49GHZ_CHANNEL].center_freq
+
+#define REG_IS_49GHZ_FREQ(freq) \
+	((freq >= REG_MIN_49GHZ_CH_FREQ) &&   \
+	(freq <= REG_MAX_49GHZ_CH_FREQ))
+#endif
+
 #define REG_IS_5GHZ_CH(chan_num) \
 	((chan_num >= REG_MIN_5GHZ_CH_NUM) &&	\
 	 (chan_num <= REG_MAX_5GHZ_CH_NUM))

+ 8 - 0
umac/regulatory/dispatcher/inc/reg_services_public_struct.h

@@ -170,6 +170,10 @@ enum channel_enum {
 	MAX_24GHZ_CHANNEL = CHAN_ENUM_14,
 	NUM_24GHZ_CHANNELS = (MAX_24GHZ_CHANNEL - MIN_24GHZ_CHANNEL + 1),
 
+	MIN_49GHZ_CHANNEL = INVALID_CHANNEL_NUM,
+	MAX_49GHZ_CHANNEL = INVALID_CHANNEL_NUM - 1,
+	NUM_49GHZ_CHANNELS = MAX_49GHZ_CHANNEL - MIN_49GHZ_CHANNEL + 1,
+
 	MIN_5GHZ_CHANNEL = CHAN_ENUM_36,
 	MAX_5GHZ_CHANNEL = CHAN_ENUM_184,
 	NUM_5GHZ_CHANNELS = (MAX_5GHZ_CHANNEL - MIN_5GHZ_CHANNEL + 1),
@@ -389,6 +393,10 @@ enum channel_enum {
 	MAX_24GHZ_CHANNEL = CHAN_ENUM_2484,
 	NUM_24GHZ_CHANNELS = (MAX_24GHZ_CHANNEL - MIN_24GHZ_CHANNEL + 1),
 
+	MIN_49GHZ_CHANNEL = CHAN_ENUM_4912,
+	MAX_49GHZ_CHANNEL = CHAN_ENUM_5080,
+	NUM_49GHZ_CHANNELS = (MAX_49GHZ_CHANNEL - MIN_49GHZ_CHANNEL + 1),
+
 	MIN_5GHZ_CHANNEL = CHAN_ENUM_5180,
 	MAX_5GHZ_CHANNEL = CHAN_ENUM_5920,
 	NUM_5GHZ_CHANNELS = (MAX_5GHZ_CHANNEL - MIN_5GHZ_CHANNEL + 1),

+ 4 - 0
umac/regulatory/dispatcher/inc/wlan_reg_services_api.h

@@ -41,6 +41,10 @@
 #define WLAN_REG_IS_5GHZ_CH(chan) REG_IS_5GHZ_CH(chan)
 #define WLAN_REG_IS_11P_CH(chan) REG_IS_11P_CH(chan)
 
+#ifndef CONFIG_LEGACY_CHAN_ENUM
+#define WLAN_REG_IS_49GHZ_FREQ(freq) REG_IS_49GHZ_FREQ(freq)
+#endif
+
 #define WLAN_REG_CH_NUM(ch_enum) REG_CH_NUM(ch_enum)
 #define WLAN_REG_CH_TO_FREQ(ch_enum) REG_CH_TO_FREQ(ch_enum)