xref: /wlan-dirver/qca-wifi-host-cmn/umac/regulatory/dispatcher/src/wlan_reg_services_api.c (revision bea437e2293c3d4fb1b5704fcf633aedac996962)
1 /*
2  * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
3  *
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20  /**
21  * @file wlan_reg_services_api.c
22  * @brief contains regulatory service functions
23  */
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 
45 #ifdef CONFIG_CHAN_NUM_API
46 /**
47  * wlan_reg_get_channel_list_with_power() - Provide the channel list with power
48  * @ch_list: pointer to the channel list.
49  *
50  * Return: QDF_STATUS
51  */
52 QDF_STATUS wlan_reg_get_channel_list_with_power(struct wlan_objmgr_pdev *pdev,
53 						struct channel_power *ch_list,
54 						uint8_t *num_chan)
55 {
56 	/*
57 	 * Update the channel list with channel information with power.
58 	 */
59 	return reg_get_channel_list_with_power(pdev, ch_list, num_chan);
60 }
61 #endif /* CONFIG_CHAN_NUM_API */
62 
63 /**
64  * wlan_reg_read_default_country() - Read the default country for the regdomain
65  * @country: pointer to the country code.
66  *
67  * Return: None
68  */
69 QDF_STATUS wlan_reg_read_default_country(struct wlan_objmgr_psoc *psoc,
70 					 uint8_t *country)
71 {
72 	/*
73 	 * Get the default country information
74 	 */
75 	return reg_read_default_country(psoc, country);
76 }
77 
78 QDF_STATUS wlan_reg_read_current_country(struct wlan_objmgr_psoc *psoc,
79 					 uint8_t *country)
80 {
81 	/*
82 	 * Get the current country information
83 	 */
84 	return reg_read_current_country(psoc, country);
85 }
86 
87 #ifdef CONFIG_CHAN_NUM_API
88 /**
89  * wlan_reg_get_channel_state() - Get channel state from regulatory
90  * @ch: channel number.
91  *
92  * Return: channel state
93  */
94 enum channel_state wlan_reg_get_channel_state(struct wlan_objmgr_pdev *pdev,
95 					      uint8_t ch)
96 {
97 	/*
98 	 * Get channel state from regulatory
99 	 */
100 	return reg_get_channel_state(pdev, ch);
101 }
102 
103 bool
104 wlan_reg_chan_has_dfs_attribute(struct wlan_objmgr_pdev *pdev, uint8_t ch)
105 {
106 	return reg_chan_has_dfs_attribute(pdev, ch);
107 }
108 
109 /**
110  * wlan_reg_get_5g_bonded_channel_state() - Get 5G bonded channel state
111  * @ch: channel number.
112  * @bw: channel band width
113  *
114  * Return: channel state
115  */
116 enum channel_state wlan_reg_get_5g_bonded_channel_state(
117 	struct wlan_objmgr_pdev *pdev, uint8_t ch,
118 	enum phy_ch_width bw)
119 {
120 	/*
121 	 * Get channel state from regulatory
122 	 */
123 	return reg_get_5g_bonded_channel_state(pdev, ch, bw);
124 }
125 
126 /**
127  * wlan_reg_get_2g_bonded_channel_state() - Get 2G bonded channel state
128  * @ch: channel number.
129  * @bw: channel band width
130  *
131  * Return: channel state
132  */
133 enum channel_state wlan_reg_get_2g_bonded_channel_state(
134 		struct wlan_objmgr_pdev *pdev, uint8_t ch,
135 		uint8_t sec_ch, enum phy_ch_width bw)
136 {
137 	/*
138 	 * Get channel state from regulatory
139 	 */
140 	return reg_get_2g_bonded_channel_state(pdev, ch, sec_ch, bw);
141 }
142 
143 /**
144  * wlan_reg_set_channel_params() - Sets channel parameteres for given bandwidth
145  * @ch: channel number.
146  * @ch_params: pointer to the channel parameters.
147  *
148  * Return: None
149  */
150 void wlan_reg_set_channel_params(struct wlan_objmgr_pdev *pdev, uint8_t ch,
151 				 uint8_t sec_ch_2g,
152 				 struct ch_params *ch_params)
153 {
154 	/*
155 	 * Set channel parameters like center frequency for a bonded channel
156 	 * state. Also return the maximum bandwidth supported by the channel.
157 	 */
158 	reg_set_channel_params(pdev, ch, sec_ch_2g, ch_params);
159 }
160 #endif /* CONFIG_CHAN_NUM_API */
161 
162 /**
163  * wlan_reg_get_dfs_region () - Get the current dfs region
164  * @dfs_reg: pointer to dfs region
165  *
166  * Return: Status
167  */
168 QDF_STATUS wlan_reg_get_dfs_region(struct wlan_objmgr_pdev *pdev,
169 			     enum dfs_reg *dfs_reg)
170 {
171 	/*
172 	 * Get the current dfs region
173 	 */
174 	reg_get_current_dfs_region(pdev, dfs_reg);
175 
176 	return QDF_STATUS_SUCCESS;
177 }
178 
179 #ifdef CONFIG_CHAN_NUM_API
180 uint32_t wlan_reg_get_channel_reg_power(struct wlan_objmgr_pdev *pdev,
181 					uint8_t chan_num)
182 {
183 	return reg_get_channel_reg_power(pdev, chan_num);
184 }
185 
186 /**
187  * wlan_reg_get_channel_freq() - get regulatory power for channel
188  * @chan_num: channel number
189  *
190  * Return: int
191  */
192 qdf_freq_t wlan_reg_get_channel_freq(struct wlan_objmgr_pdev *pdev,
193 				     uint8_t chan_num)
194 {
195 	return reg_get_channel_freq(pdev, chan_num);
196 }
197 #endif /* CONFIG_CHAN_NUM_API */
198 
199 QDF_STATUS wlan_reg_get_current_chan_list(struct wlan_objmgr_pdev *pdev,
200 		struct regulatory_channel *chan_list)
201 {
202 	return reg_get_current_chan_list(pdev, chan_list);
203 }
204 
205 qdf_export_symbol(wlan_reg_get_current_chan_list);
206 
207 /**
208  * wlan_reg_get_bw_value() - give bandwidth value
209  * bw: bandwidth enum
210  *
211  * Return: uint16_t
212  */
213 uint16_t wlan_reg_get_bw_value(enum phy_ch_width bw)
214 {
215 	return reg_get_bw_value(bw);
216 }
217 
218 qdf_export_symbol(wlan_reg_get_bw_value);
219 
220 #ifdef CONFIG_CHAN_NUM_API
221 /**
222  * wlan_reg_get_bonded_channel_state() - Get 2G bonded channel state
223  * @ch: channel number.
224  * @bw: channel band width
225  *
226  * Return: channel state
227  */
228 enum channel_state wlan_reg_get_bonded_channel_state(
229 	struct wlan_objmgr_pdev *pdev, uint8_t ch,
230 	enum phy_ch_width bw, uint8_t sec_ch)
231 {
232 	if (WLAN_REG_IS_24GHZ_CH(ch))
233 		return reg_get_2g_bonded_channel_state(pdev, ch,
234 						       sec_ch, bw);
235 	else
236 		return reg_get_5g_bonded_channel_state(pdev, ch,
237 						       bw);
238 }
239 #endif /* CONFIG_CHAN_NUM_API */
240 
241 /**
242  * wlan_reg_set_dfs_region () - Get the current dfs region
243  * @dfs_reg: pointer to dfs region
244  *
245  * Return: None
246  */
247 void wlan_reg_set_dfs_region(struct wlan_objmgr_pdev *pdev,
248 			     enum dfs_reg dfs_reg)
249 {
250 	reg_set_dfs_region(pdev, dfs_reg);
251 }
252 
253 QDF_STATUS wlan_reg_get_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr,
254 		const uint8_t *country_alpha2, enum country_src source)
255 {
256 
257 	return reg_get_domain_from_country_code(reg_domain_ptr,
258 			country_alpha2, source);
259 }
260 
261 
262 uint16_t wlan_reg_dmn_get_opclass_from_channel(uint8_t *country,
263 					       uint8_t channel,
264 					       uint8_t offset)
265 {
266 	return reg_dmn_get_opclass_from_channel(country, channel,
267 						offset);
268 }
269 
270 uint8_t wlan_reg_get_opclass_from_freq_width(uint8_t *country,
271 					     qdf_freq_t freq,
272 					     uint8_t ch_width,
273 					     uint16_t behav_limit)
274 {
275 	return reg_dmn_get_opclass_from_freq_width(country, freq, ch_width,
276 						   behav_limit);
277 }
278 
279 void wlan_reg_dmn_print_channels_in_opclass(uint8_t *country,
280 					    uint8_t opclass)
281 {
282 	reg_dmn_print_channels_in_opclass(country, opclass);
283 }
284 
285 uint16_t wlan_reg_dmn_get_chanwidth_from_opclass(uint8_t *country,
286 						 uint8_t channel,
287 						 uint8_t opclass)
288 {
289 	return reg_dmn_get_chanwidth_from_opclass(country, channel,
290 						  opclass);
291 }
292 
293 uint16_t wlan_reg_dmn_set_curr_opclasses(uint8_t num_classes,
294 					 uint8_t *class)
295 {
296 	return reg_dmn_set_curr_opclasses(num_classes, class);
297 }
298 
299 uint16_t wlan_reg_dmn_get_curr_opclasses(uint8_t *num_classes,
300 					 uint8_t *class)
301 {
302 	return reg_dmn_get_curr_opclasses(num_classes, class);
303 }
304 
305 QDF_STATUS wlan_regulatory_init(void)
306 {
307 	QDF_STATUS status;
308 
309 	status = wlan_objmgr_register_psoc_create_handler(
310 		WLAN_UMAC_COMP_REGULATORY,
311 		wlan_regulatory_psoc_obj_created_notification, NULL);
312 	if (status != QDF_STATUS_SUCCESS) {
313 		reg_err("failed to register reg psoc obj create handler");
314 		return status;
315 	}
316 
317 	status = wlan_objmgr_register_psoc_destroy_handler(
318 		WLAN_UMAC_COMP_REGULATORY,
319 		wlan_regulatory_psoc_obj_destroyed_notification, NULL);
320 	if (status != QDF_STATUS_SUCCESS) {
321 		reg_err("failed to register reg psoc obj create handler");
322 		goto unreg_psoc_create;
323 	}
324 
325 	status = wlan_objmgr_register_pdev_create_handler(
326 		WLAN_UMAC_COMP_REGULATORY,
327 		wlan_regulatory_pdev_obj_created_notification, NULL);
328 	if (status != QDF_STATUS_SUCCESS) {
329 		reg_err("failed to register reg psoc obj create handler");
330 		goto unreg_psoc_destroy;
331 	}
332 
333 	status = wlan_objmgr_register_pdev_destroy_handler(
334 		WLAN_UMAC_COMP_REGULATORY,
335 		wlan_regulatory_pdev_obj_destroyed_notification, NULL);
336 	if (status != QDF_STATUS_SUCCESS) {
337 		reg_err("failed to register reg psoc obj create handler");
338 		goto unreg_pdev_create;
339 	}
340 	channel_map = channel_map_global;
341 	reg_debug("regulatory handlers registered with obj mgr");
342 
343 	return status;
344 
345 unreg_pdev_create:
346 	status = wlan_objmgr_unregister_pdev_create_handler(
347 		WLAN_UMAC_COMP_REGULATORY,
348 		wlan_regulatory_pdev_obj_created_notification,
349 		NULL);
350 
351 unreg_psoc_destroy:
352 	status = wlan_objmgr_unregister_psoc_destroy_handler(
353 		WLAN_UMAC_COMP_REGULATORY,
354 		wlan_regulatory_psoc_obj_destroyed_notification,
355 		NULL);
356 
357 unreg_psoc_create:
358 	status = wlan_objmgr_unregister_psoc_create_handler(
359 		WLAN_UMAC_COMP_REGULATORY,
360 		wlan_regulatory_psoc_obj_created_notification,
361 		NULL);
362 
363 	return QDF_STATUS_E_FAILURE;
364 }
365 
366 QDF_STATUS wlan_regulatory_deinit(void)
367 {
368 	QDF_STATUS status, ret_status = QDF_STATUS_SUCCESS;
369 
370 	status = wlan_objmgr_unregister_pdev_destroy_handler(
371 		WLAN_UMAC_COMP_REGULATORY,
372 		wlan_regulatory_pdev_obj_destroyed_notification, NULL);
373 	if (status != QDF_STATUS_SUCCESS) {
374 		reg_err("failed to unregister reg pdev obj destroy handler");
375 		ret_status = status;
376 	}
377 
378 	status = wlan_objmgr_unregister_pdev_create_handler(
379 		WLAN_UMAC_COMP_REGULATORY,
380 		wlan_regulatory_pdev_obj_created_notification, NULL);
381 	if (status != QDF_STATUS_SUCCESS) {
382 		reg_err("failed to unregister reg pdev obj create handler");
383 		ret_status = status;
384 	}
385 
386 	status = wlan_objmgr_unregister_psoc_destroy_handler(
387 		WLAN_UMAC_COMP_REGULATORY,
388 		wlan_regulatory_psoc_obj_destroyed_notification, NULL);
389 	if (status != QDF_STATUS_SUCCESS) {
390 		reg_err("failed to unregister reg psoc obj destroy handler");
391 		ret_status = status;
392 	}
393 
394 	status = wlan_objmgr_unregister_psoc_create_handler(
395 			WLAN_UMAC_COMP_REGULATORY,
396 			wlan_regulatory_psoc_obj_created_notification, NULL);
397 	if (status != QDF_STATUS_SUCCESS) {
398 		reg_err("failed to unregister reg psoc obj create handler");
399 		ret_status = status;
400 	}
401 
402 	reg_debug("deregistered callbacks with obj mgr");
403 
404 	return ret_status;
405 }
406 
407 QDF_STATUS regulatory_psoc_open(struct wlan_objmgr_psoc *psoc)
408 {
409 	struct wlan_lmac_if_reg_tx_ops *tx_ops;
410 
411 	tx_ops = reg_get_psoc_tx_ops(psoc);
412 	if (tx_ops->register_master_handler)
413 		tx_ops->register_master_handler(psoc, NULL);
414 	if (tx_ops->register_11d_new_cc_handler)
415 		tx_ops->register_11d_new_cc_handler(psoc, NULL);
416 	if (tx_ops->register_ch_avoid_event_handler)
417 		tx_ops->register_ch_avoid_event_handler(psoc, NULL);
418 
419 	return QDF_STATUS_SUCCESS;
420 }
421 
422 QDF_STATUS regulatory_psoc_close(struct wlan_objmgr_psoc *psoc)
423 {
424 	struct wlan_lmac_if_reg_tx_ops *tx_ops;
425 
426 	tx_ops = reg_get_psoc_tx_ops(psoc);
427 	if (tx_ops->unregister_11d_new_cc_handler)
428 		tx_ops->unregister_11d_new_cc_handler(psoc, NULL);
429 	if (tx_ops->unregister_master_handler)
430 		tx_ops->unregister_master_handler(psoc, NULL);
431 	if (tx_ops->unregister_ch_avoid_event_handler)
432 		tx_ops->unregister_ch_avoid_event_handler(psoc, NULL);
433 
434 	return QDF_STATUS_SUCCESS;
435 }
436 
437 QDF_STATUS regulatory_pdev_open(struct wlan_objmgr_pdev *pdev)
438 {
439 	struct wlan_objmgr_psoc *parent_psoc;
440 
441 	parent_psoc = wlan_pdev_get_psoc(pdev);
442 
443 	reg_send_scheduler_msg_nb(parent_psoc, pdev);
444 
445 	return QDF_STATUS_SUCCESS;
446 }
447 
448 QDF_STATUS regulatory_pdev_close(struct wlan_objmgr_pdev *pdev)
449 {
450 	struct wlan_objmgr_psoc *psoc;
451 	struct wlan_regulatory_psoc_priv_obj *soc_reg;
452 
453 	psoc = wlan_pdev_get_psoc(pdev);
454 	soc_reg = reg_get_psoc_obj(psoc);
455 	if (!soc_reg) {
456 		reg_err("reg psoc private obj is NULL");
457 		return QDF_STATUS_E_FAULT;
458 	}
459 
460 	reg_reset_ctry_pending_hints(soc_reg);
461 
462 	return QDF_STATUS_SUCCESS;
463 }
464 
465 #ifdef CONFIG_CHAN_NUM_API
466 void wlan_reg_update_nol_ch(struct wlan_objmgr_pdev *pdev, uint8_t *ch_list,
467 		uint8_t num_ch, bool nol_ch)
468 {
469 	reg_update_nol_ch(pdev, ch_list, num_ch, nol_ch);
470 }
471 
472 void wlan_reg_update_nol_history_ch(struct wlan_objmgr_pdev *pdev,
473 				    uint8_t *ch_list, uint8_t num_ch,
474 				    bool nol_history_ch)
475 {
476 	reg_update_nol_history_ch(pdev, ch_list, num_ch, nol_history_ch);
477 }
478 
479 bool wlan_reg_is_dfs_ch(struct wlan_objmgr_pdev *pdev,
480 			uint8_t chan)
481 {
482 	return reg_is_dfs_ch(pdev, chan);
483 }
484 
485 bool wlan_reg_is_passive_or_disable_ch(struct wlan_objmgr_pdev *pdev,
486 				       uint8_t chan)
487 {
488 	return reg_is_passive_or_disable_ch(pdev, chan);
489 }
490 
491 bool wlan_reg_is_disable_ch(struct wlan_objmgr_pdev *pdev,
492 				       uint8_t chan)
493 {
494 	return reg_is_disable_ch(pdev, chan);
495 }
496 #endif /* CONFIG_CHAN_NUM_API */
497 
498 uint8_t wlan_reg_freq_to_chan(struct wlan_objmgr_pdev *pdev,
499 			      qdf_freq_t freq)
500 {
501 	return reg_freq_to_chan(pdev, freq);
502 }
503 
504 qdf_export_symbol(wlan_reg_freq_to_chan);
505 
506 #ifdef CONFIG_CHAN_NUM_API
507 qdf_freq_t wlan_reg_chan_to_freq(struct wlan_objmgr_pdev *pdev,
508 				 uint8_t chan_num)
509 {
510 	return reg_chan_to_freq(pdev, chan_num);
511 }
512 
513 qdf_export_symbol(wlan_reg_chan_to_freq);
514 
515 qdf_freq_t wlan_reg_legacy_chan_to_freq(struct wlan_objmgr_pdev *pdev,
516 					uint8_t chan_num)
517 {
518 	return reg_legacy_chan_to_freq(pdev, chan_num);
519 }
520 
521 bool wlan_reg_chan_is_49ghz(struct wlan_objmgr_pdev *pdev,
522 			    uint8_t chan_num)
523 {
524 	return reg_chan_is_49ghz(pdev, chan_num);
525 }
526 #endif /* CONFIG_CHAN_NUM_API */
527 
528 QDF_STATUS wlan_reg_set_country(struct wlan_objmgr_pdev *pdev,
529 				       uint8_t *country)
530 {
531 	return reg_set_country(pdev, country);
532 }
533 
534 QDF_STATUS wlan_reg_set_11d_country(struct wlan_objmgr_pdev *pdev,
535 				    uint8_t *country)
536 {
537 	return reg_set_11d_country(pdev, country);
538 }
539 
540 bool wlan_reg_is_world(uint8_t *country)
541 {
542 	return reg_is_world_alpha2(country);
543 }
544 
545 bool wlan_reg_is_us(uint8_t *country)
546 {
547 	return reg_is_us_alpha2(country);
548 }
549 
550 void wlan_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc,
551 					    void *cbk, void *arg)
552 {
553 	reg_register_chan_change_callback(psoc, (reg_chan_change_callback)cbk,
554 					  arg);
555 
556 }
557 
558 void wlan_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc,
559 					      void *cbk)
560 {
561 	reg_unregister_chan_change_callback(psoc,
562 					    (reg_chan_change_callback)cbk);
563 }
564 
565 bool wlan_reg_is_11d_offloaded(struct wlan_objmgr_psoc *psoc)
566 {
567 	return reg_is_11d_offloaded(psoc);
568 }
569 
570 bool wlan_reg_11d_enabled_on_host(struct wlan_objmgr_psoc *psoc)
571 {
572 	return reg_11d_enabled_on_host(psoc);
573 }
574 
575 #ifdef CONFIG_CHAN_NUM_API
576 bool wlan_reg_is_dsrc_chan(struct wlan_objmgr_pdev *pdev, uint8_t chan_num)
577 {
578 	return reg_is_dsrc_chan(pdev, chan_num);
579 }
580 
581 bool wlan_reg_is_etsi13_srd_chan(struct wlan_objmgr_pdev *pdev,
582 				 uint8_t chan_num)
583 {
584 	return reg_is_etsi13_srd_chan(pdev, chan_num);
585 }
586 #endif /* CONFIG_CHAN_NUM_API */
587 
588 bool wlan_reg_is_etsi13_regdmn(struct wlan_objmgr_pdev *pdev)
589 {
590 	return reg_is_etsi13_regdmn(pdev);
591 }
592 
593 bool wlan_reg_is_etsi13_srd_chan_allowed_master_mode(struct wlan_objmgr_pdev
594 						     *pdev)
595 {
596 	return reg_is_etsi13_srd_chan_allowed_master_mode(pdev);
597 }
598 
599 bool wlan_reg_get_fcc_constraint(struct wlan_objmgr_pdev *pdev, uint32_t freq)
600 {
601 	return reg_get_fcc_constraint(pdev, freq);
602 }
603 
604 QDF_STATUS wlan_reg_get_chip_mode(struct wlan_objmgr_pdev *pdev,
605 		uint32_t *chip_mode)
606 {
607 	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
608 
609 	pdev_priv_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev,
610 			WLAN_UMAC_COMP_REGULATORY);
611 
612 	if (!pdev_priv_obj) {
613 		reg_err("reg pdev private obj is NULL");
614 		return QDF_STATUS_E_FAULT;
615 	}
616 
617 	*chip_mode = pdev_priv_obj->wireless_modes;
618 
619 	return QDF_STATUS_SUCCESS;
620 }
621 
622 bool wlan_reg_is_11d_scan_inprogress(struct wlan_objmgr_psoc *psoc)
623 {
624 	return reg_is_11d_scan_inprogress(psoc);
625 }
626 
627 QDF_STATUS wlan_reg_get_freq_range(struct wlan_objmgr_pdev *pdev,
628 		qdf_freq_t *low_2g,
629 		qdf_freq_t *high_2g,
630 		qdf_freq_t *low_5g,
631 		qdf_freq_t *high_5g)
632 {
633 	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
634 
635 	pdev_priv_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev,
636 			WLAN_UMAC_COMP_REGULATORY);
637 
638 	if (!pdev_priv_obj) {
639 		reg_err("reg pdev private obj is NULL");
640 		return QDF_STATUS_E_FAULT;
641 	}
642 
643 	*low_2g = pdev_priv_obj->range_2g_low;
644 	*high_2g = pdev_priv_obj->range_2g_high;
645 	*low_5g = pdev_priv_obj->range_5g_low;
646 	*high_5g = pdev_priv_obj->range_5g_high;
647 
648 	return QDF_STATUS_SUCCESS;
649 }
650 
651 struct wlan_lmac_if_reg_tx_ops *
652 wlan_reg_get_tx_ops(struct wlan_objmgr_psoc *psoc)
653 {
654 	return reg_get_psoc_tx_ops(psoc);
655 }
656 
657 QDF_STATUS wlan_reg_get_curr_regdomain(struct wlan_objmgr_pdev *pdev,
658 		struct cur_regdmn_info *cur_regdmn)
659 {
660 	return reg_get_curr_regdomain(pdev, cur_regdmn);
661 }
662 
663 #ifdef CONFIG_CHAN_NUM_API
664 uint8_t wlan_reg_min_24ghz_ch_num(void)
665 {
666 	return reg_min_24ghz_ch_num();
667 }
668 
669 uint8_t wlan_reg_max_24ghz_ch_num(void)
670 {
671 	return reg_max_24ghz_ch_num();
672 }
673 
674 uint8_t wlan_reg_min_5ghz_ch_num(void)
675 {
676 	return reg_min_5ghz_ch_num();
677 }
678 
679 uint8_t wlan_reg_max_5ghz_ch_num(void)
680 {
681 	return reg_max_5ghz_ch_num();
682 }
683 #endif /* CONFIG_CHAN_NUM_API */
684 
685 #ifdef CONFIG_CHAN_FREQ_API
686 qdf_freq_t wlan_reg_min_24ghz_chan_freq(void)
687 {
688 	return reg_min_24ghz_chan_freq();
689 }
690 
691 qdf_freq_t wlan_reg_max_24ghz_chan_freq(void)
692 {
693 	return reg_max_24ghz_chan_freq();
694 }
695 
696 qdf_freq_t wlan_reg_min_5ghz_chan_freq(void)
697 {
698 	return reg_min_5ghz_chan_freq();
699 }
700 
701 qdf_freq_t wlan_reg_max_5ghz_chan_freq(void)
702 {
703 	return reg_max_5ghz_chan_freq();
704 }
705 #endif /* CONFIG_CHAN_FREQ_API */
706 
707 #ifdef CONFIG_CHAN_NUM_API
708 bool wlan_reg_is_24ghz_ch(uint8_t chan)
709 {
710 	return reg_is_24ghz_ch(chan);
711 }
712 
713 bool wlan_reg_is_5ghz_ch(uint8_t chan)
714 {
715 	return reg_is_5ghz_ch(chan);
716 }
717 #endif /* CONFIG_CHAN_NUM_API */
718 
719 bool wlan_reg_is_24ghz_ch_freq(qdf_freq_t freq)
720 {
721 	return reg_is_24ghz_ch_freq(freq);
722 }
723 
724 bool wlan_reg_is_5ghz_ch_freq(qdf_freq_t freq)
725 {
726 	return reg_is_5ghz_ch_freq(freq);
727 }
728 
729 #ifdef CONFIG_BAND_6GHZ
730 bool wlan_reg_is_6ghz_chan_freq(uint16_t freq)
731 {
732 	return reg_is_6ghz_chan_freq(freq);
733 }
734 
735 uint16_t wlan_reg_min_6ghz_chan_freq(void)
736 {
737 	return reg_min_6ghz_chan_freq();
738 }
739 
740 uint16_t wlan_reg_max_6ghz_chan_freq(void)
741 {
742 	return reg_max_6ghz_chan_freq();
743 }
744 
745 bool wlan_reg_is_6ghz_psc_chan_freq(uint16_t freq)
746 {
747 	return reg_is_6ghz_psc_chan_freq(freq);
748 }
749 
750 #endif /* CONFIG_BAND_6GHZ */
751 
752 uint16_t
753 wlan_reg_get_band_channel_list(struct wlan_objmgr_pdev *pdev,
754 			       uint8_t band_mask,
755 			       struct regulatory_channel *channel_list)
756 {
757 	if (!pdev) {
758 		reg_err("pdev object is NULL");
759 		return 0;
760 	}
761 
762 	return reg_get_band_channel_list(pdev, band_mask, channel_list);
763 }
764 
765 qdf_freq_t wlan_reg_chan_band_to_freq(struct wlan_objmgr_pdev *pdev,
766 				      uint8_t chan, uint8_t band_mask)
767 {
768 	return reg_chan_band_to_freq(pdev, chan, band_mask);
769 }
770 
771 bool wlan_reg_is_49ghz_freq(qdf_freq_t freq)
772 {
773 	return reg_is_49ghz_freq(freq);
774 }
775 
776 uint8_t wlan_reg_ch_num(uint32_t ch_enum)
777 {
778 	return reg_ch_num(ch_enum);
779 }
780 
781 qdf_freq_t wlan_reg_ch_to_freq(uint32_t ch_enum)
782 {
783 	return reg_ch_to_freq(ch_enum);
784 }
785 
786 #ifdef CONFIG_CHAN_NUM_API
787 bool wlan_reg_is_same_band_channels(uint8_t chan_num1, uint8_t chan_num2)
788 {
789 	return reg_is_same_band_channels(chan_num1, chan_num2);
790 }
791 
792 bool wlan_reg_is_channel_valid_5g_sbs(uint8_t curchan, uint8_t newchan)
793 {
794 	return reg_is_channel_valid_5g_sbs(curchan, newchan);
795 }
796 
797 enum band_info wlan_reg_chan_to_band(uint8_t chan_num)
798 {
799 	return reg_chan_to_band(chan_num);
800 }
801 
802 qdf_export_symbol(wlan_reg_chan_to_band);
803 
804 /**
805  * wlan_reg_get_chan_enum() - Get channel enum for given channel number
806  * @chan_num: Channel number
807  *
808  * Return: Channel enum
809  */
810 enum channel_enum wlan_reg_get_chan_enum(uint8_t chan_num)
811 {
812 	return reg_get_chan_enum(chan_num);
813 }
814 #endif /* CONFIG_CHAN_NUM_API */
815 
816 bool wlan_reg_is_regdmn_en302502_applicable(struct wlan_objmgr_pdev *pdev)
817 {
818 	return reg_is_regdmn_en302502_applicable(pdev);
819 }
820 
821 /**
822  * wlan_reg_modify_pdev_chan_range() - Compute current channel list for the
823  * modified regcap.
824  * @pdev: pointer to struct wlan_objmgr_pdev
825  *
826  */
827 QDF_STATUS wlan_reg_modify_pdev_chan_range(struct wlan_objmgr_pdev *pdev)
828 {
829 	return reg_modify_pdev_chan_range(pdev);
830 }
831 
832 #ifdef DISABLE_UNII_SHARED_BANDS
833 QDF_STATUS wlan_reg_disable_chan_coex(struct wlan_objmgr_pdev *pdev,
834 				      uint8_t unii_5g_bitmap)
835 {
836 	return reg_disable_chan_coex(pdev, unii_5g_bitmap);
837 }
838 #endif
839 
840 #ifdef CONFIG_CHAN_FREQ_API
841 bool wlan_reg_is_same_band_freqs(qdf_freq_t freq1, qdf_freq_t freq2)
842 {
843 	return reg_is_same_band_freqs(freq1, freq2);
844 }
845 
846 bool wlan_reg_is_frequency_valid_5g_sbs(qdf_freq_t curfreq, qdf_freq_t newfreq)
847 {
848 	return reg_is_frequency_valid_5g_sbs(curfreq, newfreq);
849 }
850 
851 enum channel_enum wlan_reg_get_chan_enum_for_freq(qdf_freq_t freq)
852 {
853 	return reg_get_chan_enum_for_freq(freq);
854 }
855 
856 bool wlan_reg_is_etsi13_srd_chan_for_freq(struct wlan_objmgr_pdev *pdev,
857 					  qdf_freq_t freq)
858 {
859 	return reg_is_etsi13_srd_chan_for_freq(pdev, freq);
860 }
861 
862 bool wlan_reg_is_dsrc_freq(qdf_freq_t freq)
863 {
864 	return reg_is_dsrc_freq(freq);
865 }
866 
867 void wlan_reg_update_nol_ch_for_freq(struct wlan_objmgr_pdev *pdev,
868 				     uint16_t *chan_freq_list,
869 				     uint8_t num_ch,
870 				     bool nol_ch)
871 {
872 	reg_update_nol_ch_for_freq(pdev, chan_freq_list, num_ch, nol_ch);
873 }
874 
875 void wlan_reg_update_nol_history_ch_for_freq(struct wlan_objmgr_pdev *pdev,
876 					     uint16_t *ch_list,
877 					     uint8_t num_ch,
878 					     bool nol_history_ch)
879 {
880 	reg_update_nol_history_ch_for_freq(pdev,
881 					   ch_list,
882 					   num_ch,
883 					   nol_history_ch);
884 }
885 
886 bool wlan_reg_is_dfs_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
887 {
888 	return reg_is_dfs_for_freq(pdev, freq);
889 }
890 
891 bool wlan_reg_is_passive_or_disable_for_freq(struct wlan_objmgr_pdev *pdev,
892 					     qdf_freq_t freq)
893 {
894 	return reg_is_passive_or_disable_for_freq(pdev, freq);
895 }
896 
897 bool wlan_reg_is_disable_for_freq(struct wlan_objmgr_pdev *pdev,
898 				  qdf_freq_t freq)
899 {
900 	return reg_is_disable_for_freq(pdev, freq);
901 }
902 
903 QDF_STATUS
904 wlan_reg_get_channel_list_with_power_for_freq(struct wlan_objmgr_pdev *pdev,
905 					      struct channel_power *ch_list,
906 					      uint8_t *num_chan)
907 {
908 	return reg_get_channel_list_with_power_for_freq(pdev,
909 							ch_list,
910 							num_chan);
911 }
912 
913 bool
914 wlan_reg_chan_has_dfs_attribute_for_freq(struct wlan_objmgr_pdev *pdev,
915 					 qdf_freq_t freq)
916 {
917 	return reg_chan_has_dfs_attribute_for_freq(pdev, freq);
918 }
919 
920 enum channel_state
921 wlan_reg_get_5g_bonded_channel_state_for_freq(struct wlan_objmgr_pdev *pdev,
922 					      qdf_freq_t freq,
923 					      enum phy_ch_width bw)
924 {
925 	return reg_get_5g_bonded_channel_state_for_freq(pdev, freq, bw);
926 }
927 
928 enum channel_state
929 wlan_reg_get_2g_bonded_channel_state_for_freq(struct wlan_objmgr_pdev *pdev,
930 					      qdf_freq_t freq,
931 					      qdf_freq_t sec_ch_freq,
932 					      enum phy_ch_width bw)
933 {
934 	return reg_get_2g_bonded_channel_state_for_freq(pdev,
935 							freq,
936 							sec_ch_freq,
937 							bw);
938 }
939 
940 void wlan_reg_set_channel_params_for_freq(struct wlan_objmgr_pdev *pdev,
941 					  qdf_freq_t freq,
942 					  qdf_freq_t sec_ch_2g_freq,
943 					  struct ch_params *ch_params)
944 {
945 	reg_set_channel_params_for_freq(pdev, freq, sec_ch_2g_freq, ch_params);
946 }
947 
948 enum channel_state
949 wlan_reg_get_channel_state_for_freq(struct wlan_objmgr_pdev *pdev,
950 				    qdf_freq_t freq)
951 {
952 	return reg_get_channel_state_for_freq(pdev, freq);
953 }
954 
955 uint8_t wlan_reg_get_channel_reg_power_for_freq(struct wlan_objmgr_pdev *pdev,
956 						qdf_freq_t freq)
957 {
958 	return reg_get_channel_reg_power_for_freq(pdev, freq);
959 }
960 
961 enum reg_wifi_band wlan_reg_freq_to_band(qdf_freq_t freq)
962 {
963 	return reg_freq_to_band(freq);
964 }
965 qdf_export_symbol(wlan_reg_freq_to_band);
966 
967 qdf_freq_t wlan_reg_min_chan_freq(void)
968 {
969 	return reg_min_chan_freq();
970 }
971 
972 qdf_freq_t wlan_reg_max_chan_freq(void)
973 {
974 	return reg_max_chan_freq();
975 }
976 
977 void wlan_reg_freq_width_to_chan_op_class(struct wlan_objmgr_pdev *pdev,
978 					  qdf_freq_t freq,
979 					  uint16_t chan_width,
980 					  bool global_tbl_lookup,
981 					  uint16_t behav_limit,
982 					  uint8_t *op_class,
983 					  uint8_t *chan_num)
984 {
985 	return reg_freq_width_to_chan_op_class(pdev, freq, chan_width,
986 					       global_tbl_lookup,
987 					       behav_limit,
988 					       op_class,
989 					       chan_num);
990 }
991 
992 void wlan_reg_freq_to_chan_op_class(struct wlan_objmgr_pdev *pdev,
993 				    qdf_freq_t freq,
994 				    bool global_tbl_lookup,
995 				    uint16_t behav_limit,
996 				    uint8_t *op_class,
997 				    uint8_t *chan_num)
998 {
999 	return reg_freq_to_chan_op_class(pdev, freq,
1000 					 global_tbl_lookup,
1001 					 behav_limit,
1002 					 op_class,
1003 					 chan_num);
1004 }
1005 
1006 enum channel_state
1007 wlan_reg_get_5g_bonded_channel_and_state_for_freq(struct wlan_objmgr_pdev *pdev,
1008 						  uint16_t freq,
1009 						  enum phy_ch_width bw,
1010 						  const
1011 						  struct bonded_channel_freq
1012 						  **bonded_chan_ptr_ptr)
1013 {
1014 	/*
1015 	 * Get channel frequencies and state from regulatory
1016 	 */
1017 	return reg_get_5g_bonded_channel_for_freq(pdev, freq, bw,
1018 						  bonded_chan_ptr_ptr);
1019 }
1020 
1021 qdf_export_symbol(wlan_reg_get_5g_bonded_channel_and_state_for_freq);
1022 
1023 #endif /* CONFIG CHAN FREQ API */
1024 
1025 uint16_t wlan_reg_get_op_class_width(struct wlan_objmgr_pdev *pdev,
1026 				     uint8_t op_class,
1027 				     bool global_tbl_lookup)
1028 {
1029 	return reg_get_op_class_width(pdev, op_class,
1030 				      global_tbl_lookup);
1031 }
1032 
1033 bool wlan_reg_is_6ghz_op_class(struct wlan_objmgr_pdev *pdev,
1034 			       uint8_t op_class)
1035 {
1036 	return reg_is_6ghz_op_class(pdev, op_class);
1037 }
1038 
1039 bool wlan_reg_is_6ghz_supported(struct wlan_objmgr_pdev *pdev)
1040 {
1041 	return reg_is_6ghz_supported(pdev);
1042 }
1043 
1044 uint16_t wlan_reg_chan_opclass_to_freq(uint8_t chan,
1045 				       uint8_t op_class,
1046 				       bool global_tbl_lookup)
1047 {
1048 	if (!chan || !op_class)
1049 		return 0;
1050 
1051 	return reg_chan_opclass_to_freq(chan, op_class, global_tbl_lookup);
1052 }
1053