xref: /wlan-dirver/qca-wifi-host-cmn/umac/regulatory/dispatcher/src/wlan_reg_services_api.c (revision ad85c389289a03e320cd08dea21861f9857892fc)
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_getset.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_host_11d.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 	struct wlan_regulatory_psoc_priv_obj *soc_reg;
398 	uint8_t i;
399 
400 	tx_ops = reg_get_psoc_tx_ops(psoc);
401 	if (tx_ops->unregister_11d_new_cc_handler)
402 		tx_ops->unregister_11d_new_cc_handler(psoc, NULL);
403 	if (tx_ops->unregister_master_handler)
404 		tx_ops->unregister_master_handler(psoc, NULL);
405 	if (tx_ops->unregister_ch_avoid_event_handler)
406 		tx_ops->unregister_ch_avoid_event_handler(psoc, NULL);
407 
408 	soc_reg = reg_get_psoc_obj(psoc);
409 
410 	if (!soc_reg) {
411 		reg_err("reg psoc private obj is NULL");
412 		return QDF_STATUS_E_FAULT;
413 	}
414 	for (i = 0; i < PSOC_MAX_PHY_REG_CAP; i++)
415 		reg_reset_reg_rules(&soc_reg->mas_chan_params[i].reg_rules);
416 
417 	return QDF_STATUS_SUCCESS;
418 }
419 
420 QDF_STATUS regulatory_pdev_open(struct wlan_objmgr_pdev *pdev)
421 {
422 	struct wlan_objmgr_psoc *parent_psoc;
423 	QDF_STATUS status;
424 
425 	parent_psoc = wlan_pdev_get_psoc(pdev);
426 
427 	status = reg_send_scheduler_msg_sb(parent_psoc, pdev);
428 
429 	if (QDF_IS_STATUS_ERROR(status))
430 		reg_err("scheduler send msg failed");
431 
432 	return status;
433 }
434 
435 QDF_STATUS regulatory_pdev_close(struct wlan_objmgr_pdev *pdev)
436 {
437 	struct wlan_objmgr_psoc *psoc;
438 	struct wlan_regulatory_psoc_priv_obj *soc_reg;
439 
440 	psoc = wlan_pdev_get_psoc(pdev);
441 	soc_reg = reg_get_psoc_obj(psoc);
442 	if (!soc_reg) {
443 		reg_err("reg psoc private obj is NULL");
444 		return QDF_STATUS_E_FAULT;
445 	}
446 
447 	reg_reset_ctry_pending_hints(soc_reg);
448 
449 	return QDF_STATUS_SUCCESS;
450 }
451 
452 void wlan_reg_update_nol_ch(struct wlan_objmgr_pdev *pdev, uint8_t *ch_list,
453 		uint8_t num_ch, bool nol_ch)
454 {
455 	reg_update_nol_ch(pdev, ch_list, num_ch, nol_ch);
456 }
457 
458 void wlan_reg_update_nol_history_ch(struct wlan_objmgr_pdev *pdev,
459 				    uint8_t *ch_list, uint8_t num_ch,
460 				    bool nol_history_ch)
461 {
462 	reg_update_nol_history_ch(pdev, ch_list, num_ch, nol_history_ch);
463 }
464 
465 bool wlan_reg_is_dfs_ch(struct wlan_objmgr_pdev *pdev,
466 			uint32_t chan)
467 {
468 	return reg_is_dfs_ch(pdev, chan);
469 }
470 
471 bool wlan_reg_is_passive_or_disable_ch(struct wlan_objmgr_pdev *pdev,
472 				       uint32_t chan)
473 {
474 	return reg_is_passive_or_disable_ch(pdev, chan);
475 }
476 
477 bool wlan_reg_is_disable_ch(struct wlan_objmgr_pdev *pdev,
478 				       uint32_t chan)
479 {
480 	return reg_is_disable_ch(pdev, chan);
481 }
482 
483 uint32_t wlan_reg_freq_to_chan(struct wlan_objmgr_pdev *pdev,
484 			       uint32_t freq)
485 {
486 	return reg_freq_to_chan(pdev, freq);
487 }
488 
489 uint32_t wlan_reg_chan_to_freq(struct wlan_objmgr_pdev *pdev,
490 			       uint32_t chan_num)
491 {
492 	return reg_chan_to_freq(pdev, chan_num);
493 }
494 
495 bool wlan_reg_chan_is_49ghz(struct wlan_objmgr_pdev *pdev,
496 		uint8_t chan_num)
497 {
498 	return reg_chan_is_49ghz(pdev, chan_num);
499 }
500 
501 QDF_STATUS wlan_reg_set_country(struct wlan_objmgr_pdev *pdev,
502 				       uint8_t *country)
503 {
504 	return reg_set_country(pdev, country);
505 }
506 
507 QDF_STATUS wlan_reg_set_11d_country(struct wlan_objmgr_pdev *pdev,
508 				    uint8_t *country)
509 {
510 	return reg_set_11d_country(pdev, country);
511 }
512 
513 bool wlan_reg_is_world(uint8_t *country)
514 {
515 	return reg_is_world_alpha2(country);
516 }
517 
518 bool wlan_reg_is_us(uint8_t *country)
519 {
520 	return reg_is_us_alpha2(country);
521 }
522 
523 void wlan_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc,
524 					    void *cbk, void *arg)
525 {
526 	reg_register_chan_change_callback(psoc, (reg_chan_change_callback)cbk,
527 					  arg);
528 
529 }
530 
531 void wlan_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc,
532 					      void *cbk)
533 {
534 	reg_unregister_chan_change_callback(psoc,
535 					    (reg_chan_change_callback)cbk);
536 }
537 
538 bool wlan_reg_is_11d_offloaded(struct wlan_objmgr_psoc *psoc)
539 {
540 	return reg_is_11d_offloaded(psoc);
541 }
542 
543 bool wlan_reg_11d_enabled_on_host(struct wlan_objmgr_psoc *psoc)
544 {
545 	return reg_11d_enabled_on_host(psoc);
546 }
547 
548 bool wlan_reg_is_dsrc_chan(struct wlan_objmgr_pdev *pdev, uint8_t chan_num)
549 {
550 	return reg_is_dsrc_chan(pdev, chan_num);
551 }
552 
553 bool wlan_reg_is_etsi13_srd_chan(struct wlan_objmgr_pdev *pdev,
554 				 uint8_t chan_num)
555 {
556 	return reg_is_etsi13_srd_chan(pdev, chan_num);
557 }
558 
559 bool wlan_reg_is_etsi13_regdmn(struct wlan_objmgr_pdev *pdev)
560 {
561 	return reg_is_etsi13_regdmn(pdev);
562 }
563 
564 bool wlan_reg_is_etsi13_srd_chan_allowed_master_mode(struct wlan_objmgr_pdev
565 						     *pdev)
566 {
567 	return reg_is_etsi13_srd_chan_allowed_master_mode(pdev);
568 }
569 
570 QDF_STATUS wlan_reg_get_chip_mode(struct wlan_objmgr_pdev *pdev,
571 		uint32_t *chip_mode)
572 {
573 	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
574 
575 	pdev_priv_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev,
576 			WLAN_UMAC_COMP_REGULATORY);
577 
578 	if (NULL == pdev_priv_obj) {
579 		reg_err("reg pdev private obj is NULL");
580 		return QDF_STATUS_E_FAULT;
581 	}
582 
583 	*chip_mode = pdev_priv_obj->wireless_modes;
584 
585 	return QDF_STATUS_SUCCESS;
586 }
587 
588 bool wlan_reg_is_11d_scan_inprogress(struct wlan_objmgr_psoc *psoc)
589 {
590 	return reg_is_11d_scan_inprogress(psoc);
591 }
592 
593 QDF_STATUS wlan_reg_get_freq_range(struct wlan_objmgr_pdev *pdev,
594 		uint32_t *low_2g,
595 		uint32_t *high_2g,
596 		uint32_t *low_5g,
597 		uint32_t *high_5g)
598 {
599 	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
600 
601 	pdev_priv_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev,
602 			WLAN_UMAC_COMP_REGULATORY);
603 
604 	if (NULL == pdev_priv_obj) {
605 		reg_err("reg pdev private obj is NULL");
606 		return QDF_STATUS_E_FAULT;
607 	}
608 
609 	*low_2g = pdev_priv_obj->range_2g_low;
610 	*high_2g = pdev_priv_obj->range_2g_high;
611 	*low_5g = pdev_priv_obj->range_5g_low;
612 	*high_5g = pdev_priv_obj->range_5g_high;
613 
614 	return QDF_STATUS_SUCCESS;
615 }
616 
617 struct wlan_lmac_if_reg_tx_ops *
618 wlan_reg_get_tx_ops(struct wlan_objmgr_psoc *psoc)
619 {
620 	return reg_get_psoc_tx_ops(psoc);
621 }
622 
623 QDF_STATUS wlan_reg_get_curr_regdomain(struct wlan_objmgr_pdev *pdev,
624 		struct cur_regdmn_info *cur_regdmn)
625 {
626 	return reg_get_curr_regdomain(pdev, cur_regdmn);
627 }
628 
629 uint32_t wlan_reg_min_24ghz_ch_num(void)
630 {
631 	return reg_min_24ghz_ch_num();
632 }
633 
634 uint32_t wlan_reg_max_24ghz_ch_num(void)
635 {
636 	return reg_max_24ghz_ch_num();
637 }
638 
639 uint32_t wlan_reg_min_5ghz_ch_num(void)
640 {
641 	return reg_min_5ghz_ch_num();
642 }
643 
644 uint32_t wlan_reg_max_5ghz_ch_num(void)
645 {
646 	return reg_max_5ghz_ch_num();
647 }
648 
649 bool wlan_reg_is_24ghz_ch(uint32_t chan)
650 {
651 	return reg_is_24ghz_ch(chan);
652 }
653 
654 bool wlan_reg_is_5ghz_ch(uint32_t chan)
655 {
656 	return reg_is_5ghz_ch(chan);
657 }
658 
659 bool wlan_reg_is_24ghz_ch_freq(uint32_t freq)
660 {
661 	return reg_is_24ghz_ch_freq(freq);
662 }
663 
664 bool wlan_reg_is_5ghz_ch_freq(uint32_t freq)
665 {
666 	return reg_is_5ghz_ch_freq(freq);
667 }
668 
669 #ifndef CONFIG_LEGACY_CHAN_ENUM
670 bool wlan_reg_is_49ghz_freq(uint32_t freq)
671 {
672 	return reg_is_49ghz_freq(freq);
673 }
674 #endif
675 
676 uint32_t wlan_reg_ch_num(uint32_t ch_enum)
677 {
678 	return reg_ch_num(ch_enum);
679 }
680 
681 uint32_t wlan_reg_ch_to_freq(uint32_t ch_enum)
682 {
683 	return reg_ch_to_freq(ch_enum);
684 }
685 
686 bool wlan_reg_is_same_band_channels(uint32_t chan_num1, uint32_t chan_num2)
687 {
688 	return reg_is_same_band_channels(chan_num1, chan_num2);
689 }
690 
691 bool wlan_reg_is_channel_valid_5g_sbs(uint32_t curchan, uint32_t newchan)
692 {
693 	return reg_is_channel_valid_5g_sbs(curchan, newchan);
694 }
695 
696 enum band_info wlan_reg_chan_to_band(uint32_t chan_num)
697 {
698 	return reg_chan_to_band(chan_num);
699 }
700 
701 /**
702  * wlan_reg_get_chan_enum() - Get channel enum for given channel number
703  * @chan_num: Channel number
704  *
705  * Return: Channel enum
706  */
707 enum channel_enum wlan_reg_get_chan_enum(uint32_t chan_num)
708 {
709 	return reg_get_chan_enum(chan_num);
710 }
711