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 void wlan_reg_dmn_print_channels_in_opclass(uint8_t *country, 258 uint8_t opclass) 259 { 260 reg_dmn_print_channels_in_opclass(country, opclass); 261 } 262 263 uint16_t wlan_reg_dmn_get_chanwidth_from_opclass(uint8_t *country, 264 uint8_t channel, 265 uint8_t opclass) 266 { 267 return reg_dmn_get_chanwidth_from_opclass(country, channel, 268 opclass); 269 } 270 271 uint16_t wlan_reg_dmn_set_curr_opclasses(uint8_t num_classes, 272 uint8_t *class) 273 { 274 return reg_dmn_set_curr_opclasses(num_classes, class); 275 } 276 277 uint16_t wlan_reg_dmn_get_curr_opclasses(uint8_t *num_classes, 278 uint8_t *class) 279 { 280 return reg_dmn_get_curr_opclasses(num_classes, class); 281 } 282 283 QDF_STATUS wlan_regulatory_init(void) 284 { 285 QDF_STATUS status; 286 287 status = wlan_objmgr_register_psoc_create_handler( 288 WLAN_UMAC_COMP_REGULATORY, 289 wlan_regulatory_psoc_obj_created_notification, NULL); 290 if (status != QDF_STATUS_SUCCESS) { 291 reg_err("failed to register reg psoc obj create handler"); 292 return status; 293 } 294 295 status = wlan_objmgr_register_psoc_destroy_handler( 296 WLAN_UMAC_COMP_REGULATORY, 297 wlan_regulatory_psoc_obj_destroyed_notification, NULL); 298 if (status != QDF_STATUS_SUCCESS) { 299 reg_err("failed to register reg psoc obj create handler"); 300 goto unreg_psoc_create; 301 } 302 303 status = wlan_objmgr_register_pdev_create_handler( 304 WLAN_UMAC_COMP_REGULATORY, 305 wlan_regulatory_pdev_obj_created_notification, NULL); 306 if (status != QDF_STATUS_SUCCESS) { 307 reg_err("failed to register reg psoc obj create handler"); 308 goto unreg_psoc_destroy; 309 } 310 311 status = wlan_objmgr_register_pdev_destroy_handler( 312 WLAN_UMAC_COMP_REGULATORY, 313 wlan_regulatory_pdev_obj_destroyed_notification, NULL); 314 if (status != QDF_STATUS_SUCCESS) { 315 reg_err("failed to register reg psoc obj create handler"); 316 goto unreg_pdev_create; 317 } 318 319 reg_debug("regulatory handlers registered with obj mgr"); 320 321 return status; 322 323 unreg_pdev_create: 324 status = wlan_objmgr_unregister_pdev_create_handler( 325 WLAN_UMAC_COMP_REGULATORY, 326 wlan_regulatory_pdev_obj_created_notification, 327 NULL); 328 329 unreg_psoc_destroy: 330 status = wlan_objmgr_unregister_psoc_destroy_handler( 331 WLAN_UMAC_COMP_REGULATORY, 332 wlan_regulatory_psoc_obj_destroyed_notification, 333 NULL); 334 335 unreg_psoc_create: 336 status = wlan_objmgr_unregister_psoc_create_handler( 337 WLAN_UMAC_COMP_REGULATORY, 338 wlan_regulatory_psoc_obj_created_notification, 339 NULL); 340 341 return QDF_STATUS_E_FAILURE; 342 } 343 344 QDF_STATUS wlan_regulatory_deinit(void) 345 { 346 QDF_STATUS status, ret_status = QDF_STATUS_SUCCESS; 347 348 status = wlan_objmgr_unregister_pdev_destroy_handler( 349 WLAN_UMAC_COMP_REGULATORY, 350 wlan_regulatory_pdev_obj_destroyed_notification, NULL); 351 if (status != QDF_STATUS_SUCCESS) { 352 reg_err("failed to unregister reg pdev obj destroy handler"); 353 ret_status = status; 354 } 355 356 status = wlan_objmgr_unregister_pdev_create_handler( 357 WLAN_UMAC_COMP_REGULATORY, 358 wlan_regulatory_pdev_obj_created_notification, NULL); 359 if (status != QDF_STATUS_SUCCESS) { 360 reg_err("failed to unregister reg pdev obj create handler"); 361 ret_status = status; 362 } 363 364 status = wlan_objmgr_unregister_psoc_destroy_handler( 365 WLAN_UMAC_COMP_REGULATORY, 366 wlan_regulatory_psoc_obj_destroyed_notification, NULL); 367 if (status != QDF_STATUS_SUCCESS) { 368 reg_err("failed to unregister reg psoc obj destroy handler"); 369 ret_status = status; 370 } 371 372 status = wlan_objmgr_unregister_psoc_create_handler( 373 WLAN_UMAC_COMP_REGULATORY, 374 wlan_regulatory_psoc_obj_created_notification, NULL); 375 if (status != QDF_STATUS_SUCCESS) { 376 reg_err("failed to unregister reg psoc obj create handler"); 377 ret_status = status; 378 } 379 380 reg_debug("deregistered callbacks with obj mgr"); 381 382 return ret_status; 383 } 384 385 QDF_STATUS regulatory_psoc_open(struct wlan_objmgr_psoc *psoc) 386 { 387 struct wlan_lmac_if_reg_tx_ops *tx_ops; 388 389 tx_ops = reg_get_psoc_tx_ops(psoc); 390 if (tx_ops->register_master_handler) 391 tx_ops->register_master_handler(psoc, NULL); 392 if (tx_ops->register_11d_new_cc_handler) 393 tx_ops->register_11d_new_cc_handler(psoc, NULL); 394 if (tx_ops->register_ch_avoid_event_handler) 395 tx_ops->register_ch_avoid_event_handler(psoc, NULL); 396 397 return QDF_STATUS_SUCCESS; 398 } 399 400 QDF_STATUS regulatory_psoc_close(struct wlan_objmgr_psoc *psoc) 401 { 402 struct wlan_lmac_if_reg_tx_ops *tx_ops; 403 404 tx_ops = reg_get_psoc_tx_ops(psoc); 405 if (tx_ops->unregister_11d_new_cc_handler) 406 tx_ops->unregister_11d_new_cc_handler(psoc, NULL); 407 if (tx_ops->unregister_master_handler) 408 tx_ops->unregister_master_handler(psoc, NULL); 409 if (tx_ops->unregister_ch_avoid_event_handler) 410 tx_ops->unregister_ch_avoid_event_handler(psoc, NULL); 411 412 return QDF_STATUS_SUCCESS; 413 } 414 415 QDF_STATUS regulatory_pdev_open(struct wlan_objmgr_pdev *pdev) 416 { 417 struct wlan_objmgr_psoc *parent_psoc; 418 QDF_STATUS status; 419 420 parent_psoc = wlan_pdev_get_psoc(pdev); 421 422 status = reg_send_scheduler_msg_sb(parent_psoc, pdev); 423 424 if (QDF_IS_STATUS_ERROR(status)) 425 reg_err("scheduler send msg failed"); 426 427 return status; 428 } 429 430 QDF_STATUS regulatory_pdev_close(struct wlan_objmgr_pdev *pdev) 431 { 432 struct wlan_objmgr_psoc *psoc; 433 struct wlan_regulatory_psoc_priv_obj *soc_reg; 434 435 psoc = wlan_pdev_get_psoc(pdev); 436 soc_reg = reg_get_psoc_obj(psoc); 437 if (!soc_reg) { 438 reg_err("reg psoc private obj is NULL"); 439 return QDF_STATUS_E_FAULT; 440 } 441 442 reg_reset_ctry_pending_hints(soc_reg); 443 444 return QDF_STATUS_SUCCESS; 445 } 446 447 void wlan_reg_update_nol_ch(struct wlan_objmgr_pdev *pdev, uint8_t *ch_list, 448 uint8_t num_ch, bool nol_ch) 449 { 450 reg_update_nol_ch(pdev, ch_list, num_ch, nol_ch); 451 } 452 453 void wlan_reg_update_nol_history_ch(struct wlan_objmgr_pdev *pdev, 454 uint8_t *ch_list, uint8_t num_ch, 455 bool nol_history_ch) 456 { 457 reg_update_nol_history_ch(pdev, ch_list, num_ch, nol_history_ch); 458 } 459 460 bool wlan_reg_is_dfs_ch(struct wlan_objmgr_pdev *pdev, 461 uint32_t chan) 462 { 463 return reg_is_dfs_ch(pdev, chan); 464 } 465 466 bool wlan_reg_is_passive_or_disable_ch(struct wlan_objmgr_pdev *pdev, 467 uint32_t chan) 468 { 469 return reg_is_passive_or_disable_ch(pdev, chan); 470 } 471 472 bool wlan_reg_is_disable_ch(struct wlan_objmgr_pdev *pdev, 473 uint32_t chan) 474 { 475 return reg_is_disable_ch(pdev, chan); 476 } 477 478 uint32_t wlan_reg_freq_to_chan(struct wlan_objmgr_pdev *pdev, 479 uint32_t freq) 480 { 481 return reg_freq_to_chan(pdev, freq); 482 } 483 484 uint32_t wlan_reg_chan_to_freq(struct wlan_objmgr_pdev *pdev, 485 uint32_t chan_num) 486 { 487 return reg_chan_to_freq(pdev, chan_num); 488 } 489 490 bool wlan_reg_chan_is_49ghz(struct wlan_objmgr_pdev *pdev, 491 uint8_t chan_num) 492 { 493 return reg_chan_is_49ghz(pdev, chan_num); 494 } 495 496 QDF_STATUS wlan_reg_set_country(struct wlan_objmgr_pdev *pdev, 497 uint8_t *country) 498 { 499 return reg_set_country(pdev, country); 500 } 501 502 QDF_STATUS wlan_reg_set_11d_country(struct wlan_objmgr_pdev *pdev, 503 uint8_t *country) 504 { 505 return reg_set_11d_country(pdev, country); 506 } 507 508 bool wlan_reg_is_world(uint8_t *country) 509 { 510 return reg_is_world_alpha2(country); 511 } 512 513 bool wlan_reg_is_us(uint8_t *country) 514 { 515 return reg_is_us_alpha2(country); 516 } 517 518 void wlan_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc, 519 void *cbk, void *arg) 520 { 521 reg_register_chan_change_callback(psoc, (reg_chan_change_callback)cbk, 522 arg); 523 524 } 525 526 void wlan_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc, 527 void *cbk) 528 { 529 reg_unregister_chan_change_callback(psoc, 530 (reg_chan_change_callback)cbk); 531 } 532 533 bool wlan_reg_is_11d_offloaded(struct wlan_objmgr_psoc *psoc) 534 { 535 return reg_is_11d_offloaded(psoc); 536 } 537 538 bool wlan_reg_11d_enabled_on_host(struct wlan_objmgr_psoc *psoc) 539 { 540 return reg_11d_enabled_on_host(psoc); 541 } 542 543 bool wlan_reg_is_dsrc_chan(struct wlan_objmgr_pdev *pdev, uint8_t chan_num) 544 { 545 return reg_is_dsrc_chan(pdev, chan_num); 546 } 547 548 bool wlan_reg_is_etsi13_srd_chan(struct wlan_objmgr_pdev *pdev, 549 uint8_t chan_num) 550 { 551 return reg_is_etsi13_srd_chan(pdev, chan_num); 552 } 553 554 bool wlan_reg_is_etsi13_regdmn(struct wlan_objmgr_pdev *pdev) 555 { 556 return reg_is_etsi13_regdmn(pdev); 557 } 558 559 bool wlan_reg_is_etsi13_srd_chan_allowed_master_mode(struct wlan_objmgr_pdev 560 *pdev) 561 { 562 return reg_is_etsi13_srd_chan_allowed_master_mode(pdev); 563 } 564 565 bool wlan_reg_get_fcc_constraint(struct wlan_objmgr_pdev *pdev, uint32_t freq) 566 { 567 return reg_get_fcc_constraint(pdev, freq); 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 (!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 (!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