1 /* 2 * Copyright (c) 2017-2021 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 /** 46 * wlan_reg_read_default_country() - Read the default country for the regdomain 47 * @country: pointer to the country code. 48 * 49 * Return: None 50 */ 51 QDF_STATUS wlan_reg_read_default_country(struct wlan_objmgr_psoc *psoc, 52 uint8_t *country) 53 { 54 /* 55 * Get the default country information 56 */ 57 return reg_read_default_country(psoc, country); 58 } 59 60 QDF_STATUS wlan_reg_read_current_country(struct wlan_objmgr_psoc *psoc, 61 uint8_t *country) 62 { 63 /* 64 * Get the current country information 65 */ 66 return reg_read_current_country(psoc, country); 67 } 68 69 QDF_STATUS wlan_reg_get_max_5g_bw_from_country_code(uint16_t cc, 70 uint16_t *max_bw_5g) 71 { 72 /* 73 * Get the max 5G bandwidth from country code 74 */ 75 return reg_get_max_5g_bw_from_country_code(cc, max_bw_5g); 76 } 77 78 QDF_STATUS wlan_reg_get_max_5g_bw_from_regdomain(uint16_t regdmn, 79 uint16_t *max_bw_5g) 80 { 81 /* 82 * Get the max 5G bandwidth from regdomain pair value 83 */ 84 return reg_get_max_5g_bw_from_regdomain(regdmn, max_bw_5g); 85 } 86 87 #ifdef CONFIG_REG_CLIENT 88 QDF_STATUS 89 wlan_reg_get_6g_power_type_for_ctry(uint8_t *ap_ctry, uint8_t *sta_ctry, 90 enum reg_6g_ap_type *pwr_type_6g, 91 bool *ctry_code_match) 92 { 93 return reg_get_6g_power_type_for_ctry(ap_ctry, sta_ctry, pwr_type_6g, 94 ctry_code_match); 95 } 96 #endif 97 98 /** 99 * wlan_reg_get_dfs_region () - Get the current dfs region 100 * @dfs_reg: pointer to dfs region 101 * 102 * Return: Status 103 */ 104 QDF_STATUS wlan_reg_get_dfs_region(struct wlan_objmgr_pdev *pdev, 105 enum dfs_reg *dfs_reg) 106 { 107 /* 108 * Get the current dfs region 109 */ 110 reg_get_current_dfs_region(pdev, dfs_reg); 111 112 return QDF_STATUS_SUCCESS; 113 } 114 115 QDF_STATUS wlan_reg_get_current_chan_list(struct wlan_objmgr_pdev *pdev, 116 struct regulatory_channel *chan_list) 117 { 118 return reg_get_current_chan_list(pdev, chan_list); 119 } 120 121 qdf_export_symbol(wlan_reg_get_current_chan_list); 122 123 #ifdef CONFIG_REG_CLIENT 124 QDF_STATUS wlan_reg_get_secondary_current_chan_list( 125 struct wlan_objmgr_pdev *pdev, 126 struct regulatory_channel *chan_list) 127 { 128 return reg_get_secondary_current_chan_list(pdev, chan_list); 129 } 130 #endif 131 132 #if defined(CONFIG_AFC_SUPPORT) && defined(CONFIG_BAND_6GHZ) 133 QDF_STATUS wlan_reg_get_6g_ap_master_chan_list(struct wlan_objmgr_pdev *pdev, 134 enum reg_6g_ap_type ap_pwr_type, 135 struct regulatory_channel *chan_list) 136 { 137 return reg_get_6g_ap_master_chan_list(pdev, ap_pwr_type, chan_list); 138 } 139 140 qdf_export_symbol(wlan_reg_get_6g_ap_master_chan_list); 141 142 QDF_STATUS wlan_reg_get_6g_afc_chan_list(struct wlan_objmgr_pdev *pdev, 143 struct regulatory_channel *chan_list) 144 { 145 return reg_get_6g_afc_chan_list(pdev, chan_list); 146 } 147 148 qdf_export_symbol(wlan_reg_get_6g_afc_chan_list); 149 150 QDF_STATUS 151 wlan_reg_get_6g_afc_mas_chan_list(struct wlan_objmgr_pdev *pdev, 152 struct regulatory_channel *chan_list) 153 { 154 return reg_get_6g_afc_mas_chan_list(pdev, chan_list); 155 } 156 157 qdf_export_symbol(wlan_reg_get_6g_afc_mas_chan_list); 158 159 QDF_STATUS wlan_reg_psd_2_eirp(struct wlan_objmgr_pdev *pdev, 160 int16_t psd, 161 uint16_t ch_bw, 162 int16_t *eirp) 163 { 164 return reg_psd_2_eirp(pdev, psd, ch_bw, eirp); 165 } 166 167 qdf_export_symbol(wlan_reg_psd_2_eirp); 168 #endif 169 170 /** 171 * wlan_reg_get_bw_value() - give bandwidth value 172 * bw: bandwidth enum 173 * 174 * Return: uint16_t 175 */ 176 uint16_t wlan_reg_get_bw_value(enum phy_ch_width bw) 177 { 178 return reg_get_bw_value(bw); 179 } 180 181 qdf_export_symbol(wlan_reg_get_bw_value); 182 183 /** 184 * wlan_reg_set_dfs_region () - Get the current dfs region 185 * @dfs_reg: pointer to dfs region 186 * 187 * Return: None 188 */ 189 void wlan_reg_set_dfs_region(struct wlan_objmgr_pdev *pdev, 190 enum dfs_reg dfs_reg) 191 { 192 reg_set_dfs_region(pdev, dfs_reg); 193 } 194 195 QDF_STATUS wlan_reg_get_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr, 196 const uint8_t *country_alpha2, enum country_src source) 197 { 198 199 return reg_get_domain_from_country_code(reg_domain_ptr, 200 country_alpha2, source); 201 } 202 203 204 uint16_t wlan_reg_dmn_get_opclass_from_channel(uint8_t *country, 205 uint8_t channel, 206 uint8_t offset) 207 { 208 return reg_dmn_get_opclass_from_channel(country, channel, 209 offset); 210 } 211 212 uint8_t wlan_reg_get_band_cap_from_op_class(const uint8_t *country, 213 uint8_t num_of_opclass, 214 const uint8_t *opclass) 215 { 216 return reg_get_band_cap_from_op_class(country, 217 num_of_opclass, opclass); 218 } 219 220 uint8_t wlan_reg_get_opclass_from_freq_width(uint8_t *country, 221 qdf_freq_t freq, 222 uint16_t ch_width, 223 uint16_t behav_limit) 224 { 225 return reg_dmn_get_opclass_from_freq_width(country, freq, ch_width, 226 behav_limit); 227 } 228 229 void wlan_reg_dmn_print_channels_in_opclass(uint8_t *country, 230 uint8_t opclass) 231 { 232 reg_dmn_print_channels_in_opclass(country, opclass); 233 } 234 235 uint16_t wlan_reg_dmn_get_chanwidth_from_opclass(uint8_t *country, 236 uint8_t channel, 237 uint8_t opclass) 238 { 239 return reg_dmn_get_chanwidth_from_opclass(country, channel, 240 opclass); 241 } 242 243 uint16_t wlan_reg_dmn_get_chanwidth_from_opclass_auto(uint8_t *country, 244 uint8_t channel, 245 uint8_t opclass) 246 { 247 return reg_dmn_get_chanwidth_from_opclass_auto(country, channel, 248 opclass); 249 } 250 251 uint16_t wlan_reg_dmn_set_curr_opclasses(uint8_t num_classes, 252 uint8_t *class) 253 { 254 return reg_dmn_set_curr_opclasses(num_classes, class); 255 } 256 257 uint16_t wlan_reg_dmn_get_curr_opclasses(uint8_t *num_classes, 258 uint8_t *class) 259 { 260 return reg_dmn_get_curr_opclasses(num_classes, class); 261 } 262 263 QDF_STATUS 264 wlan_reg_get_opclass_details(struct wlan_objmgr_pdev *pdev, 265 struct regdmn_ap_cap_opclass_t *reg_ap_cap, 266 uint8_t *n_opclasses, 267 uint8_t max_supp_op_class, 268 bool global_tbl_lookup) 269 { 270 return reg_get_opclass_details(pdev, reg_ap_cap, n_opclasses, 271 max_supp_op_class, 272 global_tbl_lookup); 273 } 274 275 enum country_src wlan_reg_get_cc_and_src(struct wlan_objmgr_psoc *psoc, 276 uint8_t *alpha) 277 { 278 return reg_get_cc_and_src(psoc, alpha); 279 } 280 281 QDF_STATUS wlan_regulatory_init(void) 282 { 283 QDF_STATUS status; 284 285 status = wlan_objmgr_register_psoc_create_handler( 286 WLAN_UMAC_COMP_REGULATORY, 287 wlan_regulatory_psoc_obj_created_notification, NULL); 288 if (status != QDF_STATUS_SUCCESS) { 289 reg_err("failed to register reg psoc obj create handler"); 290 return status; 291 } 292 293 status = wlan_objmgr_register_psoc_destroy_handler( 294 WLAN_UMAC_COMP_REGULATORY, 295 wlan_regulatory_psoc_obj_destroyed_notification, NULL); 296 if (status != QDF_STATUS_SUCCESS) { 297 reg_err("failed to register reg psoc obj create handler"); 298 goto unreg_psoc_create; 299 } 300 301 status = wlan_objmgr_register_pdev_create_handler( 302 WLAN_UMAC_COMP_REGULATORY, 303 wlan_regulatory_pdev_obj_created_notification, NULL); 304 if (status != QDF_STATUS_SUCCESS) { 305 reg_err("failed to register reg psoc obj create handler"); 306 goto unreg_psoc_destroy; 307 } 308 309 status = wlan_objmgr_register_pdev_destroy_handler( 310 WLAN_UMAC_COMP_REGULATORY, 311 wlan_regulatory_pdev_obj_destroyed_notification, NULL); 312 if (status != QDF_STATUS_SUCCESS) { 313 reg_err("failed to register reg psoc obj create handler"); 314 goto unreg_pdev_create; 315 } 316 channel_map = channel_map_global; 317 reg_debug("regulatory handlers registered with obj mgr"); 318 319 return status; 320 321 unreg_pdev_create: 322 status = wlan_objmgr_unregister_pdev_create_handler( 323 WLAN_UMAC_COMP_REGULATORY, 324 wlan_regulatory_pdev_obj_created_notification, 325 NULL); 326 327 unreg_psoc_destroy: 328 status = wlan_objmgr_unregister_psoc_destroy_handler( 329 WLAN_UMAC_COMP_REGULATORY, 330 wlan_regulatory_psoc_obj_destroyed_notification, 331 NULL); 332 333 unreg_psoc_create: 334 status = wlan_objmgr_unregister_psoc_create_handler( 335 WLAN_UMAC_COMP_REGULATORY, 336 wlan_regulatory_psoc_obj_created_notification, 337 NULL); 338 339 return QDF_STATUS_E_FAILURE; 340 } 341 342 QDF_STATUS wlan_regulatory_deinit(void) 343 { 344 QDF_STATUS status, ret_status = QDF_STATUS_SUCCESS; 345 346 status = wlan_objmgr_unregister_pdev_destroy_handler( 347 WLAN_UMAC_COMP_REGULATORY, 348 wlan_regulatory_pdev_obj_destroyed_notification, NULL); 349 if (status != QDF_STATUS_SUCCESS) { 350 reg_err("failed to unregister reg pdev obj destroy handler"); 351 ret_status = status; 352 } 353 354 status = wlan_objmgr_unregister_pdev_create_handler( 355 WLAN_UMAC_COMP_REGULATORY, 356 wlan_regulatory_pdev_obj_created_notification, NULL); 357 if (status != QDF_STATUS_SUCCESS) { 358 reg_err("failed to unregister reg pdev obj create handler"); 359 ret_status = status; 360 } 361 362 status = wlan_objmgr_unregister_psoc_destroy_handler( 363 WLAN_UMAC_COMP_REGULATORY, 364 wlan_regulatory_psoc_obj_destroyed_notification, NULL); 365 if (status != QDF_STATUS_SUCCESS) { 366 reg_err("failed to unregister reg psoc obj destroy handler"); 367 ret_status = status; 368 } 369 370 status = wlan_objmgr_unregister_psoc_create_handler( 371 WLAN_UMAC_COMP_REGULATORY, 372 wlan_regulatory_psoc_obj_created_notification, NULL); 373 if (status != QDF_STATUS_SUCCESS) { 374 reg_err("failed to unregister reg psoc obj create handler"); 375 ret_status = status; 376 } 377 378 reg_debug("deregistered callbacks with obj mgr"); 379 380 return ret_status; 381 } 382 383 #ifdef CONFIG_BAND_6GHZ 384 static void 385 regulatory_assign_register_master_ext_handler(struct wlan_objmgr_psoc *psoc, 386 struct wlan_lmac_if_reg_tx_ops *tx_ops) 387 { 388 if (tx_ops->register_master_ext_handler) 389 tx_ops->register_master_ext_handler(psoc, NULL); 390 } 391 392 static void 393 regulatory_assign_unregister_master_ext_handler(struct wlan_objmgr_psoc *psoc, 394 struct wlan_lmac_if_reg_tx_ops *tx_ops) 395 { 396 if (tx_ops->unregister_master_ext_handler) 397 tx_ops->unregister_master_ext_handler(psoc, NULL); 398 } 399 400 #ifdef CONFIG_AFC_SUPPORT 401 static void regulatory_assign_register_afc_event_handler( 402 struct wlan_objmgr_psoc *psoc, 403 struct wlan_lmac_if_reg_tx_ops *tx_ops) 404 { 405 if (tx_ops->register_afc_event_handler) 406 tx_ops->register_afc_event_handler(psoc, NULL); 407 } 408 409 static void regulatory_assign_unregister_afc_event_handler( 410 struct wlan_objmgr_psoc *psoc, 411 struct wlan_lmac_if_reg_tx_ops *tx_ops) 412 { 413 if (tx_ops->unregister_afc_event_handler) 414 tx_ops->unregister_afc_event_handler(psoc, NULL); 415 } 416 #else 417 static void regulatory_assign_register_afc_event_handler( 418 struct wlan_objmgr_psoc *psoc, 419 struct wlan_lmac_if_reg_tx_ops *tx_ops) 420 { 421 } 422 423 static void regulatory_assign_unregister_afc_event_handler( 424 struct wlan_objmgr_psoc *psoc, 425 struct wlan_lmac_if_reg_tx_ops *tx_ops) 426 { 427 } 428 #endif 429 #else 430 static inline void 431 regulatory_assign_register_master_ext_handler(struct wlan_objmgr_psoc *psoc, 432 struct wlan_lmac_if_reg_tx_ops *tx_ops) 433 { 434 } 435 436 static inline void 437 regulatory_assign_unregister_master_ext_handler(struct wlan_objmgr_psoc *psoc, 438 struct wlan_lmac_if_reg_tx_ops *tx_ops) 439 { 440 } 441 442 static void 443 regulatory_assign_register_afc_event_handler(struct wlan_objmgr_psoc *psoc, 444 struct wlan_lmac_if_reg_tx_ops *tx_ops) 445 { 446 } 447 448 static void 449 regulatory_assign_unregister_afc_event_handler(struct wlan_objmgr_psoc *psoc, 450 struct wlan_lmac_if_reg_tx_ops *tx_ops) 451 { 452 } 453 #endif 454 455 QDF_STATUS regulatory_psoc_open(struct wlan_objmgr_psoc *psoc) 456 { 457 struct wlan_lmac_if_reg_tx_ops *tx_ops; 458 459 tx_ops = reg_get_psoc_tx_ops(psoc); 460 if (tx_ops->register_master_handler) 461 tx_ops->register_master_handler(psoc, NULL); 462 regulatory_assign_register_master_ext_handler(psoc, tx_ops); 463 regulatory_assign_register_afc_event_handler(psoc, tx_ops); 464 if (tx_ops->register_11d_new_cc_handler) 465 tx_ops->register_11d_new_cc_handler(psoc, NULL); 466 if (tx_ops->register_ch_avoid_event_handler) 467 tx_ops->register_ch_avoid_event_handler(psoc, NULL); 468 469 return QDF_STATUS_SUCCESS; 470 } 471 472 QDF_STATUS regulatory_psoc_close(struct wlan_objmgr_psoc *psoc) 473 { 474 struct wlan_lmac_if_reg_tx_ops *tx_ops; 475 476 tx_ops = reg_get_psoc_tx_ops(psoc); 477 if (tx_ops->unregister_11d_new_cc_handler) 478 tx_ops->unregister_11d_new_cc_handler(psoc, NULL); 479 if (tx_ops->unregister_master_handler) 480 tx_ops->unregister_master_handler(psoc, NULL); 481 regulatory_assign_unregister_master_ext_handler(psoc, tx_ops); 482 regulatory_assign_unregister_afc_event_handler(psoc, tx_ops); 483 if (tx_ops->unregister_ch_avoid_event_handler) 484 tx_ops->unregister_ch_avoid_event_handler(psoc, NULL); 485 486 return QDF_STATUS_SUCCESS; 487 } 488 489 QDF_STATUS regulatory_pdev_open(struct wlan_objmgr_pdev *pdev) 490 { 491 struct wlan_objmgr_psoc *parent_psoc; 492 struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; 493 494 pdev_priv_obj = reg_get_pdev_obj(pdev); 495 496 if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) { 497 reg_err("reg pdev private obj is NULL"); 498 return QDF_STATUS_E_FAILURE; 499 } 500 501 pdev_priv_obj->pdev_opened = true; 502 503 parent_psoc = wlan_pdev_get_psoc(pdev); 504 505 reg_send_scheduler_msg_nb(parent_psoc, pdev); 506 507 return QDF_STATUS_SUCCESS; 508 } 509 510 QDF_STATUS regulatory_pdev_close(struct wlan_objmgr_pdev *pdev) 511 { 512 struct wlan_objmgr_psoc *psoc; 513 struct wlan_regulatory_psoc_priv_obj *soc_reg; 514 struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; 515 516 pdev_priv_obj = reg_get_pdev_obj(pdev); 517 if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) { 518 reg_err("reg pdev private obj is NULL"); 519 return QDF_STATUS_E_FAILURE; 520 } 521 522 pdev_priv_obj->pdev_opened = false; 523 524 psoc = wlan_pdev_get_psoc(pdev); 525 soc_reg = reg_get_psoc_obj(psoc); 526 if (!soc_reg) { 527 reg_err("reg psoc private obj is NULL"); 528 return QDF_STATUS_E_FAULT; 529 } 530 531 reg_reset_ctry_pending_hints(soc_reg); 532 533 return QDF_STATUS_SUCCESS; 534 } 535 536 uint8_t wlan_reg_freq_to_chan(struct wlan_objmgr_pdev *pdev, 537 qdf_freq_t freq) 538 { 539 return reg_freq_to_chan(pdev, freq); 540 } 541 542 qdf_export_symbol(wlan_reg_freq_to_chan); 543 544 qdf_freq_t wlan_reg_legacy_chan_to_freq(struct wlan_objmgr_pdev *pdev, 545 uint8_t chan_num) 546 { 547 return reg_legacy_chan_to_freq(pdev, chan_num); 548 } 549 550 QDF_STATUS wlan_reg_set_country(struct wlan_objmgr_pdev *pdev, 551 uint8_t *country) 552 { 553 return reg_set_country(pdev, country); 554 } 555 556 QDF_STATUS wlan_reg_set_11d_country(struct wlan_objmgr_pdev *pdev, 557 uint8_t *country) 558 { 559 return reg_set_11d_country(pdev, country); 560 } 561 562 bool wlan_reg_is_world(uint8_t *country) 563 { 564 return reg_is_world_alpha2(country); 565 } 566 567 bool wlan_reg_is_us(uint8_t *country) 568 { 569 return reg_is_us_alpha2(country); 570 } 571 572 bool wlan_reg_is_etsi(uint8_t *country) 573 { 574 return reg_is_etsi_alpha2(country); 575 } 576 577 void wlan_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc, 578 void *cbk, void *arg) 579 { 580 reg_register_chan_change_callback(psoc, (reg_chan_change_callback)cbk, 581 arg); 582 583 } 584 585 void wlan_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc, 586 void *cbk) 587 { 588 reg_unregister_chan_change_callback(psoc, 589 (reg_chan_change_callback)cbk); 590 } 591 592 bool wlan_reg_is_11d_offloaded(struct wlan_objmgr_psoc *psoc) 593 { 594 return reg_is_11d_offloaded(psoc); 595 } 596 597 bool wlan_reg_11d_enabled_on_host(struct wlan_objmgr_psoc *psoc) 598 { 599 return reg_11d_enabled_on_host(psoc); 600 } 601 602 bool wlan_reg_is_etsi13_regdmn(struct wlan_objmgr_pdev *pdev) 603 { 604 return reg_is_etsi13_regdmn(pdev); 605 } 606 607 bool wlan_reg_is_etsi13_srd_chan_allowed_master_mode(struct wlan_objmgr_pdev 608 *pdev) 609 { 610 return reg_is_etsi13_srd_chan_allowed_master_mode(pdev); 611 } 612 613 bool wlan_reg_get_fcc_constraint(struct wlan_objmgr_pdev *pdev, uint32_t freq) 614 { 615 return reg_get_fcc_constraint(pdev, freq); 616 } 617 618 QDF_STATUS wlan_reg_get_chip_mode(struct wlan_objmgr_pdev *pdev, 619 uint64_t *chip_mode) 620 { 621 struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; 622 623 pdev_priv_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev, 624 WLAN_UMAC_COMP_REGULATORY); 625 626 if (!pdev_priv_obj) { 627 reg_err("reg pdev private obj is NULL"); 628 return QDF_STATUS_E_FAULT; 629 } 630 631 *chip_mode = pdev_priv_obj->wireless_modes; 632 633 return QDF_STATUS_SUCCESS; 634 } 635 636 QDF_STATUS wlan_reg_get_phybitmap(struct wlan_objmgr_pdev *pdev, 637 uint16_t *phybitmap) 638 { 639 return reg_get_phybitmap(pdev, phybitmap); 640 } 641 642 bool wlan_reg_is_11d_scan_inprogress(struct wlan_objmgr_psoc *psoc) 643 { 644 return reg_is_11d_scan_inprogress(psoc); 645 } 646 647 QDF_STATUS wlan_reg_get_freq_range(struct wlan_objmgr_pdev *pdev, 648 qdf_freq_t *low_2g, 649 qdf_freq_t *high_2g, 650 qdf_freq_t *low_5g, 651 qdf_freq_t *high_5g) 652 { 653 struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; 654 655 pdev_priv_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev, 656 WLAN_UMAC_COMP_REGULATORY); 657 658 if (!pdev_priv_obj) { 659 reg_err("reg pdev private obj is NULL"); 660 return QDF_STATUS_E_FAULT; 661 } 662 663 if (low_2g) 664 *low_2g = pdev_priv_obj->range_2g_low; 665 666 if (high_2g) 667 *high_2g = pdev_priv_obj->range_2g_high; 668 669 if (low_5g) 670 *low_5g = pdev_priv_obj->range_5g_low; 671 672 if (high_5g) 673 *high_5g = pdev_priv_obj->range_5g_high; 674 675 return QDF_STATUS_SUCCESS; 676 } 677 678 struct wlan_lmac_if_reg_tx_ops * 679 wlan_reg_get_tx_ops(struct wlan_objmgr_psoc *psoc) 680 { 681 return reg_get_psoc_tx_ops(psoc); 682 } 683 684 qdf_export_symbol(wlan_reg_get_tx_ops); 685 686 QDF_STATUS wlan_reg_get_curr_regdomain(struct wlan_objmgr_pdev *pdev, 687 struct cur_regdmn_info *cur_regdmn) 688 { 689 return reg_get_curr_regdomain(pdev, cur_regdmn); 690 } 691 692 uint8_t wlan_reg_max_5ghz_ch_num(void) 693 { 694 return reg_max_5ghz_ch_num(); 695 } 696 697 #ifdef CONFIG_CHAN_FREQ_API 698 qdf_freq_t wlan_reg_min_24ghz_chan_freq(void) 699 { 700 return reg_min_24ghz_chan_freq(); 701 } 702 703 qdf_freq_t wlan_reg_max_24ghz_chan_freq(void) 704 { 705 return reg_max_24ghz_chan_freq(); 706 } 707 708 qdf_freq_t wlan_reg_min_5ghz_chan_freq(void) 709 { 710 return reg_min_5ghz_chan_freq(); 711 } 712 713 qdf_freq_t wlan_reg_max_5ghz_chan_freq(void) 714 { 715 return reg_max_5ghz_chan_freq(); 716 } 717 #endif /* CONFIG_CHAN_FREQ_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 bool wlan_reg_is_range_overlap_2g(qdf_freq_t low_freq, qdf_freq_t high_freq) 730 { 731 return reg_is_range_overlap_2g(low_freq, high_freq); 732 } 733 734 bool wlan_reg_is_range_overlap_5g(qdf_freq_t low_freq, qdf_freq_t high_freq) 735 { 736 return reg_is_range_overlap_5g(low_freq, high_freq); 737 } 738 739 bool wlan_reg_is_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) 740 { 741 return reg_is_freq_indoor(pdev, freq); 742 } 743 744 enum phy_ch_width 745 wlan_reg_get_next_lower_bandwidth(enum phy_ch_width ch_width) 746 { 747 return get_next_lower_bandwidth(ch_width); 748 } 749 750 #ifdef CONFIG_REG_CLIENT 751 bool wlan_reg_is_freq_indoor_in_secondary_list(struct wlan_objmgr_pdev *pdev, 752 qdf_freq_t freq) 753 { 754 return reg_is_freq_indoor_in_secondary_list(pdev, freq); 755 } 756 #endif 757 758 #ifdef CONFIG_BAND_6GHZ 759 bool wlan_reg_is_6ghz_chan_freq(uint16_t freq) 760 { 761 return reg_is_6ghz_chan_freq(freq); 762 } 763 764 #ifdef CONFIG_6G_FREQ_OVERLAP 765 bool wlan_reg_is_range_only6g(qdf_freq_t low_freq, qdf_freq_t high_freq) 766 { 767 return reg_is_range_only6g(low_freq, high_freq); 768 } 769 770 bool wlan_reg_is_range_overlap_6g(qdf_freq_t low_freq, qdf_freq_t high_freq) 771 { 772 return reg_is_range_overlap_6g(low_freq, high_freq); 773 } 774 #endif 775 776 uint16_t wlan_reg_min_6ghz_chan_freq(void) 777 { 778 return reg_min_6ghz_chan_freq(); 779 } 780 781 uint16_t wlan_reg_max_6ghz_chan_freq(void) 782 { 783 return reg_max_6ghz_chan_freq(); 784 } 785 786 bool wlan_reg_is_6ghz_psc_chan_freq(uint16_t freq) 787 { 788 return reg_is_6ghz_psc_chan_freq(freq); 789 } 790 791 bool wlan_reg_is_6g_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) 792 { 793 return reg_is_6g_freq_indoor(pdev, freq); 794 } 795 796 QDF_STATUS 797 wlan_reg_get_max_txpower_for_6g_tpe(struct wlan_objmgr_pdev *pdev, 798 qdf_freq_t freq, uint8_t bw, 799 enum reg_6g_ap_type reg_ap, 800 enum reg_6g_client_type reg_client, 801 bool is_psd, 802 uint8_t *tx_power) 803 { 804 return reg_get_max_txpower_for_6g_tpe(pdev, freq, bw, 805 reg_ap, 806 reg_client, is_psd, 807 tx_power); 808 } 809 #endif /* CONFIG_BAND_6GHZ */ 810 811 uint16_t 812 wlan_reg_get_band_channel_list(struct wlan_objmgr_pdev *pdev, 813 uint8_t band_mask, 814 struct regulatory_channel *channel_list) 815 { 816 if (!pdev) { 817 reg_err("pdev object is NULL"); 818 return 0; 819 } 820 821 return reg_get_band_channel_list(pdev, band_mask, channel_list); 822 } 823 824 #ifdef CONFIG_REG_CLIENT 825 uint16_t 826 wlan_reg_get_secondary_band_channel_list(struct wlan_objmgr_pdev *pdev, 827 uint8_t band_mask, 828 struct regulatory_channel 829 *channel_list) 830 { 831 if (!pdev) { 832 reg_err("pdev object is NULL"); 833 return 0; 834 } 835 836 return reg_get_secondary_band_channel_list(pdev, band_mask, 837 channel_list); 838 } 839 #endif 840 841 qdf_freq_t wlan_reg_chan_band_to_freq(struct wlan_objmgr_pdev *pdev, 842 uint8_t chan, uint8_t band_mask) 843 { 844 return reg_chan_band_to_freq(pdev, chan, band_mask); 845 } 846 847 qdf_export_symbol(wlan_reg_chan_band_to_freq); 848 849 #ifdef CONFIG_49GHZ_CHAN 850 bool wlan_reg_is_49ghz_freq(qdf_freq_t freq) 851 { 852 return reg_is_49ghz_freq(freq); 853 } 854 #endif /* CONFIG_49GHZ_CHAN */ 855 856 uint8_t wlan_reg_ch_num(uint32_t ch_enum) 857 { 858 return reg_ch_num(ch_enum); 859 } 860 861 qdf_freq_t wlan_reg_ch_to_freq(uint32_t ch_enum) 862 { 863 return reg_ch_to_freq(ch_enum); 864 } 865 866 bool wlan_reg_is_regdmn_en302502_applicable(struct wlan_objmgr_pdev *pdev) 867 { 868 return reg_is_regdmn_en302502_applicable(pdev); 869 } 870 871 /** 872 * wlan_reg_modify_pdev_chan_range() - Compute current channel list for the 873 * modified regcap. 874 * @pdev: pointer to struct wlan_objmgr_pdev 875 * 876 */ 877 QDF_STATUS wlan_reg_modify_pdev_chan_range(struct wlan_objmgr_pdev *pdev) 878 { 879 return reg_modify_pdev_chan_range(pdev); 880 } 881 882 QDF_STATUS wlan_reg_update_pdev_wireless_modes(struct wlan_objmgr_pdev *pdev, 883 uint32_t wireless_modes) 884 { 885 return reg_update_pdev_wireless_modes(pdev, wireless_modes); 886 } 887 #ifdef DISABLE_UNII_SHARED_BANDS 888 QDF_STATUS wlan_reg_disable_chan_coex(struct wlan_objmgr_pdev *pdev, 889 uint8_t unii_5g_bitmap) 890 { 891 return reg_disable_chan_coex(pdev, unii_5g_bitmap); 892 } 893 #endif 894 895 #ifdef CONFIG_CHAN_FREQ_API 896 bool wlan_reg_is_same_band_freqs(qdf_freq_t freq1, qdf_freq_t freq2) 897 { 898 return reg_is_same_band_freqs(freq1, freq2); 899 } 900 901 bool wlan_reg_is_frequency_valid_5g_sbs(qdf_freq_t curfreq, qdf_freq_t newfreq) 902 { 903 return reg_is_frequency_valid_5g_sbs(curfreq, newfreq); 904 } 905 906 enum channel_enum wlan_reg_get_chan_enum_for_freq(qdf_freq_t freq) 907 { 908 return reg_get_chan_enum_for_freq(freq); 909 } 910 911 bool wlan_reg_is_freq_present_in_cur_chan_list(struct wlan_objmgr_pdev *pdev, 912 qdf_freq_t freq) 913 { 914 return reg_is_freq_present_in_cur_chan_list(pdev, freq); 915 } 916 917 bool wlan_reg_is_etsi13_srd_chan_for_freq(struct wlan_objmgr_pdev *pdev, 918 qdf_freq_t freq) 919 { 920 return reg_is_etsi13_srd_chan_for_freq(pdev, freq); 921 } 922 923 bool wlan_reg_is_dsrc_freq(qdf_freq_t freq) 924 { 925 return reg_is_dsrc_freq(freq); 926 } 927 928 void wlan_reg_update_nol_ch_for_freq(struct wlan_objmgr_pdev *pdev, 929 uint16_t *chan_freq_list, 930 uint8_t num_ch, 931 bool nol_ch) 932 { 933 reg_update_nol_ch_for_freq(pdev, chan_freq_list, num_ch, nol_ch); 934 } 935 936 void wlan_reg_update_nol_history_ch_for_freq(struct wlan_objmgr_pdev *pdev, 937 uint16_t *ch_list, 938 uint8_t num_ch, 939 bool nol_history_ch) 940 { 941 reg_update_nol_history_ch_for_freq(pdev, 942 ch_list, 943 num_ch, 944 nol_history_ch); 945 } 946 947 bool wlan_reg_is_dfs_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) 948 { 949 return reg_is_dfs_for_freq(pdev, freq); 950 } 951 952 bool wlan_reg_is_passive_or_disable_for_freq(struct wlan_objmgr_pdev *pdev, 953 qdf_freq_t freq) 954 { 955 return reg_is_passive_or_disable_for_freq(pdev, freq); 956 } 957 958 bool wlan_reg_is_disable_for_freq(struct wlan_objmgr_pdev *pdev, 959 qdf_freq_t freq) 960 { 961 return reg_is_disable_for_freq(pdev, freq); 962 } 963 964 #ifdef CONFIG_REG_CLIENT 965 bool wlan_reg_is_disable_in_secondary_list_for_freq( 966 struct wlan_objmgr_pdev *pdev, 967 qdf_freq_t freq) 968 { 969 return reg_is_disable_in_secondary_list_for_freq(pdev, freq); 970 } 971 972 bool wlan_reg_is_dfs_in_secondary_list_for_freq(struct wlan_objmgr_pdev *pdev, 973 qdf_freq_t freq) 974 { 975 return reg_is_dfs_in_secondary_list_for_freq(pdev, freq); 976 } 977 #endif 978 979 bool wlan_reg_is_passive_for_freq(struct wlan_objmgr_pdev *pdev, 980 qdf_freq_t freq) 981 { 982 return reg_is_passive_for_freq(pdev, freq); 983 } 984 985 QDF_STATUS 986 wlan_reg_get_channel_list_with_power_for_freq(struct wlan_objmgr_pdev *pdev, 987 struct channel_power *ch_list, 988 uint8_t *num_chan) 989 { 990 return reg_get_channel_list_with_power_for_freq(pdev, 991 ch_list, 992 num_chan); 993 } 994 995 bool 996 wlan_reg_chan_has_dfs_attribute_for_freq(struct wlan_objmgr_pdev *pdev, 997 qdf_freq_t freq) 998 { 999 return reg_chan_has_dfs_attribute_for_freq(pdev, freq); 1000 } 1001 1002 #if defined(WLAN_FEATURE_11BE) && defined(CONFIG_REG_CLIENT) 1003 enum channel_state 1004 wlan_reg_get_5g_bonded_channel_state_for_freq(struct wlan_objmgr_pdev *pdev, 1005 qdf_freq_t freq, 1006 enum phy_ch_width bw) 1007 { 1008 if (bw == CH_WIDTH_320MHZ) { 1009 const struct bonded_channel_freq *bonded_chan_ptr_ptr = NULL; 1010 1011 return reg_get_5g_bonded_channel_for_freq(pdev, freq, bw, 1012 &bonded_chan_ptr_ptr); 1013 } 1014 return reg_get_5g_bonded_channel_state_for_freq(pdev, freq, bw); 1015 } 1016 1017 qdf_export_symbol(wlan_reg_get_5g_bonded_channel_state_for_freq); 1018 1019 #else 1020 1021 enum channel_state 1022 wlan_reg_get_5g_bonded_channel_state_for_freq(struct wlan_objmgr_pdev *pdev, 1023 qdf_freq_t freq, 1024 enum phy_ch_width bw) 1025 { 1026 return reg_get_5g_bonded_channel_state_for_freq(pdev, freq, bw); 1027 } 1028 1029 qdf_export_symbol(wlan_reg_get_5g_bonded_channel_state_for_freq); 1030 #endif 1031 1032 enum channel_state 1033 wlan_reg_get_2g_bonded_channel_state_for_freq(struct wlan_objmgr_pdev *pdev, 1034 qdf_freq_t freq, 1035 qdf_freq_t sec_ch_freq, 1036 enum phy_ch_width bw) 1037 { 1038 return reg_get_2g_bonded_channel_state_for_freq(pdev, 1039 freq, 1040 sec_ch_freq, 1041 bw); 1042 } 1043 1044 void wlan_reg_set_channel_params_for_freq(struct wlan_objmgr_pdev *pdev, 1045 qdf_freq_t freq, 1046 qdf_freq_t sec_ch_2g_freq, 1047 struct ch_params *ch_params) 1048 { 1049 reg_set_channel_params_for_freq(pdev, freq, sec_ch_2g_freq, ch_params); 1050 } 1051 1052 qdf_export_symbol(wlan_reg_set_channel_params_for_freq); 1053 1054 #ifdef WLAN_FEATURE_11BE 1055 void wlan_reg_fill_channel_list(struct wlan_objmgr_pdev *pdev, 1056 qdf_freq_t freq, 1057 qdf_freq_t sec_ch_2g_freq, 1058 enum phy_ch_width ch_width, 1059 qdf_freq_t band_center_320, 1060 struct reg_channel_list *chan_list) 1061 { 1062 reg_fill_channel_list(pdev, freq, sec_ch_2g_freq, ch_width, 1063 band_center_320, chan_list); 1064 } 1065 #endif 1066 1067 enum channel_state 1068 wlan_reg_get_channel_state_for_freq(struct wlan_objmgr_pdev *pdev, 1069 qdf_freq_t freq) 1070 { 1071 return reg_get_channel_state_for_freq(pdev, freq); 1072 } 1073 1074 #ifdef CONFIG_REG_CLIENT 1075 enum channel_state wlan_reg_get_channel_state_from_secondary_list_for_freq( 1076 struct wlan_objmgr_pdev *pdev, 1077 qdf_freq_t freq) 1078 { 1079 return reg_get_channel_state_from_secondary_list_for_freq(pdev, freq); 1080 } 1081 #endif 1082 1083 uint8_t wlan_reg_get_channel_reg_power_for_freq(struct wlan_objmgr_pdev *pdev, 1084 qdf_freq_t freq) 1085 { 1086 return reg_get_channel_reg_power_for_freq(pdev, freq); 1087 } 1088 1089 enum reg_wifi_band wlan_reg_freq_to_band(qdf_freq_t freq) 1090 { 1091 return reg_freq_to_band(freq); 1092 } 1093 qdf_export_symbol(wlan_reg_freq_to_band); 1094 1095 qdf_freq_t wlan_reg_min_chan_freq(void) 1096 { 1097 return reg_min_chan_freq(); 1098 } 1099 1100 qdf_freq_t wlan_reg_max_chan_freq(void) 1101 { 1102 return reg_max_chan_freq(); 1103 } 1104 1105 void wlan_reg_freq_width_to_chan_op_class(struct wlan_objmgr_pdev *pdev, 1106 qdf_freq_t freq, 1107 uint16_t chan_width, 1108 bool global_tbl_lookup, 1109 uint16_t behav_limit, 1110 uint8_t *op_class, 1111 uint8_t *chan_num) 1112 { 1113 return reg_freq_width_to_chan_op_class(pdev, freq, chan_width, 1114 global_tbl_lookup, 1115 behav_limit, 1116 op_class, 1117 chan_num); 1118 } 1119 1120 void wlan_reg_freq_width_to_chan_op_class_auto(struct wlan_objmgr_pdev *pdev, 1121 qdf_freq_t freq, 1122 uint16_t chan_width, 1123 bool global_tbl_lookup, 1124 uint16_t behav_limit, 1125 uint8_t *op_class, 1126 uint8_t *chan_num) 1127 { 1128 reg_freq_width_to_chan_op_class_auto(pdev, freq, chan_width, 1129 global_tbl_lookup, 1130 behav_limit, 1131 op_class, 1132 chan_num); 1133 } 1134 1135 qdf_export_symbol(wlan_reg_freq_width_to_chan_op_class_auto); 1136 1137 void wlan_reg_freq_to_chan_op_class(struct wlan_objmgr_pdev *pdev, 1138 qdf_freq_t freq, 1139 bool global_tbl_lookup, 1140 uint16_t behav_limit, 1141 uint8_t *op_class, 1142 uint8_t *chan_num) 1143 { 1144 return reg_freq_to_chan_op_class(pdev, freq, 1145 global_tbl_lookup, 1146 behav_limit, 1147 op_class, 1148 chan_num); 1149 } 1150 1151 bool wlan_reg_is_freq_in_country_opclass(struct wlan_objmgr_pdev *pdev, 1152 const uint8_t country[3], 1153 uint8_t op_class, 1154 qdf_freq_t chan_freq) 1155 { 1156 return reg_is_freq_in_country_opclass(pdev, country, 1157 op_class, chan_freq); 1158 } 1159 1160 enum channel_state 1161 wlan_reg_get_5g_bonded_channel_and_state_for_freq(struct wlan_objmgr_pdev *pdev, 1162 uint16_t freq, 1163 enum phy_ch_width bw, 1164 const 1165 struct bonded_channel_freq 1166 **bonded_chan_ptr_ptr) 1167 { 1168 /* 1169 * Get channel frequencies and state from regulatory 1170 */ 1171 return reg_get_5g_bonded_channel_for_freq(pdev, freq, bw, 1172 bonded_chan_ptr_ptr); 1173 } 1174 1175 #if defined(WLAN_FEATURE_11BE) && defined(CONFIG_REG_CLIENT) 1176 enum channel_state 1177 wlan_reg_get_bonded_channel_state_for_freq(struct wlan_objmgr_pdev *pdev, 1178 qdf_freq_t freq, 1179 enum phy_ch_width bw, 1180 qdf_freq_t sec_freq) 1181 { 1182 if (WLAN_REG_IS_24GHZ_CH_FREQ(freq)) 1183 return reg_get_2g_bonded_channel_state_for_freq(pdev, freq, 1184 sec_freq, bw); 1185 if (bw == CH_WIDTH_320MHZ) { 1186 const struct bonded_channel_freq *bonded_chan_ptr_ptr = NULL; 1187 1188 return reg_get_5g_bonded_channel_for_freq(pdev, freq, bw, 1189 &bonded_chan_ptr_ptr); 1190 } else { 1191 return reg_get_5g_bonded_channel_state_for_freq(pdev, freq, 1192 bw); 1193 } 1194 } 1195 1196 qdf_export_symbol(wlan_reg_get_5g_bonded_channel_and_state_for_freq); 1197 1198 #else 1199 enum channel_state 1200 wlan_reg_get_bonded_channel_state_for_freq(struct wlan_objmgr_pdev *pdev, 1201 qdf_freq_t freq, 1202 enum phy_ch_width bw, 1203 qdf_freq_t sec_freq) 1204 { 1205 if (WLAN_REG_IS_24GHZ_CH_FREQ(freq)) 1206 return reg_get_2g_bonded_channel_state_for_freq(pdev, freq, 1207 sec_freq, bw); 1208 else 1209 return reg_get_5g_bonded_channel_state_for_freq(pdev, freq, 1210 bw); 1211 } 1212 1213 qdf_export_symbol(wlan_reg_get_5g_bonded_channel_and_state_for_freq); 1214 #endif 1215 #endif /* CONFIG CHAN FREQ API */ 1216 1217 uint16_t wlan_reg_get_op_class_width(struct wlan_objmgr_pdev *pdev, 1218 uint8_t op_class, 1219 bool global_tbl_lookup) 1220 { 1221 return reg_get_op_class_width(pdev, op_class, 1222 global_tbl_lookup); 1223 } 1224 1225 bool wlan_reg_is_5ghz_op_class(const uint8_t *country, uint8_t op_class) 1226 { 1227 return reg_is_5ghz_op_class(country, op_class); 1228 } 1229 1230 bool wlan_reg_is_2ghz_op_class(const uint8_t *country, uint8_t op_class) 1231 { 1232 return reg_is_2ghz_op_class(country, op_class); 1233 } 1234 1235 bool wlan_reg_is_6ghz_op_class(struct wlan_objmgr_pdev *pdev, 1236 uint8_t op_class) 1237 { 1238 return reg_is_6ghz_op_class(pdev, op_class); 1239 } 1240 1241 #ifdef CONFIG_REG_CLIENT 1242 bool wlan_reg_is_6ghz_supported(struct wlan_objmgr_psoc *psoc) 1243 { 1244 return reg_is_6ghz_supported(psoc); 1245 } 1246 #endif 1247 1248 #ifdef HOST_OPCLASS_EXT 1249 qdf_freq_t 1250 wlan_reg_country_chan_opclass_to_freq(struct wlan_objmgr_pdev *pdev, 1251 const uint8_t country[3], 1252 uint8_t chan, uint8_t op_class, 1253 bool strict) 1254 { 1255 return reg_country_chan_opclass_to_freq(pdev, country, chan, op_class, 1256 strict); 1257 } 1258 #endif 1259 1260 uint16_t wlan_reg_chan_opclass_to_freq(uint8_t chan, 1261 uint8_t op_class, 1262 bool global_tbl_lookup) 1263 { 1264 if (!chan || !op_class) 1265 return 0; 1266 1267 return reg_chan_opclass_to_freq(chan, op_class, global_tbl_lookup); 1268 } 1269 1270 qdf_freq_t wlan_reg_chan_opclass_to_freq_auto(uint8_t chan, uint8_t op_class, 1271 bool global_tbl_lookup) 1272 { 1273 if (!chan || !op_class) 1274 return 0; 1275 1276 return reg_chan_opclass_to_freq_auto(chan, op_class, global_tbl_lookup); 1277 } 1278 1279 #ifdef CHECK_REG_PHYMODE 1280 enum reg_phymode wlan_reg_get_max_phymode(struct wlan_objmgr_pdev *pdev, 1281 enum reg_phymode phy_in, 1282 qdf_freq_t freq) 1283 { 1284 return reg_get_max_phymode(pdev, phy_in, freq); 1285 } 1286 #endif /* CHECK_REG_PHYMODE */ 1287 1288 #ifdef CONFIG_REG_CLIENT 1289 enum band_info wlan_reg_band_bitmap_to_band_info(uint32_t band_bitmap) 1290 { 1291 return reg_band_bitmap_to_band_info(band_bitmap); 1292 } 1293 #endif 1294 1295 #if defined(CONFIG_BAND_6GHZ) 1296 QDF_STATUS wlan_reg_get_rnr_tpe_usable(struct wlan_objmgr_pdev *pdev, 1297 bool *reg_rnr_tpe_usable) 1298 { 1299 return reg_get_rnr_tpe_usable(pdev, reg_rnr_tpe_usable); 1300 } 1301 1302 QDF_STATUS wlan_reg_get_unspecified_ap_usable(struct wlan_objmgr_pdev *pdev, 1303 bool *reg_unspecified_ap_usable) 1304 { 1305 return reg_get_unspecified_ap_usable(pdev, reg_unspecified_ap_usable); 1306 } 1307 1308 QDF_STATUS 1309 wlan_reg_get_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev, 1310 enum reg_6g_ap_type *reg_cur_6g_ap_pwr_type) 1311 { 1312 return reg_get_cur_6g_ap_pwr_type(pdev, reg_cur_6g_ap_pwr_type); 1313 } 1314 1315 QDF_STATUS 1316 wlan_reg_get_cur_6g_client_type(struct wlan_objmgr_pdev *pdev, 1317 enum reg_6g_client_type 1318 *reg_cur_6g_client_mobility_type) 1319 { 1320 return reg_get_cur_6g_client_type(pdev, 1321 reg_cur_6g_client_mobility_type); 1322 } 1323 1324 bool wlan_reg_is_6g_psd_power(struct wlan_objmgr_pdev *pdev) 1325 { 1326 return reg_is_6g_psd_power(pdev); 1327 } 1328 1329 QDF_STATUS wlan_reg_get_6g_chan_ap_power(struct wlan_objmgr_pdev *pdev, 1330 qdf_freq_t chan_freq, bool *is_psd, 1331 uint16_t *tx_power, 1332 uint16_t *eirp_psd_power) 1333 { 1334 return reg_get_6g_chan_ap_power(pdev, chan_freq, is_psd, 1335 tx_power, eirp_psd_power); 1336 } 1337 1338 qdf_export_symbol(wlan_reg_get_6g_chan_ap_power); 1339 1340 QDF_STATUS 1341 wlan_reg_get_client_power_for_connecting_ap(struct wlan_objmgr_pdev *pdev, 1342 enum reg_6g_ap_type ap_type, 1343 qdf_freq_t chan_freq, 1344 bool *is_psd, uint16_t *tx_power, 1345 uint16_t *eirp_psd_power) 1346 { 1347 return reg_get_client_power_for_connecting_ap(pdev, ap_type, chan_freq, 1348 is_psd, tx_power, 1349 eirp_psd_power); 1350 } 1351 1352 QDF_STATUS 1353 wlan_reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev *pdev, 1354 enum reg_6g_client_type client_type, 1355 qdf_freq_t chan_freq, 1356 bool *is_psd, uint16_t *tx_power, 1357 uint16_t *eirp_psd_power) 1358 { 1359 return reg_get_client_power_for_6ghz_ap(pdev, client_type, chan_freq, 1360 is_psd, tx_power, 1361 eirp_psd_power); 1362 } 1363 1364 enum reg_6g_ap_type 1365 wlan_reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev) 1366 { 1367 return reg_decide_6g_ap_pwr_type(pdev); 1368 } 1369 1370 QDF_STATUS 1371 wlan_reg_set_ap_pwr_and_update_chan_list(struct wlan_objmgr_pdev *pdev, 1372 enum reg_6g_ap_type ap_pwr_type) 1373 { 1374 return reg_set_ap_pwr_and_update_chan_list(pdev, ap_pwr_type); 1375 } 1376 1377 qdf_export_symbol(wlan_reg_set_ap_pwr_and_update_chan_list); 1378 1379 #endif /* CONFIG_BAND_6GHZ */ 1380 1381 bool wlan_reg_is_ext_tpc_supported(struct wlan_objmgr_psoc *psoc) 1382 { 1383 return reg_is_ext_tpc_supported(psoc); 1384 } 1385 1386 #ifdef CONFIG_AFC_SUPPORT 1387 bool wlan_reg_is_afc_power_event_received(struct wlan_objmgr_pdev *pdev) 1388 { 1389 return reg_is_afc_power_event_received(pdev); 1390 } 1391 1392 qdf_export_symbol(wlan_reg_is_afc_power_event_received); 1393 1394 QDF_STATUS wlan_reg_get_afc_req_id(struct wlan_objmgr_pdev *pdev, 1395 uint64_t *req_id) 1396 { 1397 return reg_get_afc_req_id(pdev, req_id); 1398 } 1399 1400 qdf_export_symbol(wlan_reg_get_afc_req_id); 1401 1402 bool wlan_reg_is_afc_expiry_event_received(struct wlan_objmgr_pdev *pdev) 1403 { 1404 return reg_is_afc_expiry_event_received(pdev); 1405 } 1406 1407 qdf_export_symbol(wlan_reg_is_afc_expiry_event_received); 1408 1409 bool wlan_reg_is_noaction_on_afc_pwr_evt(struct wlan_objmgr_pdev *pdev) 1410 { 1411 return reg_is_noaction_on_afc_pwr_evt(pdev); 1412 } 1413 #endif 1414