xref: /wlan-dirver/qca-wifi-host-cmn/umac/regulatory/dispatcher/src/wlan_reg_services_api.c (revision 8ddef7dd9a290d4a9b1efd5d3efacf51d78a1a0d)
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 <wlan_cmn.h>
29 #include <reg_services_public_struct.h>
30 #include <wlan_reg_services_api.h>
31 #include <wlan_objmgr_psoc_obj.h>
32 #include <wlan_objmgr_pdev_obj.h>
33 #include "../../core/src/reg_priv_objs.h"
34 #include "../../core/src/reg_utils.h"
35 #include "../../core/src/reg_services_common.h"
36 #include "../../core/src/reg_db.h"
37 #include "../../core/src/reg_db_parser.h"
38 #include <../../core/src/reg_build_chan_list.h>
39 #include <../../core/src/reg_opclass.h>
40 #include <../../core/src/reg_callbacks.h>
41 #include <../../core/src/reg_offload_11d_scan.h>
42 #include <wlan_objmgr_global_obj.h>
43 
44 /**
45  * wlan_reg_get_channel_list_with_power() - Provide the channel list with power
46  * @ch_list: pointer to the channel list.
47  *
48  * Return: QDF_STATUS
49  */
50 QDF_STATUS wlan_reg_get_channel_list_with_power(struct wlan_objmgr_pdev *pdev,
51 						struct channel_power *ch_list,
52 						uint8_t *num_chan)
53 {
54 	/*
55 	 * Update the channel list with channel information with power.
56 	 */
57 	return reg_get_channel_list_with_power(pdev, ch_list, num_chan);
58 }
59 
60 /**
61  * wlan_reg_read_default_country() - Read the default country for the regdomain
62  * @country: pointer to the country code.
63  *
64  * Return: None
65  */
66 QDF_STATUS wlan_reg_read_default_country(struct wlan_objmgr_psoc *psoc,
67 					 uint8_t *country)
68 {
69 	/*
70 	 * Get the default country information
71 	 */
72 	return reg_read_default_country(psoc, country);
73 }
74 
75 QDF_STATUS wlan_reg_read_current_country(struct wlan_objmgr_psoc *psoc,
76 					 uint8_t *country)
77 {
78 	/*
79 	 * Get the current country information
80 	 */
81 	return reg_read_current_country(psoc, country);
82 }
83 
84 /**
85  * wlan_reg_get_channel_state() - Get channel state from regulatory
86  * @ch: channel number.
87  *
88  * Return: channel state
89  */
90 enum channel_state wlan_reg_get_channel_state(struct wlan_objmgr_pdev *pdev,
91 					      uint32_t ch)
92 {
93 	/*
94 	 * Get channel state from regulatory
95 	 */
96 	return reg_get_channel_state(pdev, ch);
97 }
98 
99 bool
100 wlan_reg_chan_has_dfs_attribute(struct wlan_objmgr_pdev *pdev, uint32_t ch)
101 {
102 	return reg_chan_has_dfs_attribute(pdev, ch);
103 }
104 
105 /**
106  * wlan_reg_get_5g_bonded_channel_state() - Get 5G bonded channel state
107  * @ch: channel number.
108  * @bw: channel band width
109  *
110  * Return: channel state
111  */
112 enum channel_state wlan_reg_get_5g_bonded_channel_state(
113 	struct wlan_objmgr_pdev *pdev, uint8_t ch,
114 	enum phy_ch_width bw)
115 {
116 	/*
117 	 * Get channel state from regulatory
118 	 */
119 	return reg_get_5g_bonded_channel_state(pdev, ch, bw);
120 }
121 
122 /**
123  * wlan_reg_get_2g_bonded_channel_state() - Get 2G bonded channel state
124  * @ch: channel number.
125  * @bw: channel band width
126  *
127  * Return: channel state
128  */
129 enum channel_state wlan_reg_get_2g_bonded_channel_state(
130 		struct wlan_objmgr_pdev *pdev, uint8_t ch,
131 		uint8_t sec_ch, enum phy_ch_width bw)
132 {
133 	/*
134 	 * Get channel state from regulatory
135 	 */
136 	return reg_get_2g_bonded_channel_state(pdev, ch, sec_ch, bw);
137 }
138 
139 /**
140  * wlan_reg_set_channel_params() - Sets channel parameteres for given bandwidth
141  * @ch: channel number.
142  * @ch_params: pointer to the channel parameters.
143  *
144  * Return: None
145  */
146 void wlan_reg_set_channel_params(struct wlan_objmgr_pdev *pdev, uint8_t ch,
147 				 uint8_t sec_ch_2g,
148 				 struct ch_params *ch_params)
149 {
150 	/*
151 	 * Set channel parameters like center frequency for a bonded channel
152 	 * state. Also return the maximum bandwidth supported by the channel.
153 	 */
154 	reg_set_channel_params(pdev, ch, sec_ch_2g, ch_params);
155 }
156 
157 /**
158  * wlan_reg_get_dfs_region () - Get the current dfs region
159  * @dfs_reg: pointer to dfs region
160  *
161  * Return: Status
162  */
163 QDF_STATUS wlan_reg_get_dfs_region(struct wlan_objmgr_pdev *pdev,
164 			     enum dfs_reg *dfs_reg)
165 {
166 	/*
167 	 * Get the current dfs region
168 	 */
169 	reg_get_current_dfs_region(pdev, dfs_reg);
170 
171 	return QDF_STATUS_SUCCESS;
172 }
173 
174 uint32_t wlan_reg_get_channel_reg_power(struct wlan_objmgr_pdev *pdev,
175 					uint32_t chan_num)
176 {
177 	return reg_get_channel_reg_power(pdev, chan_num);
178 }
179 
180 /**
181  * wlan_reg_get_channel_freq() - get regulatory power for channel
182  * @chan_num: channel number
183  *
184  * Return: int
185  */
186 uint32_t wlan_reg_get_channel_freq(struct wlan_objmgr_pdev *pdev,
187 				   uint32_t chan_num)
188 {
189 	return reg_get_channel_freq(pdev, chan_num);
190 }
191 
192 QDF_STATUS wlan_reg_get_current_chan_list(struct wlan_objmgr_pdev *pdev,
193 		struct regulatory_channel *chan_list)
194 {
195 	return reg_get_current_chan_list(pdev, chan_list);
196 }
197 
198 /**
199  * wlan_reg_get_bw_value() - give bandwidth value
200  * bw: bandwidth enum
201  *
202  * Return: uint16_t
203  */
204 uint16_t wlan_reg_get_bw_value(enum phy_ch_width bw)
205 {
206 	return reg_get_bw_value(bw);
207 }
208 
209 /**
210  * wlan_reg_get_bonded_channel_state() - Get 2G bonded channel state
211  * @ch: channel number.
212  * @bw: channel band width
213  *
214  * Return: channel state
215  */
216 enum channel_state wlan_reg_get_bonded_channel_state(
217 	struct wlan_objmgr_pdev *pdev, uint8_t ch,
218 	enum phy_ch_width bw, uint8_t sec_ch)
219 {
220 	if (WLAN_REG_IS_24GHZ_CH(ch))
221 		return reg_get_2g_bonded_channel_state(pdev, ch,
222 						       sec_ch, bw);
223 	else
224 		return reg_get_5g_bonded_channel_state(pdev, ch,
225 						       bw);
226 }
227 
228 /**
229  * wlan_reg_set_dfs_region () - Get the current dfs region
230  * @dfs_reg: pointer to dfs region
231  *
232  * Return: None
233  */
234 void wlan_reg_set_dfs_region(struct wlan_objmgr_pdev *pdev,
235 			     enum dfs_reg dfs_reg)
236 {
237 	reg_set_dfs_region(pdev, dfs_reg);
238 }
239 
240 QDF_STATUS wlan_reg_get_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr,
241 		const uint8_t *country_alpha2, enum country_src source)
242 {
243 
244 	return reg_get_domain_from_country_code(reg_domain_ptr,
245 			country_alpha2, source);
246 }
247 
248 
249 uint16_t wlan_reg_dmn_get_opclass_from_channel(uint8_t *country,
250 					       uint8_t channel,
251 					       uint8_t offset)
252 {
253 	return reg_dmn_get_opclass_from_channel(country, channel,
254 						offset);
255 }
256 
257 uint16_t wlan_reg_dmn_get_chanwidth_from_opclass(uint8_t *country,
258 						 uint8_t channel,
259 						 uint8_t opclass)
260 {
261 	return reg_dmn_get_chanwidth_from_opclass(country, channel,
262 						  opclass);
263 }
264 
265 uint16_t wlan_reg_dmn_set_curr_opclasses(uint8_t num_classes,
266 					 uint8_t *class)
267 {
268 	return reg_dmn_set_curr_opclasses(num_classes, class);
269 }
270 
271 uint16_t wlan_reg_dmn_get_curr_opclasses(uint8_t *num_classes,
272 					 uint8_t *class)
273 {
274 	return reg_dmn_get_curr_opclasses(num_classes, class);
275 }
276 
277 QDF_STATUS wlan_regulatory_init(void)
278 {
279 	QDF_STATUS status;
280 
281 	status = wlan_objmgr_register_psoc_create_handler(
282 		WLAN_UMAC_COMP_REGULATORY,
283 		wlan_regulatory_psoc_obj_created_notification, NULL);
284 	if (status != QDF_STATUS_SUCCESS) {
285 		reg_err("failed to register reg psoc obj create handler");
286 		return status;
287 	}
288 
289 	status = wlan_objmgr_register_psoc_destroy_handler(
290 		WLAN_UMAC_COMP_REGULATORY,
291 		wlan_regulatory_psoc_obj_destroyed_notification, NULL);
292 	if (status != QDF_STATUS_SUCCESS) {
293 		reg_err("failed to register reg psoc obj create handler");
294 		goto unreg_psoc_create;
295 	}
296 
297 	status = wlan_objmgr_register_pdev_create_handler(
298 		WLAN_UMAC_COMP_REGULATORY,
299 		wlan_regulatory_pdev_obj_created_notification, NULL);
300 	if (status != QDF_STATUS_SUCCESS) {
301 		reg_err("failed to register reg psoc obj create handler");
302 		goto unreg_psoc_destroy;
303 	}
304 
305 	status = wlan_objmgr_register_pdev_destroy_handler(
306 		WLAN_UMAC_COMP_REGULATORY,
307 		wlan_regulatory_pdev_obj_destroyed_notification, NULL);
308 	if (status != QDF_STATUS_SUCCESS) {
309 		reg_err("failed to register reg psoc obj create handler");
310 		goto unreg_pdev_create;
311 	}
312 
313 	reg_debug("regulatory handlers registered with obj mgr");
314 
315 	return status;
316 
317 unreg_pdev_create:
318 	status = wlan_objmgr_unregister_pdev_create_handler(
319 		WLAN_UMAC_COMP_REGULATORY,
320 		wlan_regulatory_pdev_obj_created_notification,
321 		NULL);
322 
323 unreg_psoc_destroy:
324 	status = wlan_objmgr_unregister_psoc_destroy_handler(
325 		WLAN_UMAC_COMP_REGULATORY,
326 		wlan_regulatory_psoc_obj_destroyed_notification,
327 		NULL);
328 
329 unreg_psoc_create:
330 	status = wlan_objmgr_unregister_psoc_create_handler(
331 		WLAN_UMAC_COMP_REGULATORY,
332 		wlan_regulatory_psoc_obj_created_notification,
333 		NULL);
334 
335 	return QDF_STATUS_E_FAILURE;
336 }
337 
338 QDF_STATUS wlan_regulatory_deinit(void)
339 {
340 	QDF_STATUS status, ret_status = QDF_STATUS_SUCCESS;
341 
342 	status = wlan_objmgr_unregister_pdev_destroy_handler(
343 		WLAN_UMAC_COMP_REGULATORY,
344 		wlan_regulatory_pdev_obj_destroyed_notification, NULL);
345 	if (status != QDF_STATUS_SUCCESS) {
346 		reg_err("failed to unregister reg pdev obj destroy handler");
347 		ret_status = status;
348 	}
349 
350 	status = wlan_objmgr_unregister_pdev_create_handler(
351 		WLAN_UMAC_COMP_REGULATORY,
352 		wlan_regulatory_pdev_obj_created_notification, NULL);
353 	if (status != QDF_STATUS_SUCCESS) {
354 		reg_err("failed to unregister reg pdev obj create handler");
355 		ret_status = status;
356 	}
357 
358 	status = wlan_objmgr_unregister_psoc_destroy_handler(
359 		WLAN_UMAC_COMP_REGULATORY,
360 		wlan_regulatory_psoc_obj_destroyed_notification, NULL);
361 	if (status != QDF_STATUS_SUCCESS) {
362 		reg_err("failed to unregister reg psoc obj destroy handler");
363 		ret_status = status;
364 	}
365 
366 	status = wlan_objmgr_unregister_psoc_create_handler(
367 			WLAN_UMAC_COMP_REGULATORY,
368 			wlan_regulatory_psoc_obj_created_notification, NULL);
369 	if (status != QDF_STATUS_SUCCESS) {
370 		reg_err("failed to unregister reg psoc obj create handler");
371 		ret_status = status;
372 	}
373 
374 	reg_debug("deregistered callbacks with obj mgr");
375 
376 	return ret_status;
377 }
378 
379 QDF_STATUS regulatory_psoc_open(struct wlan_objmgr_psoc *psoc)
380 {
381 	struct wlan_lmac_if_reg_tx_ops *tx_ops;
382 
383 	tx_ops = reg_get_psoc_tx_ops(psoc);
384 	if (tx_ops->register_master_handler)
385 		tx_ops->register_master_handler(psoc, NULL);
386 	if (tx_ops->register_11d_new_cc_handler)
387 		tx_ops->register_11d_new_cc_handler(psoc, NULL);
388 	if (tx_ops->register_ch_avoid_event_handler)
389 		tx_ops->register_ch_avoid_event_handler(psoc, NULL);
390 
391 	return QDF_STATUS_SUCCESS;
392 }
393 
394 QDF_STATUS regulatory_psoc_close(struct wlan_objmgr_psoc *psoc)
395 {
396 	struct wlan_lmac_if_reg_tx_ops *tx_ops;
397 
398 	tx_ops = reg_get_psoc_tx_ops(psoc);
399 	if (tx_ops->unregister_11d_new_cc_handler)
400 		tx_ops->unregister_11d_new_cc_handler(psoc, NULL);
401 	if (tx_ops->unregister_master_handler)
402 		tx_ops->unregister_master_handler(psoc, NULL);
403 	if (tx_ops->unregister_ch_avoid_event_handler)
404 		tx_ops->unregister_ch_avoid_event_handler(psoc, NULL);
405 
406 	return QDF_STATUS_SUCCESS;
407 }
408 
409 QDF_STATUS regulatory_pdev_open(struct wlan_objmgr_pdev *pdev)
410 {
411 	struct wlan_objmgr_psoc *parent_psoc;
412 	QDF_STATUS status;
413 
414 	parent_psoc = wlan_pdev_get_psoc(pdev);
415 
416 	status = reg_send_scheduler_msg_sb(parent_psoc, pdev);
417 
418 	if (QDF_IS_STATUS_ERROR(status))
419 		reg_err("scheduler send msg failed");
420 
421 	return status;
422 }
423 
424 QDF_STATUS regulatory_pdev_close(struct wlan_objmgr_pdev *pdev)
425 {
426 	struct wlan_objmgr_psoc *psoc;
427 	struct wlan_regulatory_psoc_priv_obj *soc_reg;
428 
429 	psoc = wlan_pdev_get_psoc(pdev);
430 	soc_reg = reg_get_psoc_obj(psoc);
431 	if (!soc_reg) {
432 		reg_err("reg psoc private obj is NULL");
433 		return QDF_STATUS_E_FAULT;
434 	}
435 
436 	reg_reset_ctry_pending_hints(soc_reg);
437 
438 	return QDF_STATUS_SUCCESS;
439 }
440 
441 void wlan_reg_update_nol_ch(struct wlan_objmgr_pdev *pdev, uint8_t *ch_list,
442 		uint8_t num_ch, bool nol_ch)
443 {
444 	reg_update_nol_ch(pdev, ch_list, num_ch, nol_ch);
445 }
446 
447 void wlan_reg_update_nol_history_ch(struct wlan_objmgr_pdev *pdev,
448 				    uint8_t *ch_list, uint8_t num_ch,
449 				    bool nol_history_ch)
450 {
451 	reg_update_nol_history_ch(pdev, ch_list, num_ch, nol_history_ch);
452 }
453 
454 bool wlan_reg_is_dfs_ch(struct wlan_objmgr_pdev *pdev,
455 			uint32_t chan)
456 {
457 	return reg_is_dfs_ch(pdev, chan);
458 }
459 
460 bool wlan_reg_is_passive_or_disable_ch(struct wlan_objmgr_pdev *pdev,
461 				       uint32_t chan)
462 {
463 	return reg_is_passive_or_disable_ch(pdev, chan);
464 }
465 
466 bool wlan_reg_is_disable_ch(struct wlan_objmgr_pdev *pdev,
467 				       uint32_t chan)
468 {
469 	return reg_is_disable_ch(pdev, chan);
470 }
471 
472 uint32_t wlan_reg_freq_to_chan(struct wlan_objmgr_pdev *pdev,
473 			       uint32_t freq)
474 {
475 	return reg_freq_to_chan(pdev, freq);
476 }
477 
478 uint32_t wlan_reg_chan_to_freq(struct wlan_objmgr_pdev *pdev,
479 			       uint32_t chan_num)
480 {
481 	return reg_chan_to_freq(pdev, chan_num);
482 }
483 
484 bool wlan_reg_chan_is_49ghz(struct wlan_objmgr_pdev *pdev,
485 		uint8_t chan_num)
486 {
487 	return reg_chan_is_49ghz(pdev, chan_num);
488 }
489 
490 QDF_STATUS wlan_reg_set_country(struct wlan_objmgr_pdev *pdev,
491 				       uint8_t *country)
492 {
493 	return reg_set_country(pdev, country);
494 }
495 
496 QDF_STATUS wlan_reg_set_11d_country(struct wlan_objmgr_pdev *pdev,
497 				    uint8_t *country)
498 {
499 	return reg_set_11d_country(pdev, country);
500 }
501 
502 bool wlan_reg_is_world(uint8_t *country)
503 {
504 	return reg_is_world_alpha2(country);
505 }
506 
507 bool wlan_reg_is_us(uint8_t *country)
508 {
509 	return reg_is_us_alpha2(country);
510 }
511 
512 void wlan_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc,
513 					    void *cbk, void *arg)
514 {
515 	reg_register_chan_change_callback(psoc, (reg_chan_change_callback)cbk,
516 					  arg);
517 
518 }
519 
520 void wlan_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc,
521 					      void *cbk)
522 {
523 	reg_unregister_chan_change_callback(psoc,
524 					    (reg_chan_change_callback)cbk);
525 }
526 
527 bool wlan_reg_is_11d_offloaded(struct wlan_objmgr_psoc *psoc)
528 {
529 	return reg_is_11d_offloaded(psoc);
530 }
531 
532 bool wlan_reg_11d_enabled_on_host(struct wlan_objmgr_psoc *psoc)
533 {
534 	return reg_11d_enabled_on_host(psoc);
535 }
536 
537 bool wlan_reg_is_dsrc_chan(struct wlan_objmgr_pdev *pdev, uint8_t chan_num)
538 {
539 	return reg_is_dsrc_chan(pdev, chan_num);
540 }
541 
542 bool wlan_reg_is_etsi13_srd_chan(struct wlan_objmgr_pdev *pdev,
543 				 uint8_t chan_num)
544 {
545 	return reg_is_etsi13_srd_chan(pdev, chan_num);
546 }
547 
548 bool wlan_reg_is_etsi13_regdmn(struct wlan_objmgr_pdev *pdev)
549 {
550 	return reg_is_etsi13_regdmn(pdev);
551 }
552 
553 bool wlan_reg_is_etsi13_srd_chan_allowed_master_mode(struct wlan_objmgr_pdev
554 						     *pdev)
555 {
556 	return reg_is_etsi13_srd_chan_allowed_master_mode(pdev);
557 }
558 
559 QDF_STATUS wlan_reg_get_chip_mode(struct wlan_objmgr_pdev *pdev,
560 		uint32_t *chip_mode)
561 {
562 	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
563 
564 	pdev_priv_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev,
565 			WLAN_UMAC_COMP_REGULATORY);
566 
567 	if (NULL == pdev_priv_obj) {
568 		reg_err("reg pdev private obj is NULL");
569 		return QDF_STATUS_E_FAULT;
570 	}
571 
572 	*chip_mode = pdev_priv_obj->wireless_modes;
573 
574 	return QDF_STATUS_SUCCESS;
575 }
576 
577 bool wlan_reg_is_11d_scan_inprogress(struct wlan_objmgr_psoc *psoc)
578 {
579 	return reg_is_11d_scan_inprogress(psoc);
580 }
581 
582 QDF_STATUS wlan_reg_get_freq_range(struct wlan_objmgr_pdev *pdev,
583 		uint32_t *low_2g,
584 		uint32_t *high_2g,
585 		uint32_t *low_5g,
586 		uint32_t *high_5g)
587 {
588 	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
589 
590 	pdev_priv_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev,
591 			WLAN_UMAC_COMP_REGULATORY);
592 
593 	if (NULL == pdev_priv_obj) {
594 		reg_err("reg pdev private obj is NULL");
595 		return QDF_STATUS_E_FAULT;
596 	}
597 
598 	*low_2g = pdev_priv_obj->range_2g_low;
599 	*high_2g = pdev_priv_obj->range_2g_high;
600 	*low_5g = pdev_priv_obj->range_5g_low;
601 	*high_5g = pdev_priv_obj->range_5g_high;
602 
603 	return QDF_STATUS_SUCCESS;
604 }
605 
606 struct wlan_lmac_if_reg_tx_ops *
607 wlan_reg_get_tx_ops(struct wlan_objmgr_psoc *psoc)
608 {
609 	return reg_get_psoc_tx_ops(psoc);
610 }
611 
612 QDF_STATUS wlan_reg_get_curr_regdomain(struct wlan_objmgr_pdev *pdev,
613 		struct cur_regdmn_info *cur_regdmn)
614 {
615 	return reg_get_curr_regdomain(pdev, cur_regdmn);
616 }
617 
618 uint32_t wlan_reg_min_24ghz_ch_num(void)
619 {
620 	return reg_min_24ghz_ch_num();
621 }
622 
623 uint32_t wlan_reg_max_24ghz_ch_num(void)
624 {
625 	return reg_max_24ghz_ch_num();
626 }
627 
628 uint32_t wlan_reg_min_5ghz_ch_num(void)
629 {
630 	return reg_min_5ghz_ch_num();
631 }
632 
633 uint32_t wlan_reg_max_5ghz_ch_num(void)
634 {
635 	return reg_max_5ghz_ch_num();
636 }
637 
638 bool wlan_reg_is_24ghz_ch(uint32_t chan)
639 {
640 	return reg_is_24ghz_ch(chan);
641 }
642 
643 bool wlan_reg_is_5ghz_ch(uint32_t chan)
644 {
645 	return reg_is_5ghz_ch(chan);
646 }
647 
648 bool wlan_reg_is_24ghz_ch_freq(uint32_t freq)
649 {
650 	return reg_is_24ghz_ch_freq(freq);
651 }
652 
653 bool wlan_reg_is_5ghz_ch_freq(uint32_t freq)
654 {
655 	return reg_is_5ghz_ch_freq(freq);
656 }
657 
658 #ifndef CONFIG_LEGACY_CHAN_ENUM
659 bool wlan_reg_is_49ghz_freq(uint32_t freq)
660 {
661 	return reg_is_49ghz_freq(freq);
662 }
663 #endif
664 
665 uint32_t wlan_reg_ch_num(uint32_t ch_enum)
666 {
667 	return reg_ch_num(ch_enum);
668 }
669 
670 uint32_t wlan_reg_ch_to_freq(uint32_t ch_enum)
671 {
672 	return reg_ch_to_freq(ch_enum);
673 }
674 
675 bool wlan_reg_is_same_band_channels(uint32_t chan_num1, uint32_t chan_num2)
676 {
677 	return reg_is_same_band_channels(chan_num1, chan_num2);
678 }
679 
680 bool wlan_reg_is_channel_valid_5g_sbs(uint32_t curchan, uint32_t newchan)
681 {
682 	return reg_is_channel_valid_5g_sbs(curchan, newchan);
683 }
684 
685 enum band_info wlan_reg_chan_to_band(uint32_t chan_num)
686 {
687 	return reg_chan_to_band(chan_num);
688 }
689 
690 /**
691  * wlan_reg_get_chan_enum() - Get channel enum for given channel number
692  * @chan_num: Channel number
693  *
694  * Return: Channel enum
695  */
696 enum channel_enum wlan_reg_get_chan_enum(uint32_t chan_num)
697 {
698 	return reg_get_chan_enum(chan_num);
699 }
700