1 /*
2  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  *
6  * Permission to use, copy, modify, and/or distribute this software for
7  * any purpose with or without fee is hereby granted, provided that the
8  * above copyright notice and this permission notice appear in all
9  * copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
12  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
13  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
14  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
15  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
16  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
17  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18  * PERFORMANCE OF THIS SOFTWARE.
19  */
20 
21 /**
22  * DOC: wlan_reg_services_api.c
23  *      contains regulatory service functions
24  */
25 
26 #include <qdf_status.h>
27 #include <qdf_types.h>
28 #include <qdf_module.h>
29 #include <wlan_cmn.h>
30 #include <reg_services_public_struct.h>
31 #include <wlan_reg_services_api.h>
32 #include <wlan_objmgr_psoc_obj.h>
33 #include <wlan_objmgr_pdev_obj.h>
34 #include "../../core/src/reg_priv_objs.h"
35 #include "../../core/src/reg_utils.h"
36 #include "../../core/src/reg_services_common.h"
37 #include "../../core/src/reg_db.h"
38 #include "../../core/src/reg_db_parser.h"
39 #include <../../core/src/reg_build_chan_list.h>
40 #include <../../core/src/reg_opclass.h>
41 #include <../../core/src/reg_callbacks.h>
42 #include <../../core/src/reg_offload_11d_scan.h>
43 #include <wlan_objmgr_global_obj.h>
44 
wlan_reg_read_default_country(struct wlan_objmgr_psoc * psoc,uint8_t * country)45 QDF_STATUS wlan_reg_read_default_country(struct wlan_objmgr_psoc *psoc,
46 					 uint8_t *country)
47 {
48 	/*
49 	 * Get the default country information
50 	 */
51 	return reg_read_default_country(psoc, country);
52 }
53 
wlan_get_next_lower_bandwidth(enum phy_ch_width ch_width)54 enum phy_ch_width wlan_get_next_lower_bandwidth(enum phy_ch_width ch_width)
55 {
56 	return get_next_lower_bandwidth(ch_width);
57 }
58 
wlan_reg_read_current_country(struct wlan_objmgr_psoc * psoc,uint8_t * country)59 QDF_STATUS wlan_reg_read_current_country(struct wlan_objmgr_psoc *psoc,
60 					 uint8_t *country)
61 {
62 	/*
63 	 * Get the current country information
64 	 */
65 	return reg_read_current_country(psoc, country);
66 }
67 
wlan_reg_get_max_5g_bw_from_country_code(struct wlan_objmgr_pdev * pdev,uint16_t cc,uint16_t * max_bw_5g)68 QDF_STATUS wlan_reg_get_max_5g_bw_from_country_code(
69 					struct wlan_objmgr_pdev *pdev,
70 					uint16_t cc,
71 					uint16_t *max_bw_5g)
72 {
73 	/*
74 	 * Get the max 5G bandwidth from country code
75 	 */
76 	return reg_get_max_5g_bw_from_country_code(pdev, cc, max_bw_5g);
77 }
78 
wlan_reg_get_max_5g_bw_from_regdomain(struct wlan_objmgr_pdev * pdev,uint16_t regdmn,uint16_t * max_bw_5g)79 QDF_STATUS wlan_reg_get_max_5g_bw_from_regdomain(
80 					struct wlan_objmgr_pdev *pdev,
81 					uint16_t regdmn,
82 					uint16_t *max_bw_5g)
83 {
84 	/*
85 	 * Get the max 5G bandwidth from regdomain pair value
86 	 */
87 	return reg_get_max_5g_bw_from_regdomain(pdev, regdmn, max_bw_5g);
88 }
89 
wlan_reg_get_max_bw_5G_for_fo(struct wlan_objmgr_pdev * pdev)90 QDF_STATUS wlan_reg_get_max_bw_5G_for_fo(struct wlan_objmgr_pdev *pdev)
91 {
92 	return reg_get_max_bw_5G_for_fo(pdev);
93 }
94 
wlan_reg_is_regdb_offloaded(struct wlan_objmgr_psoc * psoc)95 bool wlan_reg_is_regdb_offloaded(struct wlan_objmgr_psoc *psoc)
96 {
97 	return reg_is_regdb_offloaded(psoc);
98 }
99 
wlan_reg_get_pwrmode_chan_list(struct wlan_objmgr_pdev * pdev,struct regulatory_channel * chan_list,enum supported_6g_pwr_types in_6g_pwr_mode)100 QDF_STATUS wlan_reg_get_pwrmode_chan_list(struct wlan_objmgr_pdev *pdev,
101 					  struct regulatory_channel *chan_list,
102 					  enum supported_6g_pwr_types
103 					  in_6g_pwr_mode)
104 {
105 	return reg_get_pwrmode_chan_list(pdev, chan_list, in_6g_pwr_mode);
106 }
107 
108 qdf_export_symbol(wlan_reg_get_pwrmode_chan_list);
109 
110 #ifdef CONFIG_REG_CLIENT
111 QDF_STATUS
wlan_reg_get_best_6g_power_type(struct wlan_objmgr_psoc * psoc,struct wlan_objmgr_pdev * pdev,enum reg_6g_ap_type * pwr_type_6g,enum reg_6g_ap_type ap_pwr_type,uint32_t chan_freq)112 wlan_reg_get_best_6g_power_type(struct wlan_objmgr_psoc *psoc,
113 				struct wlan_objmgr_pdev *pdev,
114 				enum reg_6g_ap_type *pwr_type_6g,
115 				enum reg_6g_ap_type ap_pwr_type,
116 				uint32_t chan_freq)
117 {
118 	return reg_get_best_6g_power_type(psoc, pdev, pwr_type_6g,
119 					  ap_pwr_type, chan_freq);
120 }
121 #endif
122 
wlan_reg_get_dfs_region(struct wlan_objmgr_pdev * pdev,enum dfs_reg * dfs_reg)123 QDF_STATUS wlan_reg_get_dfs_region(struct wlan_objmgr_pdev *pdev,
124 			     enum dfs_reg *dfs_reg)
125 {
126 	/*
127 	 * Get the current dfs region
128 	 */
129 	reg_get_current_dfs_region(pdev, dfs_reg);
130 
131 	return QDF_STATUS_SUCCESS;
132 }
133 
wlan_reg_is_chan_disabled_and_not_nol(struct regulatory_channel * chan)134 bool wlan_reg_is_chan_disabled_and_not_nol(struct regulatory_channel *chan)
135 {
136 	return reg_is_chan_disabled_and_not_nol(chan);
137 }
138 
wlan_reg_get_current_chan_list(struct wlan_objmgr_pdev * pdev,struct regulatory_channel * chan_list)139 QDF_STATUS wlan_reg_get_current_chan_list(struct wlan_objmgr_pdev *pdev,
140 		struct regulatory_channel *chan_list)
141 {
142 	return reg_get_current_chan_list(pdev, chan_list);
143 }
144 
145 qdf_export_symbol(wlan_reg_get_current_chan_list);
146 
wlan_reg_is_freq_enabled(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq,enum supported_6g_pwr_types in_6g_pwr_mode)147 bool wlan_reg_is_freq_enabled(struct wlan_objmgr_pdev *pdev,
148 			      qdf_freq_t freq,
149 			      enum supported_6g_pwr_types in_6g_pwr_mode)
150 {
151 	return reg_is_freq_enabled(pdev, freq, in_6g_pwr_mode);
152 }
153 
wlan_reg_is_freq_idx_enabled(struct wlan_objmgr_pdev * pdev,enum channel_enum freq_idx,enum supported_6g_pwr_types in_6g_pwr_mode)154 bool wlan_reg_is_freq_idx_enabled(struct wlan_objmgr_pdev *pdev,
155 				  enum channel_enum freq_idx,
156 				  enum supported_6g_pwr_types in_6g_pwr_mode)
157 {
158 	return reg_is_freq_idx_enabled(pdev, freq_idx, in_6g_pwr_mode);
159 }
160 
161 #ifdef CONFIG_REG_CLIENT
wlan_reg_get_secondary_current_chan_list(struct wlan_objmgr_pdev * pdev,struct regulatory_channel * chan_list)162 QDF_STATUS wlan_reg_get_secondary_current_chan_list(
163 					struct wlan_objmgr_pdev *pdev,
164 					struct regulatory_channel *chan_list)
165 {
166 	return reg_get_secondary_current_chan_list(pdev, chan_list);
167 }
168 #endif
169 
170 #if defined(CONFIG_AFC_SUPPORT) && defined(CONFIG_BAND_6GHZ)
wlan_reg_get_6g_afc_chan_list(struct wlan_objmgr_pdev * pdev,struct regulatory_channel * chan_list)171 QDF_STATUS wlan_reg_get_6g_afc_chan_list(struct wlan_objmgr_pdev *pdev,
172 					 struct regulatory_channel *chan_list)
173 {
174 	return reg_get_6g_afc_chan_list(pdev, chan_list);
175 }
176 
177 qdf_export_symbol(wlan_reg_get_6g_afc_chan_list);
178 
179 QDF_STATUS
wlan_reg_get_6g_afc_mas_chan_list(struct wlan_objmgr_pdev * pdev,struct regulatory_channel * chan_list)180 wlan_reg_get_6g_afc_mas_chan_list(struct wlan_objmgr_pdev *pdev,
181 				  struct regulatory_channel *chan_list)
182 {
183 	return reg_get_6g_afc_mas_chan_list(pdev, chan_list);
184 }
185 
186 qdf_export_symbol(wlan_reg_get_6g_afc_mas_chan_list);
187 #endif
188 
wlan_reg_get_bw_value(enum phy_ch_width bw)189 uint16_t wlan_reg_get_bw_value(enum phy_ch_width bw)
190 {
191 	return reg_get_bw_value(bw);
192 }
193 
194 qdf_export_symbol(wlan_reg_get_bw_value);
195 
wlan_reg_set_dfs_region(struct wlan_objmgr_pdev * pdev,enum dfs_reg dfs_reg)196 void wlan_reg_set_dfs_region(struct wlan_objmgr_pdev *pdev,
197 			     enum dfs_reg dfs_reg)
198 {
199 	reg_set_dfs_region(pdev, dfs_reg);
200 }
201 
wlan_reg_get_domain_from_country_code(v_REGDOMAIN_t * reg_domain_ptr,const uint8_t * country_alpha2,enum country_src source)202 QDF_STATUS wlan_reg_get_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr,
203 		const uint8_t *country_alpha2, enum country_src source)
204 {
205 
206 	return reg_get_domain_from_country_code(reg_domain_ptr,
207 			country_alpha2, source);
208 }
209 
210 
wlan_reg_dmn_get_opclass_from_channel(uint8_t * country,uint8_t channel,uint8_t offset)211 uint16_t wlan_reg_dmn_get_opclass_from_channel(uint8_t *country,
212 					       uint8_t channel,
213 					       uint8_t offset)
214 {
215 	return reg_dmn_get_opclass_from_channel(country, channel,
216 						offset);
217 }
218 
wlan_reg_get_band_cap_from_op_class(const uint8_t * country,uint8_t num_of_opclass,const uint8_t * opclass)219 uint8_t wlan_reg_get_band_cap_from_op_class(const uint8_t *country,
220 					    uint8_t num_of_opclass,
221 					    const uint8_t *opclass)
222 {
223 	return reg_get_band_cap_from_op_class(country,
224 					      num_of_opclass, opclass);
225 }
226 
wlan_reg_get_opclass_from_freq_width(uint8_t * country,qdf_freq_t freq,uint16_t ch_width,uint16_t behav_limit)227 uint8_t wlan_reg_get_opclass_from_freq_width(uint8_t *country,
228 					     qdf_freq_t freq,
229 					     uint16_t ch_width,
230 					     uint16_t behav_limit)
231 {
232 	return reg_dmn_get_opclass_from_freq_width(country, freq, ch_width,
233 						   behav_limit);
234 }
235 
wlan_reg_dmn_print_channels_in_opclass(uint8_t * country,uint8_t opclass)236 void wlan_reg_dmn_print_channels_in_opclass(uint8_t *country,
237 					    uint8_t opclass)
238 {
239 	reg_dmn_print_channels_in_opclass(country, opclass);
240 }
241 
wlan_reg_dmn_get_chanwidth_from_opclass(uint8_t * country,uint8_t channel,uint8_t opclass)242 uint16_t wlan_reg_dmn_get_chanwidth_from_opclass(uint8_t *country,
243 						 uint8_t channel,
244 						 uint8_t opclass)
245 {
246 	return reg_dmn_get_chanwidth_from_opclass(country, channel,
247 						  opclass);
248 }
249 
wlan_reg_dmn_get_chanwidth_from_opclass_auto(uint8_t * country,uint8_t channel,uint8_t opclass)250 uint16_t wlan_reg_dmn_get_chanwidth_from_opclass_auto(uint8_t *country,
251 						      uint8_t channel,
252 						      uint8_t opclass)
253 {
254 	return reg_dmn_get_chanwidth_from_opclass_auto(country, channel,
255 						       opclass);
256 }
257 
wlan_reg_dmn_set_curr_opclasses(uint8_t num_classes,uint8_t * class)258 uint16_t wlan_reg_dmn_set_curr_opclasses(uint8_t num_classes,
259 					 uint8_t *class)
260 {
261 	return reg_dmn_set_curr_opclasses(num_classes, class);
262 }
263 
wlan_reg_dmn_get_curr_opclasses(uint8_t * num_classes,uint8_t * class)264 uint16_t wlan_reg_dmn_get_curr_opclasses(uint8_t *num_classes,
265 					 uint8_t *class)
266 {
267 	return reg_dmn_get_curr_opclasses(num_classes, class);
268 }
269 
270 QDF_STATUS
wlan_reg_get_opclass_details(struct wlan_objmgr_pdev * pdev,struct regdmn_ap_cap_opclass_t * reg_ap_cap,uint8_t * n_opclasses,uint8_t max_supp_op_class,bool global_tbl_lookup,enum supported_6g_pwr_types in_6g_pwr_mode)271 wlan_reg_get_opclass_details(struct wlan_objmgr_pdev *pdev,
272 			     struct regdmn_ap_cap_opclass_t *reg_ap_cap,
273 			     uint8_t *n_opclasses,
274 			     uint8_t max_supp_op_class,
275 			     bool global_tbl_lookup,
276 			     enum supported_6g_pwr_types in_6g_pwr_mode)
277 {
278 	return reg_get_opclass_details(pdev, reg_ap_cap, n_opclasses,
279 				       max_supp_op_class,
280 				       global_tbl_lookup,
281 				       in_6g_pwr_mode);
282 }
283 
284 QDF_STATUS
wlan_reg_get_opclass_for_cur_hwmode(struct wlan_objmgr_pdev * pdev,struct regdmn_ap_cap_opclass_t * reg_ap_cap,uint8_t * n_opclasses,uint8_t max_supp_op_class,bool global_tbl_lookup,enum phy_ch_width max_chwidth,bool is_80p80_supp,enum supported_6g_pwr_types in_6g_pwr_mode)285 wlan_reg_get_opclass_for_cur_hwmode(struct wlan_objmgr_pdev *pdev,
286 				    struct regdmn_ap_cap_opclass_t *reg_ap_cap,
287 				    uint8_t *n_opclasses,
288 				    uint8_t max_supp_op_class,
289 				    bool global_tbl_lookup,
290 				    enum phy_ch_width max_chwidth,
291 				    bool is_80p80_supp,
292 				    enum supported_6g_pwr_types in_6g_pwr_mode)
293 {
294 	return reg_get_opclass_for_cur_hwmode(pdev, reg_ap_cap, n_opclasses,
295 					      max_supp_op_class,
296 					      global_tbl_lookup,
297 					      max_chwidth,
298 					      is_80p80_supp,
299 					      in_6g_pwr_mode);
300 }
301 
wlan_reg_get_cc_and_src(struct wlan_objmgr_psoc * psoc,uint8_t * alpha)302 enum country_src wlan_reg_get_cc_and_src(struct wlan_objmgr_psoc *psoc,
303 					 uint8_t *alpha)
304 {
305 	return reg_get_cc_and_src(psoc, alpha);
306 }
307 
wlan_regulatory_init(void)308 QDF_STATUS wlan_regulatory_init(void)
309 {
310 	QDF_STATUS status;
311 
312 	status = wlan_objmgr_register_psoc_create_handler(
313 		WLAN_UMAC_COMP_REGULATORY,
314 		wlan_regulatory_psoc_obj_created_notification, NULL);
315 	if (status != QDF_STATUS_SUCCESS) {
316 		reg_err("failed to register reg psoc obj create handler");
317 		return status;
318 	}
319 
320 	status = wlan_objmgr_register_psoc_destroy_handler(
321 		WLAN_UMAC_COMP_REGULATORY,
322 		wlan_regulatory_psoc_obj_destroyed_notification, NULL);
323 	if (status != QDF_STATUS_SUCCESS) {
324 		reg_err("failed to register reg psoc obj create handler");
325 		goto unreg_psoc_create;
326 	}
327 
328 	status = wlan_objmgr_register_pdev_create_handler(
329 		WLAN_UMAC_COMP_REGULATORY,
330 		wlan_regulatory_pdev_obj_created_notification, NULL);
331 	if (status != QDF_STATUS_SUCCESS) {
332 		reg_err("failed to register reg psoc obj create handler");
333 		goto unreg_psoc_destroy;
334 	}
335 
336 	status = wlan_objmgr_register_pdev_destroy_handler(
337 		WLAN_UMAC_COMP_REGULATORY,
338 		wlan_regulatory_pdev_obj_destroyed_notification, NULL);
339 	if (status != QDF_STATUS_SUCCESS) {
340 		reg_err("failed to register reg psoc obj create handler");
341 		goto unreg_pdev_create;
342 	}
343 	channel_map = channel_map_global;
344 	reg_debug("regulatory handlers registered with obj mgr");
345 
346 	return status;
347 
348 unreg_pdev_create:
349 	status = wlan_objmgr_unregister_pdev_create_handler(
350 		WLAN_UMAC_COMP_REGULATORY,
351 		wlan_regulatory_pdev_obj_created_notification,
352 		NULL);
353 
354 unreg_psoc_destroy:
355 	status = wlan_objmgr_unregister_psoc_destroy_handler(
356 		WLAN_UMAC_COMP_REGULATORY,
357 		wlan_regulatory_psoc_obj_destroyed_notification,
358 		NULL);
359 
360 unreg_psoc_create:
361 	status = wlan_objmgr_unregister_psoc_create_handler(
362 		WLAN_UMAC_COMP_REGULATORY,
363 		wlan_regulatory_psoc_obj_created_notification,
364 		NULL);
365 
366 	return QDF_STATUS_E_FAILURE;
367 }
368 
wlan_regulatory_deinit(void)369 QDF_STATUS wlan_regulatory_deinit(void)
370 {
371 	QDF_STATUS status, ret_status = QDF_STATUS_SUCCESS;
372 
373 	status = wlan_objmgr_unregister_pdev_destroy_handler(
374 		WLAN_UMAC_COMP_REGULATORY,
375 		wlan_regulatory_pdev_obj_destroyed_notification, NULL);
376 	if (status != QDF_STATUS_SUCCESS) {
377 		reg_err("failed to unregister reg pdev obj destroy handler");
378 		ret_status = status;
379 	}
380 
381 	status = wlan_objmgr_unregister_pdev_create_handler(
382 		WLAN_UMAC_COMP_REGULATORY,
383 		wlan_regulatory_pdev_obj_created_notification, NULL);
384 	if (status != QDF_STATUS_SUCCESS) {
385 		reg_err("failed to unregister reg pdev obj create handler");
386 		ret_status = status;
387 	}
388 
389 	status = wlan_objmgr_unregister_psoc_destroy_handler(
390 		WLAN_UMAC_COMP_REGULATORY,
391 		wlan_regulatory_psoc_obj_destroyed_notification, NULL);
392 	if (status != QDF_STATUS_SUCCESS) {
393 		reg_err("failed to unregister reg psoc obj destroy handler");
394 		ret_status = status;
395 	}
396 
397 	status = wlan_objmgr_unregister_psoc_create_handler(
398 			WLAN_UMAC_COMP_REGULATORY,
399 			wlan_regulatory_psoc_obj_created_notification, NULL);
400 	if (status != QDF_STATUS_SUCCESS) {
401 		reg_err("failed to unregister reg psoc obj create handler");
402 		ret_status = status;
403 	}
404 
405 	reg_debug("deregistered callbacks with obj mgr");
406 
407 	return ret_status;
408 }
409 
410 #ifdef CONFIG_BAND_6GHZ
411 static void
regulatory_assign_register_master_ext_handler(struct wlan_objmgr_psoc * psoc,struct wlan_lmac_if_reg_tx_ops * tx_ops)412 regulatory_assign_register_master_ext_handler(struct wlan_objmgr_psoc *psoc,
413 					struct wlan_lmac_if_reg_tx_ops *tx_ops)
414 {
415 	if (tx_ops->register_master_ext_handler)
416 		tx_ops->register_master_ext_handler(psoc, NULL);
417 }
418 
419 static void
regulatory_assign_unregister_master_ext_handler(struct wlan_objmgr_psoc * psoc,struct wlan_lmac_if_reg_tx_ops * tx_ops)420 regulatory_assign_unregister_master_ext_handler(struct wlan_objmgr_psoc *psoc,
421 					struct wlan_lmac_if_reg_tx_ops *tx_ops)
422 {
423 	if (tx_ops->unregister_master_ext_handler)
424 		tx_ops->unregister_master_ext_handler(psoc, NULL);
425 }
426 
wlan_reg_get_6g_ap_master_chan_list(struct wlan_objmgr_pdev * pdev,enum reg_6g_ap_type ap_pwr_type,struct regulatory_channel * chan_list)427 QDF_STATUS wlan_reg_get_6g_ap_master_chan_list(
428 					struct wlan_objmgr_pdev *pdev,
429 					enum reg_6g_ap_type ap_pwr_type,
430 					struct regulatory_channel *chan_list)
431 {
432 	return  reg_get_6g_ap_master_chan_list(pdev, ap_pwr_type, chan_list);
433 }
434 
435 #ifdef CONFIG_REG_CLIENT
wlan_reg_get_power_string(enum reg_6g_ap_type power_type)436 const char *wlan_reg_get_power_string(enum reg_6g_ap_type power_type)
437 {
438 	return reg_get_power_string(power_type);
439 }
440 #endif
441 
442 qdf_export_symbol(wlan_reg_get_6g_ap_master_chan_list);
443 
444 #ifdef CONFIG_AFC_SUPPORT
regulatory_assign_register_afc_event_handler(struct wlan_objmgr_psoc * psoc,struct wlan_lmac_if_reg_tx_ops * tx_ops)445 static void regulatory_assign_register_afc_event_handler(
446 		struct wlan_objmgr_psoc *psoc,
447 		struct wlan_lmac_if_reg_tx_ops *tx_ops)
448 {
449 	if (tx_ops->register_afc_event_handler)
450 		tx_ops->register_afc_event_handler(psoc, NULL);
451 }
452 
regulatory_assign_unregister_afc_event_handler(struct wlan_objmgr_psoc * psoc,struct wlan_lmac_if_reg_tx_ops * tx_ops)453 static void regulatory_assign_unregister_afc_event_handler(
454 		struct wlan_objmgr_psoc *psoc,
455 		struct wlan_lmac_if_reg_tx_ops *tx_ops)
456 {
457 	if (tx_ops->unregister_afc_event_handler)
458 		tx_ops->unregister_afc_event_handler(psoc, NULL);
459 }
460 #else
regulatory_assign_register_afc_event_handler(struct wlan_objmgr_psoc * psoc,struct wlan_lmac_if_reg_tx_ops * tx_ops)461 static void regulatory_assign_register_afc_event_handler(
462 		struct wlan_objmgr_psoc *psoc,
463 		struct wlan_lmac_if_reg_tx_ops *tx_ops)
464 {
465 }
466 
regulatory_assign_unregister_afc_event_handler(struct wlan_objmgr_psoc * psoc,struct wlan_lmac_if_reg_tx_ops * tx_ops)467 static void regulatory_assign_unregister_afc_event_handler(
468 		struct wlan_objmgr_psoc *psoc,
469 		struct wlan_lmac_if_reg_tx_ops *tx_ops)
470 {
471 }
472 #endif
473 #else
474 static inline void
regulatory_assign_register_master_ext_handler(struct wlan_objmgr_psoc * psoc,struct wlan_lmac_if_reg_tx_ops * tx_ops)475 regulatory_assign_register_master_ext_handler(struct wlan_objmgr_psoc *psoc,
476 					      struct wlan_lmac_if_reg_tx_ops *tx_ops)
477 {
478 }
479 
480 static inline void
regulatory_assign_unregister_master_ext_handler(struct wlan_objmgr_psoc * psoc,struct wlan_lmac_if_reg_tx_ops * tx_ops)481 regulatory_assign_unregister_master_ext_handler(struct wlan_objmgr_psoc *psoc,
482 						struct wlan_lmac_if_reg_tx_ops *tx_ops)
483 {
484 }
485 
486 static void
regulatory_assign_register_afc_event_handler(struct wlan_objmgr_psoc * psoc,struct wlan_lmac_if_reg_tx_ops * tx_ops)487 regulatory_assign_register_afc_event_handler(struct wlan_objmgr_psoc *psoc,
488 					     struct wlan_lmac_if_reg_tx_ops *tx_ops)
489 {
490 }
491 
492 static void
regulatory_assign_unregister_afc_event_handler(struct wlan_objmgr_psoc * psoc,struct wlan_lmac_if_reg_tx_ops * tx_ops)493 regulatory_assign_unregister_afc_event_handler(struct wlan_objmgr_psoc *psoc,
494 					       struct wlan_lmac_if_reg_tx_ops *tx_ops)
495 {
496 }
497 #endif
498 
regulatory_psoc_open(struct wlan_objmgr_psoc * psoc)499 QDF_STATUS regulatory_psoc_open(struct wlan_objmgr_psoc *psoc)
500 {
501 	struct wlan_lmac_if_reg_tx_ops *tx_ops;
502 
503 	tx_ops = reg_get_psoc_tx_ops(psoc);
504 	if (tx_ops->register_master_handler)
505 		tx_ops->register_master_handler(psoc, NULL);
506 	regulatory_assign_register_master_ext_handler(psoc, tx_ops);
507 	regulatory_assign_register_afc_event_handler(psoc, tx_ops);
508 	if (tx_ops->register_11d_new_cc_handler)
509 		tx_ops->register_11d_new_cc_handler(psoc, NULL);
510 	if (tx_ops->register_ch_avoid_event_handler)
511 		tx_ops->register_ch_avoid_event_handler(psoc, NULL);
512 	if (tx_ops->register_rate2power_table_update_event_handler)
513 		tx_ops->register_rate2power_table_update_event_handler(psoc,
514 								       NULL);
515 
516 	return QDF_STATUS_SUCCESS;
517 }
518 
regulatory_psoc_close(struct wlan_objmgr_psoc * psoc)519 QDF_STATUS regulatory_psoc_close(struct wlan_objmgr_psoc *psoc)
520 {
521 	struct wlan_lmac_if_reg_tx_ops *tx_ops;
522 
523 	tx_ops = reg_get_psoc_tx_ops(psoc);
524 	if (tx_ops->unregister_11d_new_cc_handler)
525 		tx_ops->unregister_11d_new_cc_handler(psoc, NULL);
526 	if (tx_ops->unregister_master_handler)
527 		tx_ops->unregister_master_handler(psoc, NULL);
528 	regulatory_assign_unregister_master_ext_handler(psoc, tx_ops);
529 	regulatory_assign_unregister_afc_event_handler(psoc, tx_ops);
530 	if (tx_ops->unregister_ch_avoid_event_handler)
531 		tx_ops->unregister_ch_avoid_event_handler(psoc, NULL);
532 	if (tx_ops->unregister_rate2power_table_update_event_handler)
533 		tx_ops->unregister_rate2power_table_update_event_handler(psoc,
534 									 NULL);
535 
536 	return QDF_STATUS_SUCCESS;
537 }
538 
539 #ifdef CONFIG_REG_CLIENT
540 /**
541  * reg_is_cntry_set_pending() - Check if country set is pending
542  * @pdev: Pointer to pdev object.
543  * @psoc: Pointer to psoc object.
544  */
reg_is_cntry_set_pending(struct wlan_objmgr_pdev * pdev,struct wlan_objmgr_psoc * psoc)545 static bool reg_is_cntry_set_pending(struct wlan_objmgr_pdev *pdev,
546 				     struct wlan_objmgr_psoc *psoc)
547 {
548 	struct wlan_regulatory_psoc_priv_obj *soc_reg;
549 	struct wlan_lmac_if_reg_tx_ops *tx_ops;
550 	uint8_t phy_id;
551 
552 	soc_reg = reg_get_psoc_obj(psoc);
553 
554 	if (!IS_VALID_PSOC_REG_OBJ(soc_reg)) {
555 		reg_err("psoc reg component is NULL");
556 		return false;
557 	}
558 
559 	tx_ops = reg_get_psoc_tx_ops(psoc);
560 
561 	if (tx_ops->get_phy_id_from_pdev_id)
562 		tx_ops->get_phy_id_from_pdev_id(
563 					psoc,
564 					wlan_objmgr_pdev_get_pdev_id(pdev),
565 					&phy_id);
566 	else
567 		phy_id = wlan_objmgr_pdev_get_pdev_id(pdev);
568 
569 	return (soc_reg->new_user_ctry_pending[phy_id] ||
570 		soc_reg->new_init_ctry_pending[phy_id] ||
571 		soc_reg->new_11d_ctry_pending[phy_id] ||
572 		soc_reg->world_country_pending[phy_id]);
573 }
574 #else
reg_is_cntry_set_pending(struct wlan_objmgr_pdev * pdev,struct wlan_objmgr_psoc * psoc)575 static inline bool reg_is_cntry_set_pending(struct wlan_objmgr_pdev *pdev,
576 					    struct wlan_objmgr_psoc *psoc)
577 {
578 	return false;
579 }
580 #endif
581 
regulatory_pdev_open(struct wlan_objmgr_pdev * pdev)582 QDF_STATUS regulatory_pdev_open(struct wlan_objmgr_pdev *pdev)
583 {
584 	struct wlan_objmgr_psoc *parent_psoc;
585 	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
586 
587 	pdev_priv_obj = reg_get_pdev_obj(pdev);
588 
589 	if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
590 		reg_err("reg pdev private obj is NULL");
591 		return QDF_STATUS_E_FAILURE;
592 	}
593 
594 	pdev_priv_obj->pdev_opened = true;
595 
596 	parent_psoc = wlan_pdev_get_psoc(pdev);
597 
598 	if (reg_is_cntry_set_pending(pdev, parent_psoc))
599 		return QDF_STATUS_SUCCESS;
600 
601 	reg_send_scheduler_msg_nb(parent_psoc, pdev);
602 
603 	return QDF_STATUS_SUCCESS;
604 }
605 
regulatory_pdev_close(struct wlan_objmgr_pdev * pdev)606 QDF_STATUS regulatory_pdev_close(struct wlan_objmgr_pdev *pdev)
607 {
608 	struct wlan_objmgr_psoc *psoc;
609 	struct wlan_regulatory_psoc_priv_obj *soc_reg;
610 	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
611 
612 	pdev_priv_obj = reg_get_pdev_obj(pdev);
613 	if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
614 		reg_err("reg pdev private obj is NULL");
615 		return QDF_STATUS_E_FAILURE;
616 	}
617 
618 	pdev_priv_obj->pdev_opened = false;
619 
620 	psoc = wlan_pdev_get_psoc(pdev);
621 	soc_reg = reg_get_psoc_obj(psoc);
622 	if (!soc_reg) {
623 		reg_err("reg psoc private obj is NULL");
624 		return QDF_STATUS_E_FAULT;
625 	}
626 
627 	reg_reset_ctry_pending_hints(soc_reg);
628 
629 	return QDF_STATUS_SUCCESS;
630 }
631 
wlan_reg_freq_to_chan(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq)632 uint8_t wlan_reg_freq_to_chan(struct wlan_objmgr_pdev *pdev,
633 			      qdf_freq_t freq)
634 {
635 	return reg_freq_to_chan(pdev, freq);
636 }
637 
638 qdf_export_symbol(wlan_reg_freq_to_chan);
639 
wlan_reg_legacy_chan_to_freq(struct wlan_objmgr_pdev * pdev,uint8_t chan_num)640 qdf_freq_t wlan_reg_legacy_chan_to_freq(struct wlan_objmgr_pdev *pdev,
641 					uint8_t chan_num)
642 {
643 	return reg_legacy_chan_to_freq(pdev, chan_num);
644 }
645 
646 qdf_export_symbol(wlan_reg_legacy_chan_to_freq);
647 
wlan_reg_set_country(struct wlan_objmgr_pdev * pdev,uint8_t * country)648 QDF_STATUS wlan_reg_set_country(struct wlan_objmgr_pdev *pdev,
649 				       uint8_t *country)
650 {
651 	return reg_set_country(pdev, country);
652 }
653 
wlan_reg_set_11d_country(struct wlan_objmgr_pdev * pdev,uint8_t * country)654 QDF_STATUS wlan_reg_set_11d_country(struct wlan_objmgr_pdev *pdev,
655 				    uint8_t *country)
656 {
657 	return reg_set_11d_country(pdev, country);
658 }
659 
wlan_reg_is_world(uint8_t * country)660 bool wlan_reg_is_world(uint8_t *country)
661 {
662 	return reg_is_world_alpha2(country);
663 }
664 
wlan_reg_is_us(uint8_t * country)665 bool wlan_reg_is_us(uint8_t *country)
666 {
667 	return reg_is_us_alpha2(country);
668 }
669 
wlan_reg_is_etsi(uint8_t * country)670 bool wlan_reg_is_etsi(uint8_t *country)
671 {
672 	return reg_is_etsi_alpha2(country);
673 }
674 
wlan_reg_ctry_support_vlp(uint8_t * country)675 bool wlan_reg_ctry_support_vlp(uint8_t *country)
676 {
677 	return reg_ctry_support_vlp(country);
678 }
679 
wlan_reg_register_chan_change_callback(struct wlan_objmgr_psoc * psoc,void * cbk,void * arg)680 void wlan_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc,
681 					    void *cbk, void *arg)
682 {
683 	reg_register_chan_change_callback(psoc, (reg_chan_change_callback)cbk,
684 					  arg);
685 
686 }
687 
wlan_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc * psoc,void * cbk)688 void wlan_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc,
689 					      void *cbk)
690 {
691 	reg_unregister_chan_change_callback(psoc,
692 					    (reg_chan_change_callback)cbk);
693 }
694 
wlan_reg_register_ctry_change_callback(struct wlan_objmgr_psoc * psoc,void * cbk)695 void wlan_reg_register_ctry_change_callback(struct wlan_objmgr_psoc *psoc,
696 					    void *cbk)
697 {
698 	reg_register_ctry_change_callback(psoc, (reg_ctry_change_callback)cbk);
699 }
700 
wlan_reg_unregister_ctry_change_callback(struct wlan_objmgr_psoc * psoc,void * cbk)701 void wlan_reg_unregister_ctry_change_callback(struct wlan_objmgr_psoc *psoc,
702 					      void *cbk)
703 {
704 	reg_unregister_ctry_change_callback(psoc,
705 					    (reg_ctry_change_callback)cbk);
706 }
707 
wlan_reg_is_11d_offloaded(struct wlan_objmgr_psoc * psoc)708 bool wlan_reg_is_11d_offloaded(struct wlan_objmgr_psoc *psoc)
709 {
710 	return reg_is_11d_offloaded(psoc);
711 }
712 
wlan_reg_11d_enabled_on_host(struct wlan_objmgr_psoc * psoc)713 bool wlan_reg_11d_enabled_on_host(struct wlan_objmgr_psoc *psoc)
714 {
715 	return reg_11d_enabled_on_host(psoc);
716 }
717 
wlan_reg_is_etsi_regdmn(struct wlan_objmgr_pdev * pdev)718 bool wlan_reg_is_etsi_regdmn(struct wlan_objmgr_pdev *pdev)
719 {
720 	return reg_is_etsi_regdmn(pdev);
721 }
722 
wlan_reg_is_etsi_srd_chan_allowed_master_mode(struct wlan_objmgr_pdev * pdev)723 bool wlan_reg_is_etsi_srd_chan_allowed_master_mode(struct wlan_objmgr_pdev
724 						     *pdev)
725 {
726 	return reg_is_etsi_srd_chan_allowed_master_mode(pdev);
727 }
728 
wlan_reg_is_6ghz_band_set(struct wlan_objmgr_pdev * pdev)729 bool wlan_reg_is_6ghz_band_set(struct wlan_objmgr_pdev *pdev)
730 {
731 	return reg_is_6ghz_band_set(pdev);
732 }
733 
wlan_reg_get_keep_6ghz_sta_cli_connection(struct wlan_objmgr_pdev * pdev)734 bool wlan_reg_get_keep_6ghz_sta_cli_connection(struct wlan_objmgr_pdev *pdev)
735 {
736 	return reg_get_keep_6ghz_sta_cli_connection(pdev);
737 }
wlan_reg_get_fcc_constraint(struct wlan_objmgr_pdev * pdev,uint32_t freq)738 bool wlan_reg_get_fcc_constraint(struct wlan_objmgr_pdev *pdev, uint32_t freq)
739 {
740 	return reg_get_fcc_constraint(pdev, freq);
741 }
742 
wlan_reg_get_country_max_allowed_bw(struct wlan_objmgr_pdev * pdev)743 uint32_t wlan_reg_get_country_max_allowed_bw(struct wlan_objmgr_pdev *pdev)
744 {
745 	return reg_get_country_max_allowed_bw(pdev);
746 }
747 
wlan_reg_get_chip_mode(struct wlan_objmgr_pdev * pdev,uint64_t * chip_mode)748 QDF_STATUS wlan_reg_get_chip_mode(struct wlan_objmgr_pdev *pdev,
749 		uint64_t *chip_mode)
750 {
751 	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
752 
753 	pdev_priv_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev,
754 			WLAN_UMAC_COMP_REGULATORY);
755 
756 	if (!pdev_priv_obj) {
757 		reg_err("reg pdev private obj is NULL");
758 		return QDF_STATUS_E_FAULT;
759 	}
760 
761 	*chip_mode = pdev_priv_obj->wireless_modes;
762 
763 	return QDF_STATUS_SUCCESS;
764 }
765 
wlan_reg_get_phybitmap(struct wlan_objmgr_pdev * pdev,uint16_t * phybitmap)766 QDF_STATUS wlan_reg_get_phybitmap(struct wlan_objmgr_pdev *pdev,
767 				  uint16_t *phybitmap)
768 {
769 	return reg_get_phybitmap(pdev, phybitmap);
770 }
771 
772 #ifdef WLAN_FEATURE_11BE
wlan_reg_phybitmap_support_11be(struct wlan_objmgr_pdev * pdev)773 bool wlan_reg_phybitmap_support_11be(struct wlan_objmgr_pdev *pdev)
774 {
775 	enum reg_phymode cur_max_phymode;
776 
777 	cur_max_phymode = reg_get_max_phymode(pdev, REG_PHYMODE_MAX - 1, 0);
778 	return (cur_max_phymode == REG_PHYMODE_11BE);
779 }
780 #endif
781 
wlan_reg_is_11d_scan_inprogress(struct wlan_objmgr_psoc * psoc)782 bool wlan_reg_is_11d_scan_inprogress(struct wlan_objmgr_psoc *psoc)
783 {
784 	return reg_is_11d_scan_inprogress(psoc);
785 }
786 
wlan_reg_get_freq_range(struct wlan_objmgr_pdev * pdev,qdf_freq_t * low_2g,qdf_freq_t * high_2g,qdf_freq_t * low_5g,qdf_freq_t * high_5g)787 QDF_STATUS wlan_reg_get_freq_range(struct wlan_objmgr_pdev *pdev,
788 		qdf_freq_t *low_2g,
789 		qdf_freq_t *high_2g,
790 		qdf_freq_t *low_5g,
791 		qdf_freq_t *high_5g)
792 {
793 	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
794 
795 	pdev_priv_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev,
796 			WLAN_UMAC_COMP_REGULATORY);
797 
798 	if (!pdev_priv_obj) {
799 		reg_err("reg pdev private obj is NULL");
800 		return QDF_STATUS_E_FAULT;
801 	}
802 
803 	if (low_2g)
804 		*low_2g = pdev_priv_obj->range_2g_low;
805 
806 	if (high_2g)
807 		*high_2g = pdev_priv_obj->range_2g_high;
808 
809 	if (low_5g)
810 		*low_5g = pdev_priv_obj->range_5g_low;
811 
812 	if (high_5g)
813 		*high_5g = pdev_priv_obj->range_5g_high;
814 
815 	return QDF_STATUS_SUCCESS;
816 }
817 
818 qdf_export_symbol(wlan_reg_get_freq_range);
819 
820 struct wlan_lmac_if_reg_tx_ops *
wlan_reg_get_tx_ops(struct wlan_objmgr_psoc * psoc)821 wlan_reg_get_tx_ops(struct wlan_objmgr_psoc *psoc)
822 {
823 	return reg_get_psoc_tx_ops(psoc);
824 }
825 
826 qdf_export_symbol(wlan_reg_get_tx_ops);
827 
wlan_reg_get_curr_regdomain(struct wlan_objmgr_pdev * pdev,struct cur_regdmn_info * cur_regdmn)828 QDF_STATUS wlan_reg_get_curr_regdomain(struct wlan_objmgr_pdev *pdev,
829 		struct cur_regdmn_info *cur_regdmn)
830 {
831 	return reg_get_curr_regdomain(pdev, cur_regdmn);
832 }
833 
wlan_reg_max_5ghz_ch_num(void)834 uint8_t wlan_reg_max_5ghz_ch_num(void)
835 {
836 	return reg_max_5ghz_ch_num();
837 }
838 
839 #ifdef CONFIG_CHAN_FREQ_API
wlan_reg_min_24ghz_chan_freq(void)840 qdf_freq_t wlan_reg_min_24ghz_chan_freq(void)
841 {
842 	return reg_min_24ghz_chan_freq();
843 }
844 
wlan_reg_max_24ghz_chan_freq(void)845 qdf_freq_t wlan_reg_max_24ghz_chan_freq(void)
846 {
847 	return reg_max_24ghz_chan_freq();
848 }
849 
wlan_reg_min_5ghz_chan_freq(void)850 qdf_freq_t wlan_reg_min_5ghz_chan_freq(void)
851 {
852 	return reg_min_5ghz_chan_freq();
853 }
854 
wlan_reg_max_5ghz_chan_freq(void)855 qdf_freq_t wlan_reg_max_5ghz_chan_freq(void)
856 {
857 	return reg_max_5ghz_chan_freq();
858 }
859 #endif /* CONFIG_CHAN_FREQ_API */
860 
wlan_reg_is_24ghz_ch_freq(qdf_freq_t freq)861 bool wlan_reg_is_24ghz_ch_freq(qdf_freq_t freq)
862 {
863 	return reg_is_24ghz_ch_freq(freq);
864 }
865 
wlan_reg_is_5ghz_ch_freq(qdf_freq_t freq)866 bool wlan_reg_is_5ghz_ch_freq(qdf_freq_t freq)
867 {
868 	return reg_is_5ghz_ch_freq(freq);
869 }
870 
wlan_reg_is_range_overlap_2g(qdf_freq_t low_freq,qdf_freq_t high_freq)871 bool wlan_reg_is_range_overlap_2g(qdf_freq_t low_freq, qdf_freq_t high_freq)
872 {
873 	return reg_is_range_overlap_2g(low_freq, high_freq);
874 }
875 
wlan_reg_is_range_overlap_5g(qdf_freq_t low_freq,qdf_freq_t high_freq)876 bool wlan_reg_is_range_overlap_5g(qdf_freq_t low_freq, qdf_freq_t high_freq)
877 {
878 	return reg_is_range_overlap_5g(low_freq, high_freq);
879 }
880 
wlan_reg_is_freq_indoor(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq)881 bool wlan_reg_is_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
882 {
883 	return reg_is_freq_indoor(pdev, freq);
884 }
885 
wlan_reg_get_min_chwidth(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq)886 uint16_t wlan_reg_get_min_chwidth(struct wlan_objmgr_pdev *pdev,
887 				  qdf_freq_t freq)
888 {
889 	return reg_get_min_chwidth(pdev, freq);
890 }
891 
wlan_reg_get_max_chwidth(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq)892 uint16_t wlan_reg_get_max_chwidth(struct wlan_objmgr_pdev *pdev,
893 				  qdf_freq_t freq)
894 {
895 	return reg_get_max_chwidth(pdev, freq);
896 }
897 
898 enum phy_ch_width
wlan_reg_get_next_lower_bandwidth(enum phy_ch_width ch_width)899 wlan_reg_get_next_lower_bandwidth(enum phy_ch_width ch_width)
900 {
901 	return get_next_lower_bandwidth(ch_width);
902 }
903 
904 enum phy_ch_width
wlan_reg_get_next_higher_bandwidth(enum phy_ch_width ch_width)905 wlan_reg_get_next_higher_bandwidth(enum phy_ch_width ch_width)
906 {
907 	return reg_get_next_higher_bandwidth(ch_width);
908 }
909 
910 #ifdef CONFIG_REG_CLIENT
wlan_reg_is_freq_indoor_in_secondary_list(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq)911 bool wlan_reg_is_freq_indoor_in_secondary_list(struct wlan_objmgr_pdev *pdev,
912 					       qdf_freq_t freq)
913 {
914 	return reg_is_freq_indoor_in_secondary_list(pdev, freq);
915 }
916 #endif
917 
918 #ifdef CONFIG_BAND_6GHZ
wlan_reg_is_6ghz_chan_freq(uint16_t freq)919 bool wlan_reg_is_6ghz_chan_freq(uint16_t freq)
920 {
921 	return reg_is_6ghz_chan_freq(freq);
922 }
923 
924 #ifdef CONFIG_6G_FREQ_OVERLAP
wlan_reg_is_range_only6g(qdf_freq_t low_freq,qdf_freq_t high_freq)925 bool wlan_reg_is_range_only6g(qdf_freq_t low_freq, qdf_freq_t high_freq)
926 {
927 	return reg_is_range_only6g(low_freq, high_freq);
928 }
929 
wlan_reg_is_range_overlap_6g(qdf_freq_t low_freq,qdf_freq_t high_freq)930 bool wlan_reg_is_range_overlap_6g(qdf_freq_t low_freq, qdf_freq_t high_freq)
931 {
932 	return reg_is_range_overlap_6g(low_freq, high_freq);
933 }
934 
935 qdf_export_symbol(wlan_reg_is_range_overlap_6g);
936 #endif
937 
wlan_reg_min_6ghz_chan_freq(void)938 uint16_t wlan_reg_min_6ghz_chan_freq(void)
939 {
940 	return reg_min_6ghz_chan_freq();
941 }
942 
wlan_reg_max_6ghz_chan_freq(void)943 uint16_t wlan_reg_max_6ghz_chan_freq(void)
944 {
945 	return reg_max_6ghz_chan_freq();
946 }
947 
wlan_reg_is_6ghz_psc_chan_freq(uint16_t freq)948 bool wlan_reg_is_6ghz_psc_chan_freq(uint16_t freq)
949 {
950 	return reg_is_6ghz_psc_chan_freq(freq);
951 }
952 
wlan_reg_is_6g_freq_indoor(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq)953 bool wlan_reg_is_6g_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
954 {
955 	return reg_is_6g_freq_indoor(pdev, freq);
956 }
957 
958 QDF_STATUS
wlan_reg_get_max_txpower_for_6g_tpe(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq,uint8_t bw,enum reg_6g_ap_type reg_ap,enum reg_6g_client_type reg_client,bool is_psd,uint8_t * tx_power)959 wlan_reg_get_max_txpower_for_6g_tpe(struct wlan_objmgr_pdev *pdev,
960 				    qdf_freq_t freq, uint8_t bw,
961 				    enum reg_6g_ap_type reg_ap,
962 				    enum reg_6g_client_type reg_client,
963 				    bool is_psd,
964 				    uint8_t *tx_power)
965 {
966 	return reg_get_max_txpower_for_6g_tpe(pdev, freq, bw,
967 					      reg_ap,
968 					      reg_client, is_psd,
969 					      tx_power);
970 }
971 
wlan_reg_is_6ghz_unii5_chan_freq(qdf_freq_t freq)972 bool wlan_reg_is_6ghz_unii5_chan_freq(qdf_freq_t freq)
973 {
974 	return reg_is_6ghz_unii5_chan_freq(freq);
975 }
976 #endif /* CONFIG_BAND_6GHZ */
977 
978 uint16_t
wlan_reg_get_band_channel_list(struct wlan_objmgr_pdev * pdev,uint8_t band_mask,struct regulatory_channel * channel_list)979 wlan_reg_get_band_channel_list(struct wlan_objmgr_pdev *pdev,
980 			       uint8_t band_mask,
981 			       struct regulatory_channel *channel_list)
982 {
983 	if (!pdev) {
984 		reg_err("pdev object is NULL");
985 		return 0;
986 	}
987 
988 	return reg_get_band_channel_list(pdev, band_mask, channel_list);
989 }
990 
991 #ifdef CONFIG_REG_6G_PWRMODE
992 uint16_t
wlan_reg_get_band_channel_list_for_pwrmode(struct wlan_objmgr_pdev * pdev,uint8_t band_mask,struct regulatory_channel * channel_list,enum supported_6g_pwr_types in_6g_pwr_type)993 wlan_reg_get_band_channel_list_for_pwrmode(struct wlan_objmgr_pdev *pdev,
994 					   uint8_t band_mask,
995 					   struct regulatory_channel
996 					   *channel_list,
997 					   enum supported_6g_pwr_types
998 					   in_6g_pwr_type)
999 {
1000 	if (!pdev) {
1001 		reg_err("pdev object is NULL");
1002 		return 0;
1003 	}
1004 
1005 	return reg_get_band_channel_list_for_pwrmode(pdev, band_mask,
1006 						     channel_list,
1007 						     in_6g_pwr_type);
1008 }
1009 #endif
1010 
1011 #ifdef CONFIG_REG_CLIENT
1012 uint16_t
wlan_reg_get_secondary_band_channel_list(struct wlan_objmgr_pdev * pdev,uint8_t band_mask,struct regulatory_channel * channel_list)1013 wlan_reg_get_secondary_band_channel_list(struct wlan_objmgr_pdev *pdev,
1014 					 uint8_t band_mask,
1015 					 struct regulatory_channel
1016 					 *channel_list)
1017 {
1018 	if (!pdev) {
1019 		reg_err("pdev object is NULL");
1020 		return 0;
1021 	}
1022 
1023 	return reg_get_secondary_band_channel_list(pdev, band_mask,
1024 						   channel_list);
1025 }
1026 #endif
1027 
wlan_reg_chan_band_to_freq(struct wlan_objmgr_pdev * pdev,uint8_t chan,uint8_t band_mask)1028 qdf_freq_t wlan_reg_chan_band_to_freq(struct wlan_objmgr_pdev *pdev,
1029 				      uint8_t chan, uint8_t band_mask)
1030 {
1031 	return reg_chan_band_to_freq(pdev, chan, band_mask);
1032 }
1033 
1034 qdf_export_symbol(wlan_reg_chan_band_to_freq);
1035 
1036 #ifdef CONFIG_49GHZ_CHAN
wlan_reg_is_49ghz_freq(qdf_freq_t freq)1037 bool wlan_reg_is_49ghz_freq(qdf_freq_t freq)
1038 {
1039 	return reg_is_49ghz_freq(freq);
1040 }
1041 #endif /* CONFIG_49GHZ_CHAN */
1042 
wlan_reg_ch_num(uint32_t ch_enum)1043 uint8_t wlan_reg_ch_num(uint32_t ch_enum)
1044 {
1045 	return reg_ch_num(ch_enum);
1046 }
1047 
wlan_reg_ch_to_freq(uint32_t ch_enum)1048 qdf_freq_t wlan_reg_ch_to_freq(uint32_t ch_enum)
1049 {
1050 	return reg_ch_to_freq(ch_enum);
1051 }
1052 
1053 #ifdef WLAN_REG_PARTIAL_OFFLOAD
wlan_reg_is_regdmn_en302502_applicable(struct wlan_objmgr_pdev * pdev)1054 bool wlan_reg_is_regdmn_en302502_applicable(struct wlan_objmgr_pdev *pdev)
1055 {
1056 	return reg_is_regdmn_en302502_applicable(pdev);
1057 }
1058 #endif
1059 
wlan_reg_modify_pdev_chan_range(struct wlan_objmgr_pdev * pdev)1060 QDF_STATUS wlan_reg_modify_pdev_chan_range(struct wlan_objmgr_pdev *pdev)
1061 {
1062 	return reg_modify_pdev_chan_range(pdev);
1063 }
1064 
wlan_reg_update_pdev_wireless_modes(struct wlan_objmgr_pdev * pdev,uint64_t wireless_modes)1065 QDF_STATUS wlan_reg_update_pdev_wireless_modes(struct wlan_objmgr_pdev *pdev,
1066 					       uint64_t wireless_modes)
1067 {
1068 	return reg_update_pdev_wireless_modes(pdev, wireless_modes);
1069 }
1070 #ifdef DISABLE_UNII_SHARED_BANDS
wlan_reg_disable_chan_coex(struct wlan_objmgr_pdev * pdev,uint8_t unii_5g_bitmap)1071 QDF_STATUS wlan_reg_disable_chan_coex(struct wlan_objmgr_pdev *pdev,
1072 				      uint8_t unii_5g_bitmap)
1073 {
1074 	return reg_disable_chan_coex(pdev, unii_5g_bitmap);
1075 }
1076 #endif
1077 
1078 #ifdef CONFIG_CHAN_FREQ_API
wlan_reg_is_same_band_freqs(qdf_freq_t freq1,qdf_freq_t freq2)1079 bool wlan_reg_is_same_band_freqs(qdf_freq_t freq1, qdf_freq_t freq2)
1080 {
1081 	return reg_is_same_band_freqs(freq1, freq2);
1082 }
1083 
wlan_reg_get_chan_enum_for_freq(qdf_freq_t freq)1084 enum channel_enum wlan_reg_get_chan_enum_for_freq(qdf_freq_t freq)
1085 {
1086 	return reg_get_chan_enum_for_freq(freq);
1087 }
1088 
1089 QDF_STATUS
wlan_reg_get_min_max_bw_for_chan_index(struct wlan_objmgr_pdev * pdev,enum channel_enum chan_idx,uint16_t * min_bw,uint16_t * max_bw)1090 wlan_reg_get_min_max_bw_for_chan_index(struct wlan_objmgr_pdev *pdev,
1091 				       enum channel_enum chan_idx,
1092 				       uint16_t *min_bw, uint16_t *max_bw)
1093 {
1094 	return reg_get_min_max_bw_on_cur_chan_list(pdev,
1095 						   chan_idx, min_bw, max_bw);
1096 }
1097 
wlan_reg_is_freq_present_in_cur_chan_list(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq)1098 bool wlan_reg_is_freq_present_in_cur_chan_list(struct wlan_objmgr_pdev *pdev,
1099 					       qdf_freq_t freq)
1100 {
1101 	return reg_is_freq_present_in_cur_chan_list(pdev, freq);
1102 }
1103 
wlan_reg_is_etsi_srd_chan_for_freq(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq)1104 bool wlan_reg_is_etsi_srd_chan_for_freq(struct wlan_objmgr_pdev *pdev,
1105 					qdf_freq_t freq)
1106 {
1107 	return reg_is_etsi_srd_chan_for_freq(pdev, freq);
1108 }
1109 
wlan_reg_is_dsrc_freq(qdf_freq_t freq)1110 bool wlan_reg_is_dsrc_freq(qdf_freq_t freq)
1111 {
1112 	return reg_is_dsrc_freq(freq);
1113 }
1114 
wlan_reg_update_nol_ch_for_freq(struct wlan_objmgr_pdev * pdev,uint16_t * chan_freq_list,uint8_t num_ch,bool nol_ch)1115 void wlan_reg_update_nol_ch_for_freq(struct wlan_objmgr_pdev *pdev,
1116 				     uint16_t *chan_freq_list,
1117 				     uint8_t num_ch,
1118 				     bool nol_ch)
1119 {
1120 	reg_update_nol_ch_for_freq(pdev, chan_freq_list, num_ch, nol_ch);
1121 }
1122 
wlan_reg_update_nol_history_ch_for_freq(struct wlan_objmgr_pdev * pdev,uint16_t * ch_list,uint8_t num_ch,bool nol_history_ch)1123 void wlan_reg_update_nol_history_ch_for_freq(struct wlan_objmgr_pdev *pdev,
1124 					     uint16_t *ch_list,
1125 					     uint8_t num_ch,
1126 					     bool nol_history_ch)
1127 {
1128 	reg_update_nol_history_ch_for_freq(pdev,
1129 					   ch_list,
1130 					   num_ch,
1131 					   nol_history_ch);
1132 }
1133 
wlan_reg_is_dfs_for_freq(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq)1134 bool wlan_reg_is_dfs_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
1135 {
1136 	return reg_is_dfs_for_freq(pdev, freq);
1137 }
1138 
wlan_reg_is_passive_or_disable_for_pwrmode(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq,enum supported_6g_pwr_types in_6g_pwr_mode)1139 bool wlan_reg_is_passive_or_disable_for_pwrmode(
1140 				struct wlan_objmgr_pdev *pdev,
1141 				qdf_freq_t freq,
1142 				enum supported_6g_pwr_types in_6g_pwr_mode)
1143 {
1144 	return reg_is_passive_or_disable_for_pwrmode(pdev, freq,
1145 						     in_6g_pwr_mode);
1146 }
1147 
1148 #ifdef CONFIG_REG_6G_PWRMODE
wlan_reg_is_disable_for_pwrmode(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq,enum supported_6g_pwr_types in_6g_pwr_mode)1149 bool wlan_reg_is_disable_for_pwrmode(struct wlan_objmgr_pdev *pdev,
1150 				     qdf_freq_t freq,
1151 				     enum supported_6g_pwr_types in_6g_pwr_mode)
1152 {
1153 	return reg_is_disable_for_pwrmode(pdev, freq, in_6g_pwr_mode);
1154 }
1155 #endif
1156 
1157 #ifdef CONFIG_REG_CLIENT
wlan_reg_is_disable_in_secondary_list_for_freq(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq)1158 bool wlan_reg_is_disable_in_secondary_list_for_freq(
1159 						struct wlan_objmgr_pdev *pdev,
1160 						qdf_freq_t freq)
1161 {
1162 	return reg_is_disable_in_secondary_list_for_freq(pdev, freq);
1163 }
1164 
wlan_reg_is_enable_in_secondary_list_for_freq(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq)1165 bool wlan_reg_is_enable_in_secondary_list_for_freq(
1166 						struct wlan_objmgr_pdev *pdev,
1167 						qdf_freq_t freq)
1168 {
1169 	return reg_is_enable_in_secondary_list_for_freq(pdev, freq);
1170 }
1171 
wlan_reg_is_dfs_in_secondary_list_for_freq(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq)1172 bool wlan_reg_is_dfs_in_secondary_list_for_freq(struct wlan_objmgr_pdev *pdev,
1173 						qdf_freq_t freq)
1174 {
1175 	return reg_is_dfs_in_secondary_list_for_freq(pdev, freq);
1176 }
1177 
1178 QDF_STATUS
wlan_reg_get_chan_pwr_attr_from_secondary_list_for_freq(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq,bool * is_psd,uint16_t * tx_power,uint16_t * psd_eirp,uint32_t * flags)1179 wlan_reg_get_chan_pwr_attr_from_secondary_list_for_freq(
1180 				struct wlan_objmgr_pdev *pdev, qdf_freq_t freq,
1181 				bool *is_psd, uint16_t *tx_power,
1182 				uint16_t *psd_eirp, uint32_t *flags)
1183 {
1184 	return reg_get_channel_power_attr_from_secondary_list_for_freq(
1185 			pdev, freq, is_psd, tx_power, psd_eirp, flags);
1186 }
1187 
1188 QDF_STATUS
wlan_reg_decide_6ghz_power_within_bw_for_freq(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq,enum phy_ch_width bw,bool * is_psd,uint16_t * min_tx_power,int16_t * min_psd_eirp,enum reg_6g_ap_type * power_type,enum supported_6g_pwr_types pwr_mode,uint16_t input_punc_bitmap)1189 wlan_reg_decide_6ghz_power_within_bw_for_freq(struct wlan_objmgr_pdev *pdev,
1190 					      qdf_freq_t freq,
1191 					      enum phy_ch_width bw,
1192 					      bool *is_psd,
1193 					      uint16_t *min_tx_power,
1194 					      int16_t *min_psd_eirp,
1195 					      enum reg_6g_ap_type *power_type,
1196 					      enum supported_6g_pwr_types pwr_mode,
1197 					      uint16_t input_punc_bitmap)
1198 {
1199 	return reg_decide_6ghz_power_within_bw_for_freq(pdev,
1200 							freq,
1201 							bw,
1202 							is_psd,
1203 							min_tx_power,
1204 							min_psd_eirp,
1205 							power_type,
1206 							pwr_mode,
1207 							input_punc_bitmap);
1208 }
1209 #endif
1210 
wlan_reg_is_passive_for_freq(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq)1211 bool wlan_reg_is_passive_for_freq(struct wlan_objmgr_pdev *pdev,
1212 				  qdf_freq_t freq)
1213 {
1214 	return reg_is_passive_for_freq(pdev, freq);
1215 }
1216 
1217 QDF_STATUS
wlan_reg_get_channel_list_with_power_for_freq(struct wlan_objmgr_pdev * pdev,struct channel_power * ch_list,uint8_t * num_chan)1218 wlan_reg_get_channel_list_with_power_for_freq(struct wlan_objmgr_pdev *pdev,
1219 					      struct channel_power *ch_list,
1220 					      uint8_t *num_chan)
1221 {
1222 	return reg_get_channel_list_with_power_for_freq(pdev,
1223 							ch_list,
1224 							num_chan);
1225 }
1226 
1227 bool
wlan_reg_chan_has_dfs_attribute_for_freq(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq)1228 wlan_reg_chan_has_dfs_attribute_for_freq(struct wlan_objmgr_pdev *pdev,
1229 					 qdf_freq_t freq)
1230 {
1231 	return reg_chan_has_dfs_attribute_for_freq(pdev, freq);
1232 }
1233 
1234 enum channel_state
wlan_reg_get_5g_bonded_channel_state_for_pwrmode(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq,struct ch_params * ch_params,enum supported_6g_pwr_types in_6g_pwr_type)1235 wlan_reg_get_5g_bonded_channel_state_for_pwrmode(struct wlan_objmgr_pdev *pdev,
1236 						 qdf_freq_t freq,
1237 						 struct ch_params *ch_params,
1238 						 enum supported_6g_pwr_types
1239 						 in_6g_pwr_type)
1240 {
1241 	enum phy_ch_width bw;
1242 
1243 	if (!ch_params) {
1244 		reg_err_rl("Invalid ch_params");
1245 		return CHANNEL_STATE_INVALID;
1246 	}
1247 	bw = ch_params->ch_width;
1248 
1249 	if (reg_is_ch_width_320(bw)) {
1250 		const struct bonded_channel_freq *bonded_ch_ptr_ptr = NULL;
1251 		uint16_t in_punc_bitmap = reg_fetch_punc_bitmap(ch_params);
1252 
1253 		return reg_get_5g_bonded_channel_for_pwrmode(pdev, freq, bw,
1254 							     &bonded_ch_ptr_ptr,
1255 							     in_6g_pwr_type,
1256 							     in_punc_bitmap);
1257 	}
1258 
1259 	return reg_get_5g_bonded_channel_state_for_pwrmode(pdev, freq,
1260 							   ch_params,
1261 							   in_6g_pwr_type);
1262 }
1263 
1264 qdf_export_symbol(wlan_reg_get_5g_bonded_channel_state_for_pwrmode);
1265 
1266 enum channel_state
wlan_reg_get_2g_bonded_channel_state_for_freq(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq,qdf_freq_t sec_ch_freq,enum phy_ch_width bw)1267 wlan_reg_get_2g_bonded_channel_state_for_freq(struct wlan_objmgr_pdev *pdev,
1268 					      qdf_freq_t freq,
1269 					      qdf_freq_t sec_ch_freq,
1270 					      enum phy_ch_width bw)
1271 {
1272 	return reg_get_2g_bonded_channel_state_for_freq(pdev,
1273 							freq,
1274 							sec_ch_freq,
1275 							bw);
1276 }
1277 
1278 #ifdef CONFIG_REG_6G_PWRMODE
wlan_reg_set_channel_params_for_pwrmode(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq,qdf_freq_t sec_ch_2g_freq,struct ch_params * ch_params,enum supported_6g_pwr_types in_6g_pwr_mode)1279 void wlan_reg_set_channel_params_for_pwrmode(struct wlan_objmgr_pdev *pdev,
1280 					     qdf_freq_t freq,
1281 					     qdf_freq_t sec_ch_2g_freq,
1282 					     struct ch_params *ch_params,
1283 					     enum supported_6g_pwr_types
1284 					     in_6g_pwr_mode)
1285 {
1286 	reg_set_channel_params_for_pwrmode(pdev, freq, sec_ch_2g_freq,
1287 					   ch_params,
1288 					   in_6g_pwr_mode, true);
1289 }
1290 
1291 qdf_export_symbol(wlan_reg_set_channel_params_for_pwrmode);
1292 #endif
1293 
1294 const struct bonded_channel_freq *
wlan_reg_get_bonded_chan_entry(qdf_freq_t freq,enum phy_ch_width chwidth,qdf_freq_t cen320_freq)1295 wlan_reg_get_bonded_chan_entry(qdf_freq_t freq, enum phy_ch_width chwidth,
1296 			       qdf_freq_t cen320_freq)
1297 {
1298 	return reg_get_bonded_chan_entry(freq, chwidth, cen320_freq);
1299 }
1300 
1301 #ifdef WLAN_FEATURE_11BE
1302 #ifdef CONFIG_REG_6G_PWRMODE
1303 void
wlan_reg_fill_channel_list_for_pwrmode(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq,qdf_freq_t sec_ch_2g_freq,enum phy_ch_width ch_width,qdf_freq_t band_center_320,struct reg_channel_list * chan_list,enum supported_6g_pwr_types in_6g_pwr_type,bool treat_nol_chan_as_disabled)1304 wlan_reg_fill_channel_list_for_pwrmode(struct wlan_objmgr_pdev *pdev,
1305 				       qdf_freq_t freq,
1306 				       qdf_freq_t sec_ch_2g_freq,
1307 				       enum phy_ch_width ch_width,
1308 				       qdf_freq_t band_center_320,
1309 				       struct reg_channel_list *chan_list,
1310 				       enum supported_6g_pwr_types
1311 				       in_6g_pwr_type,
1312 				       bool treat_nol_chan_as_disabled)
1313 {
1314 	reg_fill_channel_list_for_pwrmode(pdev, freq, sec_ch_2g_freq, ch_width,
1315 					  band_center_320, chan_list,
1316 					  in_6g_pwr_type,
1317 					  treat_nol_chan_as_disabled);
1318 }
1319 #endif /* CONFIG_REG_6G_PWRMODE */
1320 
wlan_reg_is_punc_bitmap_valid(enum phy_ch_width bw,uint16_t puncture_bitmap)1321 bool wlan_reg_is_punc_bitmap_valid(enum phy_ch_width bw,
1322 				   uint16_t puncture_bitmap)
1323 {
1324 	return reg_is_punc_bitmap_valid(bw, puncture_bitmap);
1325 }
1326 
wlan_reg_find_nearest_puncture_pattern(enum phy_ch_width bw,uint16_t proposed_bitmap)1327 uint16_t wlan_reg_find_nearest_puncture_pattern(enum phy_ch_width bw,
1328 						uint16_t proposed_bitmap)
1329 {
1330 	return reg_find_nearest_puncture_pattern(bw, proposed_bitmap);
1331 }
1332 
wlan_reg_extract_puncture_by_bw(enum phy_ch_width ori_bw,uint16_t ori_puncture_bitmap,qdf_freq_t freq,qdf_freq_t cen320_freq,enum phy_ch_width new_bw,uint16_t * new_puncture_bitmap)1333 QDF_STATUS wlan_reg_extract_puncture_by_bw(enum phy_ch_width ori_bw,
1334 					   uint16_t ori_puncture_bitmap,
1335 					   qdf_freq_t freq,
1336 					   qdf_freq_t cen320_freq,
1337 					   enum phy_ch_width new_bw,
1338 					   uint16_t *new_puncture_bitmap)
1339 {
1340 	return reg_extract_puncture_by_bw(ori_bw, ori_puncture_bitmap, freq,
1341 					  cen320_freq, new_bw,
1342 					  new_puncture_bitmap);
1343 }
1344 
wlan_reg_set_create_punc_bitmap(struct ch_params * ch_params,bool is_create_punc_bitmap)1345 void wlan_reg_set_create_punc_bitmap(struct ch_params *ch_params,
1346 				     bool is_create_punc_bitmap)
1347 {
1348 	reg_set_create_punc_bitmap(ch_params, is_create_punc_bitmap);
1349 }
1350 
1351 #ifdef CONFIG_REG_CLIENT
wlan_reg_apply_puncture(struct wlan_objmgr_pdev * pdev,uint16_t puncture_bitmap,qdf_freq_t freq,enum phy_ch_width bw,qdf_freq_t cen320_freq)1352 QDF_STATUS wlan_reg_apply_puncture(struct wlan_objmgr_pdev *pdev,
1353 				   uint16_t puncture_bitmap,
1354 				   qdf_freq_t freq,
1355 				   enum phy_ch_width bw,
1356 				   qdf_freq_t cen320_freq)
1357 {
1358 	return reg_apply_puncture(pdev, puncture_bitmap, freq, bw,
1359 				  cen320_freq);
1360 }
1361 
wlan_reg_remove_puncture(struct wlan_objmgr_pdev * pdev)1362 QDF_STATUS wlan_reg_remove_puncture(struct wlan_objmgr_pdev *pdev)
1363 {
1364 	return reg_remove_puncture(pdev);
1365 }
1366 #endif
1367 #endif /* WLAN_FEATURE_11BE */
1368 
1369 #ifdef CONFIG_REG_6G_PWRMODE
1370 enum channel_state
wlan_reg_get_channel_state_for_pwrmode(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq,enum supported_6g_pwr_types in_6g_pwr_type)1371 wlan_reg_get_channel_state_for_pwrmode(struct wlan_objmgr_pdev *pdev,
1372 				       qdf_freq_t freq,
1373 				       enum supported_6g_pwr_types
1374 				       in_6g_pwr_type)
1375 {
1376 	return reg_get_channel_state_for_pwrmode(pdev, freq, in_6g_pwr_type);
1377 }
1378 #endif
1379 
1380 #ifdef CONFIG_REG_CLIENT
wlan_reg_get_channel_state_from_secondary_list_for_freq(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq)1381 enum channel_state wlan_reg_get_channel_state_from_secondary_list_for_freq(
1382 						struct wlan_objmgr_pdev *pdev,
1383 						qdf_freq_t freq)
1384 {
1385 	return reg_get_channel_state_from_secondary_list_for_freq(pdev, freq);
1386 }
1387 
1388 QDF_STATUS
wlan_reg_get_channel_list_with_power(struct wlan_objmgr_pdev * pdev,struct channel_power * ch_list,uint8_t * num_chan,enum supported_6g_pwr_types in_6g_pwr_type)1389 wlan_reg_get_channel_list_with_power(struct wlan_objmgr_pdev *pdev,
1390 				     struct channel_power *ch_list,
1391 				     uint8_t *num_chan,
1392 				     enum supported_6g_pwr_types in_6g_pwr_type)
1393 {
1394 	return reg_get_channel_list_with_power(pdev, ch_list, num_chan,
1395 					       in_6g_pwr_type);
1396 }
1397 #endif
1398 
wlan_reg_get_channel_reg_power_for_freq(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq)1399 uint8_t wlan_reg_get_channel_reg_power_for_freq(struct wlan_objmgr_pdev *pdev,
1400 						qdf_freq_t freq)
1401 {
1402 	return reg_get_channel_reg_power_for_freq(pdev, freq);
1403 }
1404 
wlan_reg_freq_to_band(qdf_freq_t freq)1405 enum reg_wifi_band wlan_reg_freq_to_band(qdf_freq_t freq)
1406 {
1407 	return reg_freq_to_band(freq);
1408 }
1409 qdf_export_symbol(wlan_reg_freq_to_band);
1410 
wlan_reg_min_chan_freq(void)1411 qdf_freq_t wlan_reg_min_chan_freq(void)
1412 {
1413 	return reg_min_chan_freq();
1414 }
1415 
wlan_reg_max_chan_freq(void)1416 qdf_freq_t wlan_reg_max_chan_freq(void)
1417 {
1418 	return reg_max_chan_freq();
1419 }
1420 
wlan_reg_freq_width_to_chan_op_class(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq,uint16_t chan_width,bool global_tbl_lookup,uint16_t behav_limit,uint8_t * op_class,uint8_t * chan_num)1421 void wlan_reg_freq_width_to_chan_op_class(struct wlan_objmgr_pdev *pdev,
1422 					  qdf_freq_t freq,
1423 					  uint16_t chan_width,
1424 					  bool global_tbl_lookup,
1425 					  uint16_t behav_limit,
1426 					  uint8_t *op_class,
1427 					  uint8_t *chan_num)
1428 {
1429 	return reg_freq_width_to_chan_op_class(pdev, freq, chan_width,
1430 					       global_tbl_lookup,
1431 					       behav_limit,
1432 					       op_class,
1433 					       chan_num);
1434 }
1435 
1436 qdf_export_symbol(wlan_reg_freq_width_to_chan_op_class);
1437 
wlan_reg_freq_width_to_chan_op_class_auto(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq,uint16_t chan_width,bool global_tbl_lookup,uint16_t behav_limit,uint8_t * op_class,uint8_t * chan_num)1438 void wlan_reg_freq_width_to_chan_op_class_auto(struct wlan_objmgr_pdev *pdev,
1439 					       qdf_freq_t freq,
1440 					       uint16_t chan_width,
1441 					       bool global_tbl_lookup,
1442 					       uint16_t behav_limit,
1443 					       uint8_t *op_class,
1444 					       uint8_t *chan_num)
1445 {
1446 	reg_freq_width_to_chan_op_class_auto(pdev, freq, chan_width,
1447 					     global_tbl_lookup,
1448 					     behav_limit,
1449 					     op_class,
1450 					     chan_num);
1451 }
1452 
1453 qdf_export_symbol(wlan_reg_freq_width_to_chan_op_class_auto);
1454 
wlan_reg_freq_to_chan_op_class(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq,bool global_tbl_lookup,uint16_t behav_limit,uint8_t * op_class,uint8_t * chan_num)1455 void wlan_reg_freq_to_chan_op_class(struct wlan_objmgr_pdev *pdev,
1456 				    qdf_freq_t freq,
1457 				    bool global_tbl_lookup,
1458 				    uint16_t behav_limit,
1459 				    uint8_t *op_class,
1460 				    uint8_t *chan_num)
1461 {
1462 	return reg_freq_to_chan_op_class(pdev, freq,
1463 					 global_tbl_lookup,
1464 					 behav_limit,
1465 					 op_class,
1466 					 chan_num);
1467 }
1468 
wlan_reg_is_freq_in_country_opclass(struct wlan_objmgr_pdev * pdev,const uint8_t country[3],uint8_t op_class,qdf_freq_t chan_freq)1469 bool wlan_reg_is_freq_in_country_opclass(struct wlan_objmgr_pdev *pdev,
1470 					 const uint8_t country[3],
1471 					 uint8_t op_class,
1472 					 qdf_freq_t chan_freq)
1473 {
1474 	return reg_is_freq_in_country_opclass(pdev, country,
1475 					      op_class, chan_freq);
1476 }
1477 
1478 enum channel_state
wlan_reg_get_5g_bonded_channel_and_state_for_pwrmode(struct wlan_objmgr_pdev * pdev,uint16_t freq,enum phy_ch_width bw,const struct bonded_channel_freq ** bonded_chan_ptr_ptr,enum supported_6g_pwr_types in_6g_pwr_mode,uint16_t input_puncture_bitmap)1479 wlan_reg_get_5g_bonded_channel_and_state_for_pwrmode(
1480 					struct wlan_objmgr_pdev *pdev,
1481 					uint16_t freq,
1482 					enum phy_ch_width bw,
1483 					const
1484 					struct bonded_channel_freq
1485 					**bonded_chan_ptr_ptr,
1486 					enum supported_6g_pwr_types
1487 					in_6g_pwr_mode,
1488 					uint16_t input_puncture_bitmap)
1489 {
1490 	/*
1491 	 * Get channel frequencies and state from regulatory
1492 	 */
1493 	return reg_get_5g_bonded_channel_for_pwrmode(pdev, freq, bw,
1494 						     bonded_chan_ptr_ptr,
1495 						     in_6g_pwr_mode,
1496 						     input_puncture_bitmap);
1497 }
1498 
1499 qdf_export_symbol(wlan_reg_get_5g_bonded_channel_and_state_for_pwrmode);
1500 
1501 #if defined(CONFIG_REG_CLIENT)
1502 enum channel_state
wlan_reg_get_bonded_channel_state_for_pwrmode(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq,enum phy_ch_width bw,qdf_freq_t sec_freq,enum supported_6g_pwr_types in_6g_pwr_mode)1503 wlan_reg_get_bonded_channel_state_for_pwrmode(struct wlan_objmgr_pdev *pdev,
1504 					      qdf_freq_t freq,
1505 					      enum phy_ch_width bw,
1506 					      qdf_freq_t sec_freq,
1507 					      enum supported_6g_pwr_types
1508 					      in_6g_pwr_mode)
1509 {
1510 	if (WLAN_REG_IS_24GHZ_CH_FREQ(freq))
1511 		return reg_get_2g_bonded_channel_state_for_freq(pdev, freq,
1512 						       sec_freq, bw);
1513 	if (bw == CH_WIDTH_320MHZ) {
1514 		const struct bonded_channel_freq *bonded_chan_ptr_ptr = NULL;
1515 
1516 		return reg_get_chan_state_for_320(pdev, freq, 0,
1517 						  bw,
1518 						  &bonded_chan_ptr_ptr,
1519 						  in_6g_pwr_mode, true,
1520 						  NO_SCHANS_PUNC);
1521 	} else {
1522 		struct ch_params params = {0};
1523 
1524 		params.ch_width = bw;
1525 
1526 		return reg_get_5g_bonded_channel_state_for_pwrmode(
1527 						pdev, freq,
1528 						&params, in_6g_pwr_mode);
1529 	}
1530 }
1531 
1532 qdf_export_symbol(wlan_reg_get_bonded_channel_state_for_pwrmode);
1533 #endif
1534 #endif /* CONFIG CHAN FREQ API */
1535 
wlan_reg_get_op_class_width(struct wlan_objmgr_pdev * pdev,uint8_t op_class,bool global_tbl_lookup)1536 uint16_t wlan_reg_get_op_class_width(struct wlan_objmgr_pdev *pdev,
1537 				     uint8_t op_class,
1538 				     bool global_tbl_lookup)
1539 {
1540 	return reg_get_op_class_width(pdev, op_class,
1541 				      global_tbl_lookup);
1542 }
1543 
wlan_reg_is_5ghz_op_class(const uint8_t * country,uint8_t op_class)1544 bool wlan_reg_is_5ghz_op_class(const uint8_t *country, uint8_t op_class)
1545 {
1546 	return reg_is_5ghz_op_class(country, op_class);
1547 }
1548 
wlan_reg_is_2ghz_op_class(const uint8_t * country,uint8_t op_class)1549 bool wlan_reg_is_2ghz_op_class(const uint8_t *country, uint8_t op_class)
1550 {
1551 	return reg_is_2ghz_op_class(country, op_class);
1552 }
1553 
1554 qdf_export_symbol(wlan_reg_is_2ghz_op_class);
1555 
wlan_reg_is_6ghz_op_class(struct wlan_objmgr_pdev * pdev,uint8_t op_class)1556 bool wlan_reg_is_6ghz_op_class(struct wlan_objmgr_pdev *pdev,
1557 			       uint8_t op_class)
1558 {
1559 	return reg_is_6ghz_op_class(pdev, op_class);
1560 }
1561 
1562 qdf_export_symbol(wlan_reg_is_6ghz_op_class);
1563 
1564 #ifdef CONFIG_REG_CLIENT
wlan_reg_is_6ghz_supported(struct wlan_objmgr_psoc * psoc)1565 bool wlan_reg_is_6ghz_supported(struct wlan_objmgr_psoc *psoc)
1566 {
1567 	return reg_is_6ghz_supported(psoc);
1568 }
1569 #endif
1570 
1571 #ifdef HOST_OPCLASS_EXT
1572 qdf_freq_t
wlan_reg_country_chan_opclass_to_freq(struct wlan_objmgr_pdev * pdev,const uint8_t country[3],uint8_t chan,uint8_t op_class,bool strict)1573 wlan_reg_country_chan_opclass_to_freq(struct wlan_objmgr_pdev *pdev,
1574 				      const uint8_t country[3],
1575 				      uint8_t chan, uint8_t op_class,
1576 				      bool strict)
1577 {
1578 	return reg_country_chan_opclass_to_freq(pdev, country, chan, op_class,
1579 						strict);
1580 }
1581 #endif
1582 
wlan_reg_chan_opclass_to_freq(uint8_t chan,uint8_t op_class,bool global_tbl_lookup)1583 uint16_t wlan_reg_chan_opclass_to_freq(uint8_t chan,
1584 				       uint8_t op_class,
1585 				       bool global_tbl_lookup)
1586 {
1587 	if (!chan || !op_class)
1588 		return 0;
1589 
1590 	return reg_chan_opclass_to_freq(chan, op_class, global_tbl_lookup);
1591 }
1592 
wlan_reg_compute_6g_center_freq_from_cfi(uint8_t ieee_6g_cfi)1593 qdf_freq_t wlan_reg_compute_6g_center_freq_from_cfi(uint8_t ieee_6g_cfi)
1594 {
1595 	if (!ieee_6g_cfi)
1596 		return 0;
1597 
1598 	return reg_compute_6g_center_freq_from_cfi(ieee_6g_cfi);
1599 }
1600 
wlan_reg_chan_opclass_to_freq_auto(uint8_t chan,uint8_t op_class,bool global_tbl_lookup)1601 qdf_freq_t wlan_reg_chan_opclass_to_freq_auto(uint8_t chan, uint8_t op_class,
1602 					      bool global_tbl_lookup)
1603 {
1604 	if (!chan || !op_class)
1605 		return 0;
1606 
1607 	return reg_chan_opclass_to_freq_auto(chan, op_class, global_tbl_lookup);
1608 }
1609 
1610 #ifdef CHECK_REG_PHYMODE
wlan_reg_get_max_phymode(struct wlan_objmgr_pdev * pdev,enum reg_phymode phy_in,qdf_freq_t freq)1611 enum reg_phymode wlan_reg_get_max_phymode(struct wlan_objmgr_pdev *pdev,
1612 					  enum reg_phymode phy_in,
1613 					  qdf_freq_t freq)
1614 {
1615 	return reg_get_max_phymode(pdev, phy_in, freq);
1616 }
1617 #endif /* CHECK_REG_PHYMODE */
1618 
1619 #ifdef CONFIG_REG_CLIENT
wlan_reg_band_bitmap_to_band_info(uint32_t band_bitmap)1620 enum band_info wlan_reg_band_bitmap_to_band_info(uint32_t band_bitmap)
1621 {
1622 	return reg_band_bitmap_to_band_info(band_bitmap);
1623 }
1624 
1625 QDF_STATUS
wlan_reg_update_tx_power_on_ctry_change(struct wlan_objmgr_pdev * pdev,uint8_t vdev_id)1626 wlan_reg_update_tx_power_on_ctry_change(struct wlan_objmgr_pdev *pdev,
1627 					uint8_t vdev_id)
1628 {
1629 	return reg_update_tx_power_on_ctry_change(pdev, vdev_id);
1630 }
1631 #endif
1632 
1633 #if defined(CONFIG_BAND_6GHZ)
wlan_reg_get_rnr_tpe_usable(struct wlan_objmgr_pdev * pdev,bool * reg_rnr_tpe_usable)1634 QDF_STATUS wlan_reg_get_rnr_tpe_usable(struct wlan_objmgr_pdev *pdev,
1635 				       bool *reg_rnr_tpe_usable)
1636 {
1637 	return reg_get_rnr_tpe_usable(pdev, reg_rnr_tpe_usable);
1638 }
1639 
wlan_reg_get_unspecified_ap_usable(struct wlan_objmgr_pdev * pdev,bool * reg_unspecified_ap_usable)1640 QDF_STATUS wlan_reg_get_unspecified_ap_usable(struct wlan_objmgr_pdev *pdev,
1641 					      bool *reg_unspecified_ap_usable)
1642 {
1643 	return reg_get_unspecified_ap_usable(pdev, reg_unspecified_ap_usable);
1644 }
1645 
1646 QDF_STATUS
wlan_reg_get_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev * pdev,enum reg_6g_ap_type * reg_cur_6g_ap_pwr_type)1647 wlan_reg_get_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev,
1648 				enum reg_6g_ap_type *reg_cur_6g_ap_pwr_type)
1649 {
1650 	return reg_get_cur_6g_ap_pwr_type(pdev, reg_cur_6g_ap_pwr_type);
1651 }
1652 
1653 qdf_export_symbol(wlan_reg_get_cur_6g_ap_pwr_type);
1654 
1655 QDF_STATUS
wlan_reg_get_cur_6g_client_type(struct wlan_objmgr_pdev * pdev,enum reg_6g_client_type * reg_cur_6g_client_mobility_type)1656 wlan_reg_get_cur_6g_client_type(struct wlan_objmgr_pdev *pdev,
1657 				enum reg_6g_client_type
1658 				*reg_cur_6g_client_mobility_type)
1659 {
1660 	return reg_get_cur_6g_client_type(pdev,
1661 					  reg_cur_6g_client_mobility_type);
1662 }
1663 
1664 qdf_export_symbol(wlan_reg_get_cur_6g_client_type);
1665 
1666 QDF_STATUS
wlan_reg_set_cur_6ghz_client_type(struct wlan_objmgr_pdev * pdev,enum reg_6g_client_type in_6ghz_client_type)1667 wlan_reg_set_cur_6ghz_client_type(struct wlan_objmgr_pdev *pdev,
1668 				  enum reg_6g_client_type in_6ghz_client_type)
1669 {
1670 	return reg_set_cur_6ghz_client_type(pdev, in_6ghz_client_type);
1671 }
1672 
1673 QDF_STATUS
wlan_reg_set_6ghz_client_type_from_target(struct wlan_objmgr_pdev * pdev)1674 wlan_reg_set_6ghz_client_type_from_target(struct wlan_objmgr_pdev *pdev)
1675 {
1676 	return reg_set_6ghz_client_type_from_target(pdev);
1677 }
1678 
wlan_reg_is_6g_psd_power(struct wlan_objmgr_pdev * pdev)1679 bool wlan_reg_is_6g_psd_power(struct wlan_objmgr_pdev *pdev)
1680 {
1681 	return reg_is_6g_psd_power(pdev);
1682 }
1683 
wlan_reg_get_6g_chan_ap_power(struct wlan_objmgr_pdev * pdev,qdf_freq_t chan_freq,bool * is_psd,uint16_t * tx_power,uint16_t * eirp_psd_power)1684 QDF_STATUS wlan_reg_get_6g_chan_ap_power(struct wlan_objmgr_pdev *pdev,
1685 					 qdf_freq_t chan_freq, bool *is_psd,
1686 					 uint16_t *tx_power,
1687 					 uint16_t *eirp_psd_power)
1688 {
1689 	return reg_get_6g_chan_ap_power(pdev, chan_freq, is_psd,
1690 					tx_power, eirp_psd_power);
1691 }
1692 
1693 qdf_export_symbol(wlan_reg_get_6g_chan_ap_power);
1694 
1695 QDF_STATUS
wlan_reg_get_client_power_for_connecting_ap(struct wlan_objmgr_pdev * pdev,enum reg_6g_ap_type ap_type,qdf_freq_t chan_freq,bool is_psd,uint16_t * tx_power,uint16_t * eirp_psd_power)1696 wlan_reg_get_client_power_for_connecting_ap(struct wlan_objmgr_pdev *pdev,
1697 					    enum reg_6g_ap_type ap_type,
1698 					    qdf_freq_t chan_freq,
1699 					    bool is_psd, uint16_t *tx_power,
1700 					    uint16_t *eirp_psd_power)
1701 {
1702 	return reg_get_client_power_for_connecting_ap(pdev, ap_type, chan_freq,
1703 						      is_psd, tx_power,
1704 						      eirp_psd_power);
1705 }
1706 
1707 QDF_STATUS
wlan_reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev * pdev,enum reg_6g_client_type client_type,qdf_freq_t chan_freq,bool * is_psd,uint16_t * tx_power,uint16_t * eirp_psd_power)1708 wlan_reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev *pdev,
1709 				      enum reg_6g_client_type client_type,
1710 				      qdf_freq_t chan_freq,
1711 				      bool *is_psd, uint16_t *tx_power,
1712 				      uint16_t *eirp_psd_power)
1713 {
1714 	return reg_get_client_power_for_6ghz_ap(pdev, client_type, chan_freq,
1715 						is_psd, tx_power,
1716 						eirp_psd_power);
1717 }
1718 
1719 QDF_STATUS
wlan_reg_set_ap_pwr_and_update_chan_list(struct wlan_objmgr_pdev * pdev,enum reg_6g_ap_type ap_pwr_type)1720 wlan_reg_set_ap_pwr_and_update_chan_list(struct wlan_objmgr_pdev *pdev,
1721 					 enum reg_6g_ap_type ap_pwr_type)
1722 {
1723 	return reg_set_ap_pwr_and_update_chan_list(pdev, ap_pwr_type);
1724 }
1725 
1726 qdf_export_symbol(wlan_reg_set_ap_pwr_and_update_chan_list);
1727 
1728 uint8_t
wlan_reg_get_num_rules_of_ap_pwr_type(struct wlan_objmgr_pdev * pdev,enum reg_6g_ap_type ap_pwr_type)1729 wlan_reg_get_num_rules_of_ap_pwr_type(struct wlan_objmgr_pdev *pdev,
1730 				      enum reg_6g_ap_type ap_pwr_type)
1731 {
1732 	return reg_get_num_rules_of_ap_pwr_type(pdev, ap_pwr_type);
1733 }
1734 
1735 qdf_export_symbol(wlan_reg_get_num_rules_of_ap_pwr_type);
1736 
wlan_reg_get_superchan_entry(struct wlan_objmgr_pdev * pdev,enum channel_enum chan_enum,const struct super_chan_info ** p_sup_chan_entry)1737 QDF_STATUS wlan_reg_get_superchan_entry(
1738 		struct wlan_objmgr_pdev *pdev,
1739 		enum channel_enum chan_enum,
1740 		const struct super_chan_info **p_sup_chan_entry)
1741 {
1742 	return reg_get_superchan_entry(pdev, chan_enum, p_sup_chan_entry);
1743 }
1744 
1745 enum supported_6g_pwr_types
wlan_reg_conv_6g_ap_type_to_supported_6g_pwr_types(enum reg_6g_ap_type ap_pwr_type)1746 wlan_reg_conv_6g_ap_type_to_supported_6g_pwr_types(enum reg_6g_ap_type
1747 						   ap_pwr_type)
1748 {
1749 	return reg_conv_6g_ap_type_to_supported_6g_pwr_types(ap_pwr_type);
1750 }
1751 
1752 enum supported_6g_pwr_types
wlan_reg_get_best_6g_pwr_type(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq)1753 wlan_reg_get_best_6g_pwr_type(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
1754 {
1755 	return reg_get_best_6g_pwr_type(pdev, freq);
1756 }
1757 
1758 enum reg_6g_ap_type
wlan_reg_conv_supported_6g_pwr_type_to_ap_pwr_type(enum supported_6g_pwr_types in_6g_pwr_type)1759 wlan_reg_conv_supported_6g_pwr_type_to_ap_pwr_type(enum supported_6g_pwr_types
1760 						  in_6g_pwr_type)
1761 {
1762 	return reg_convert_supported_6g_pwr_type_to_ap_pwr_type(in_6g_pwr_type);
1763 }
1764 #endif /* CONFIG_BAND_6GHZ */
1765 
wlan_reg_is_ext_tpc_supported(struct wlan_objmgr_psoc * psoc)1766 bool wlan_reg_is_ext_tpc_supported(struct wlan_objmgr_psoc *psoc)
1767 {
1768 	return reg_is_ext_tpc_supported(psoc);
1769 }
1770 
1771 #ifdef CONFIG_AFC_SUPPORT
wlan_reg_is_afc_power_event_received(struct wlan_objmgr_pdev * pdev)1772 bool wlan_reg_is_afc_power_event_received(struct wlan_objmgr_pdev *pdev)
1773 {
1774 	return reg_is_afc_power_event_received(pdev);
1775 }
1776 
1777 qdf_export_symbol(wlan_reg_is_afc_power_event_received);
1778 
wlan_reg_is_afc_done(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq)1779 bool wlan_reg_is_afc_done(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
1780 {
1781 	return reg_is_afc_done(pdev, freq);
1782 }
1783 
1784 qdf_export_symbol(wlan_reg_is_afc_done);
1785 
wlan_reg_get_afc_req_id(struct wlan_objmgr_pdev * pdev,uint64_t * req_id)1786 QDF_STATUS wlan_reg_get_afc_req_id(struct wlan_objmgr_pdev *pdev,
1787 				   uint64_t *req_id)
1788 {
1789 	return reg_get_afc_req_id(pdev, req_id);
1790 }
1791 
1792 qdf_export_symbol(wlan_reg_get_afc_req_id);
1793 
wlan_reg_is_afc_expiry_event_received(struct wlan_objmgr_pdev * pdev)1794 bool wlan_reg_is_afc_expiry_event_received(struct wlan_objmgr_pdev *pdev)
1795 {
1796 	return reg_is_afc_expiry_event_received(pdev);
1797 }
1798 
1799 qdf_export_symbol(wlan_reg_is_afc_expiry_event_received);
1800 
wlan_reg_is_noaction_on_afc_pwr_evt(struct wlan_objmgr_pdev * pdev)1801 bool wlan_reg_is_noaction_on_afc_pwr_evt(struct wlan_objmgr_pdev *pdev)
1802 {
1803 	return reg_is_noaction_on_afc_pwr_evt(pdev);
1804 }
1805 
1806 QDF_STATUS
wlan_reg_get_afc_dev_deploy_type(struct wlan_objmgr_pdev * pdev,enum reg_afc_dev_deploy_type * afc_dev_type)1807 wlan_reg_get_afc_dev_deploy_type(struct wlan_objmgr_pdev *pdev,
1808 				 enum reg_afc_dev_deploy_type *afc_dev_type)
1809 {
1810 	return reg_get_afc_dev_deploy_type(pdev, afc_dev_type);
1811 }
1812 
1813 qdf_export_symbol(wlan_reg_get_afc_dev_deploy_type);
1814 
1815 bool
wlan_reg_is_sta_connect_allowed(struct wlan_objmgr_pdev * pdev,enum reg_6g_ap_type root_ap_pwr_mode)1816 wlan_reg_is_sta_connect_allowed(struct wlan_objmgr_pdev *pdev,
1817 				enum reg_6g_ap_type root_ap_pwr_mode)
1818 {
1819 	return reg_is_sta_connect_allowed(pdev, root_ap_pwr_mode);
1820 }
1821 
1822 qdf_export_symbol(wlan_reg_is_sta_connect_allowed);
1823 #endif /* CONFIG_AFC_SUPPORT */
1824 
wlan_reg_is_chwidth_supported(struct wlan_objmgr_pdev * pdev,enum phy_ch_width ch_width,bool * is_supported)1825 QDF_STATUS wlan_reg_is_chwidth_supported(struct wlan_objmgr_pdev *pdev,
1826 					 enum phy_ch_width ch_width,
1827 					 bool *is_supported)
1828 {
1829 	return reg_is_chwidth_supported(pdev, ch_width, is_supported);
1830 }
1831 
1832 qdf_export_symbol(wlan_reg_is_chwidth_supported);
1833 
1834 #ifdef CONFIG_BAND_6GHZ
wlan_reg_get_thresh_priority_freq(struct wlan_objmgr_pdev * pdev)1835 qdf_freq_t wlan_reg_get_thresh_priority_freq(struct wlan_objmgr_pdev *pdev)
1836 {
1837 	return reg_get_thresh_priority_freq(pdev);
1838 }
1839 
wlan_reg_psd_2_eirp(struct wlan_objmgr_pdev * pdev,int16_t psd,uint16_t ch_bw,int16_t * eirp)1840 QDF_STATUS wlan_reg_psd_2_eirp(struct wlan_objmgr_pdev *pdev,
1841 			       int16_t psd,
1842 			       uint16_t ch_bw,
1843 			       int16_t *eirp)
1844 {
1845 	return reg_psd_2_eirp(pdev, psd, ch_bw, eirp);
1846 }
1847 
1848 qdf_export_symbol(wlan_reg_psd_2_eirp);
1849 
wlan_reg_eirp_2_psd(struct wlan_objmgr_pdev * pdev,uint16_t ch_bw,int16_t eirp,int16_t * psd)1850 QDF_STATUS wlan_reg_eirp_2_psd(struct wlan_objmgr_pdev *pdev, uint16_t ch_bw,
1851 			       int16_t eirp, int16_t *psd)
1852 {
1853 	return reg_eirp_2_psd(pdev, ch_bw, eirp, psd);
1854 }
1855 
1856 enum reg_6g_ap_type
wlan_reg_get_best_pwr_mode(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq,qdf_freq_t cen320,uint16_t bw,uint16_t in_punc_pattern)1857 wlan_reg_get_best_pwr_mode(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq,
1858 			   qdf_freq_t cen320,
1859 			   uint16_t bw, uint16_t in_punc_pattern)
1860 {
1861 	return reg_get_best_pwr_mode(pdev, freq, cen320, bw, in_punc_pattern);
1862 }
1863 
1864 qdf_export_symbol(wlan_reg_get_best_pwr_mode);
1865 
wlan_reg_get_eirp_pwr(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq,qdf_freq_t cen320,uint16_t bw,enum reg_6g_ap_type ap_pwr_type,uint16_t in_punc_pattern,bool is_client_list_lookup_needed,enum reg_6g_client_type client_type)1866 int8_t wlan_reg_get_eirp_pwr(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq,
1867 			     qdf_freq_t cen320, uint16_t bw,
1868 			     enum reg_6g_ap_type ap_pwr_type,
1869 			     uint16_t in_punc_pattern,
1870 			     bool is_client_list_lookup_needed,
1871 			     enum reg_6g_client_type client_type)
1872 {
1873 	return reg_get_eirp_pwr(pdev, freq, cen320, bw, ap_pwr_type,
1874 				in_punc_pattern, is_client_list_lookup_needed,
1875 				client_type);
1876 }
1877 
1878 qdf_export_symbol(wlan_reg_get_eirp_pwr);
1879 
1880 #endif /* CONFIG_BAND_6GHZ */
1881 
wlan_reg_find_chwidth_from_bw(uint16_t bw)1882 enum phy_ch_width wlan_reg_find_chwidth_from_bw(uint16_t bw)
1883 {
1884 	return reg_find_chwidth_from_bw(bw);
1885 }
1886 
1887 #ifdef WLAN_FEATURE_11BE
1888 enum channel_state
wlan_reg_get_chan_state_for_320(struct wlan_objmgr_pdev * pdev,uint16_t freq,qdf_freq_t center_320,enum phy_ch_width ch_width,const struct bonded_channel_freq ** bonded_chan_ptr_ptr,enum supported_6g_pwr_types in_6g_pwr_type,bool treat_nol_chan_as_disabled,uint16_t input_puncture_bitmap)1889 wlan_reg_get_chan_state_for_320(struct wlan_objmgr_pdev *pdev,
1890 				uint16_t freq,
1891 				qdf_freq_t center_320,
1892 				enum phy_ch_width ch_width,
1893 				const struct bonded_channel_freq
1894 				**bonded_chan_ptr_ptr,
1895 				enum supported_6g_pwr_types in_6g_pwr_type,
1896 				bool treat_nol_chan_as_disabled,
1897 				uint16_t input_puncture_bitmap)
1898 {
1899 	return reg_get_chan_state_for_320(pdev, freq, center_320,
1900 					  ch_width, bonded_chan_ptr_ptr,
1901 					  in_6g_pwr_type,
1902 					  treat_nol_chan_as_disabled,
1903 					  input_puncture_bitmap);
1904 }
1905 #endif
1906 
1907 #ifdef CONFIG_BAND_6GHZ
wlan_is_sup_chan_entry_afc_done(struct wlan_objmgr_pdev * pdev,enum channel_enum chan_idx,enum supported_6g_pwr_types in_6g_pwr_mode)1908 bool wlan_is_sup_chan_entry_afc_done(struct wlan_objmgr_pdev *pdev,
1909 				     enum channel_enum chan_idx,
1910 				     enum supported_6g_pwr_types in_6g_pwr_mode)
1911 {
1912 	return reg_is_sup_chan_entry_afc_done(pdev, chan_idx, in_6g_pwr_mode);
1913 }
1914 
1915 qdf_export_symbol(wlan_is_sup_chan_entry_afc_done);
1916 
1917 QDF_STATUS
wlan_reg_display_super_chan_list(struct wlan_objmgr_pdev * pdev)1918 wlan_reg_display_super_chan_list(struct wlan_objmgr_pdev *pdev)
1919 {
1920 	return reg_display_super_chan_list(pdev);
1921 }
1922 
1923 #if defined(CONFIG_AFC_SUPPORT) && defined(CONFIG_BAND_6GHZ)
1924 QDF_STATUS
wlan_reg_get_afc_freq_range_and_psd_limits(struct wlan_objmgr_pdev * pdev,uint8_t num_freq_obj,struct afc_freq_obj * afc_obj)1925 wlan_reg_get_afc_freq_range_and_psd_limits(struct wlan_objmgr_pdev *pdev,
1926 					   uint8_t num_freq_obj,
1927 					   struct afc_freq_obj *afc_obj)
1928 {
1929 	return reg_get_afc_freq_range_and_psd_limits(pdev, num_freq_obj,
1930 						     afc_obj);
1931 }
1932 
1933 QDF_STATUS
wlan_reg_get_num_afc_freq_obj(struct wlan_objmgr_pdev * pdev,uint8_t * num_freq_obj)1934 wlan_reg_get_num_afc_freq_obj(struct wlan_objmgr_pdev *pdev,
1935 			      uint8_t *num_freq_obj)
1936 {
1937 	return reg_get_num_afc_freq_obj(pdev, num_freq_obj);
1938 }
1939 
wlan_reg_set_afc_power_event_received(struct wlan_objmgr_pdev * pdev,bool val)1940 QDF_STATUS wlan_reg_set_afc_power_event_received(struct wlan_objmgr_pdev *pdev,
1941 						 bool val)
1942 {
1943 	return reg_set_afc_power_event_received(pdev, val);
1944 }
1945 #endif
1946 
1947 #endif
1948 
1949 QDF_STATUS
wlan_reg_recompute_current_chan_list(struct wlan_objmgr_psoc * psoc,struct wlan_objmgr_pdev * pdev)1950 wlan_reg_recompute_current_chan_list(struct wlan_objmgr_psoc *psoc,
1951 				     struct wlan_objmgr_pdev *pdev)
1952 {
1953 	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
1954 
1955 	pdev_priv_obj = reg_get_pdev_obj(pdev);
1956 	if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
1957 		reg_err("reg pdev priv obj is NULL");
1958 		return QDF_STATUS_E_FAILURE;
1959 	}
1960 
1961 	reg_debug("Recomputing the current channel list");
1962 	reg_compute_pdev_current_chan_list(pdev_priv_obj);
1963 	return reg_send_scheduler_msg_nb(psoc, pdev);
1964 }
1965 
1966 #ifdef CONFIG_REG_CLIENT
1967 QDF_STATUS
wlan_reg_modify_indoor_concurrency(struct wlan_objmgr_pdev * pdev,uint8_t vdev_id,uint32_t freq,enum phy_ch_width width,bool add)1968 wlan_reg_modify_indoor_concurrency(struct wlan_objmgr_pdev *pdev,
1969 				   uint8_t vdev_id, uint32_t freq,
1970 				   enum phy_ch_width width, bool add)
1971 {
1972 	if (add)
1973 		return reg_add_indoor_concurrency(pdev, vdev_id, freq, width);
1974 	else
1975 		return reg_remove_indoor_concurrency(pdev, vdev_id, freq);
1976 }
1977 #endif
1978 
1979 void
wlan_reg_register_is_chan_connected_callback(struct wlan_objmgr_psoc * psoc,void * cbk)1980 wlan_reg_register_is_chan_connected_callback(struct wlan_objmgr_psoc *psoc,
1981 					     void *cbk)
1982 {
1983 	reg_register_is_chan_connected_callback(psoc,
1984 				(reg_get_connected_chan_for_mode_callback)cbk);
1985 }
1986 
1987 void
wlan_reg_unregister_is_chan_connected_callback(struct wlan_objmgr_psoc * psoc,void * cbk)1988 wlan_reg_unregister_is_chan_connected_callback(struct wlan_objmgr_psoc *psoc,
1989 					       void *cbk)
1990 {
1991 	reg_unregister_is_chan_connected_callback(psoc,
1992 				(reg_get_connected_chan_for_mode_callback)cbk);
1993 }
1994 
1995 qdf_freq_t
wlan_reg_get_endchan_cen_from_bandstart(qdf_freq_t band_start,uint16_t bw)1996 wlan_reg_get_endchan_cen_from_bandstart(qdf_freq_t band_start,
1997 					uint16_t bw)
1998 {
1999 	return reg_get_endchan_cen_from_bandstart(band_start, bw);
2000 }
2001 
2002 QDF_STATUS
wlan_reg_get_opclass_from_map(const struct reg_dmn_op_class_map_t ** map,bool is_global_op_table_needed)2003 wlan_reg_get_opclass_from_map(const struct reg_dmn_op_class_map_t **map,
2004 			      bool is_global_op_table_needed)
2005 {
2006 	return reg_get_opclass_from_map(map, is_global_op_table_needed);
2007 }
2008