1 /* 2 * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. 4 * 5 * 6 * Permission to use, copy, modify, and/or distribute this software for 7 * any purpose with or without fee is hereby granted, provided that the 8 * above copyright notice and this permission notice appear in all 9 * copies. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 12 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 13 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 14 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 15 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 16 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 17 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 18 * PERFORMANCE OF THIS SOFTWARE. 19 */ 20 21 /** 22 * @file wlan_reg_services_api.c 23 * @brief contains regulatory service functions 24 */ 25 26 27 #include <qdf_status.h> 28 #include <qdf_types.h> 29 #include <qdf_module.h> 30 #include <wlan_cmn.h> 31 #include <reg_services_public_struct.h> 32 #include <wlan_reg_services_api.h> 33 #include <wlan_objmgr_psoc_obj.h> 34 #include <wlan_objmgr_pdev_obj.h> 35 #include "../../core/src/reg_priv_objs.h" 36 #include "../../core/src/reg_utils.h" 37 #include "../../core/src/reg_services_common.h" 38 #include "../../core/src/reg_db.h" 39 #include "../../core/src/reg_db_parser.h" 40 #include <../../core/src/reg_build_chan_list.h> 41 #include <../../core/src/reg_opclass.h> 42 #include <../../core/src/reg_callbacks.h> 43 #include <../../core/src/reg_offload_11d_scan.h> 44 #include <wlan_objmgr_global_obj.h> 45 46 /** 47 * wlan_reg_read_default_country() - Read the default country for the regdomain 48 * @country: pointer to the country code. 49 * 50 * Return: None 51 */ 52 QDF_STATUS wlan_reg_read_default_country(struct wlan_objmgr_psoc *psoc, 53 uint8_t *country) 54 { 55 /* 56 * Get the default country information 57 */ 58 return reg_read_default_country(psoc, country); 59 } 60 61 QDF_STATUS wlan_reg_read_current_country(struct wlan_objmgr_psoc *psoc, 62 uint8_t *country) 63 { 64 /* 65 * Get the current country information 66 */ 67 return reg_read_current_country(psoc, country); 68 } 69 70 QDF_STATUS wlan_reg_get_max_5g_bw_from_country_code( 71 struct wlan_objmgr_pdev *pdev, 72 uint16_t cc, 73 uint16_t *max_bw_5g) 74 { 75 /* 76 * Get the max 5G bandwidth from country code 77 */ 78 return reg_get_max_5g_bw_from_country_code(pdev, cc, max_bw_5g); 79 } 80 81 QDF_STATUS wlan_reg_get_max_5g_bw_from_regdomain( 82 struct wlan_objmgr_pdev *pdev, 83 uint16_t regdmn, 84 uint16_t *max_bw_5g) 85 { 86 /* 87 * Get the max 5G bandwidth from regdomain pair value 88 */ 89 return reg_get_max_5g_bw_from_regdomain(pdev, regdmn, max_bw_5g); 90 } 91 92 QDF_STATUS wlan_reg_get_max_bw_5G_for_fo(struct wlan_objmgr_pdev *pdev) 93 { 94 return reg_get_max_bw_5G_for_fo(pdev); 95 } 96 97 bool wlan_reg_is_regdb_offloaded(struct wlan_objmgr_psoc *psoc) 98 { 99 return reg_is_regdb_offloaded(psoc); 100 } 101 102 QDF_STATUS wlan_reg_get_pwrmode_chan_list(struct wlan_objmgr_pdev *pdev, 103 struct regulatory_channel *chan_list, 104 enum supported_6g_pwr_types 105 in_6g_pwr_mode) 106 { 107 return reg_get_pwrmode_chan_list(pdev, chan_list, in_6g_pwr_mode); 108 } 109 110 qdf_export_symbol(wlan_reg_get_pwrmode_chan_list); 111 112 #ifdef CONFIG_REG_CLIENT 113 QDF_STATUS 114 wlan_reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc, 115 struct wlan_objmgr_pdev *pdev, 116 uint8_t *ap_ctry, uint8_t *sta_ctry, 117 enum reg_6g_ap_type *pwr_type_6g, 118 bool *ctry_code_match, 119 enum reg_6g_ap_type ap_pwr_type) 120 { 121 return reg_get_6g_power_type_for_ctry(psoc, pdev, ap_ctry, sta_ctry, 122 pwr_type_6g, ctry_code_match, 123 ap_pwr_type); 124 } 125 #endif 126 127 /** 128 * wlan_reg_get_dfs_region () - Get the current dfs region 129 * @dfs_reg: pointer to dfs region 130 * 131 * Return: Status 132 */ 133 QDF_STATUS wlan_reg_get_dfs_region(struct wlan_objmgr_pdev *pdev, 134 enum dfs_reg *dfs_reg) 135 { 136 /* 137 * Get the current dfs region 138 */ 139 reg_get_current_dfs_region(pdev, dfs_reg); 140 141 return QDF_STATUS_SUCCESS; 142 } 143 144 bool wlan_reg_is_chan_disabled_and_not_nol(struct regulatory_channel *chan) 145 { 146 return reg_is_chan_disabled_and_not_nol(chan); 147 } 148 149 QDF_STATUS wlan_reg_get_current_chan_list(struct wlan_objmgr_pdev *pdev, 150 struct regulatory_channel *chan_list) 151 { 152 return reg_get_current_chan_list(pdev, chan_list); 153 } 154 155 qdf_export_symbol(wlan_reg_get_current_chan_list); 156 157 bool wlan_reg_is_freq_enabled(struct wlan_objmgr_pdev *pdev, 158 qdf_freq_t freq, 159 enum supported_6g_pwr_types in_6g_pwr_mode) 160 { 161 return reg_is_freq_enabled(pdev, freq, in_6g_pwr_mode); 162 } 163 164 bool wlan_reg_is_freq_idx_enabled(struct wlan_objmgr_pdev *pdev, 165 enum channel_enum freq_idx, 166 enum supported_6g_pwr_types in_6g_pwr_mode) 167 { 168 return reg_is_freq_idx_enabled(pdev, freq_idx, in_6g_pwr_mode); 169 } 170 171 #ifdef CONFIG_REG_CLIENT 172 QDF_STATUS wlan_reg_get_secondary_current_chan_list( 173 struct wlan_objmgr_pdev *pdev, 174 struct regulatory_channel *chan_list) 175 { 176 return reg_get_secondary_current_chan_list(pdev, chan_list); 177 } 178 #endif 179 180 #if defined(CONFIG_AFC_SUPPORT) && defined(CONFIG_BAND_6GHZ) 181 QDF_STATUS wlan_reg_get_6g_afc_chan_list(struct wlan_objmgr_pdev *pdev, 182 struct regulatory_channel *chan_list) 183 { 184 return reg_get_6g_afc_chan_list(pdev, chan_list); 185 } 186 187 qdf_export_symbol(wlan_reg_get_6g_afc_chan_list); 188 189 QDF_STATUS 190 wlan_reg_get_6g_afc_mas_chan_list(struct wlan_objmgr_pdev *pdev, 191 struct regulatory_channel *chan_list) 192 { 193 return reg_get_6g_afc_mas_chan_list(pdev, chan_list); 194 } 195 196 qdf_export_symbol(wlan_reg_get_6g_afc_mas_chan_list); 197 198 bool 199 wlan_reg_is_6ghz_freq_txable(struct wlan_objmgr_pdev *pdev, 200 qdf_freq_t freq, 201 enum supported_6g_pwr_types in_6ghz_pwr_mode) 202 { 203 return reg_is_6ghz_freq_txable(pdev, freq, in_6ghz_pwr_mode); 204 } 205 206 qdf_export_symbol(wlan_reg_is_6ghz_freq_txable); 207 #endif 208 209 /** 210 * wlan_reg_get_bw_value() - give bandwidth value 211 * bw: bandwidth enum 212 * 213 * Return: uint16_t 214 */ 215 uint16_t wlan_reg_get_bw_value(enum phy_ch_width bw) 216 { 217 return reg_get_bw_value(bw); 218 } 219 220 qdf_export_symbol(wlan_reg_get_bw_value); 221 222 /** 223 * wlan_reg_set_dfs_region () - Get the current dfs region 224 * @dfs_reg: pointer to dfs region 225 * 226 * Return: None 227 */ 228 void wlan_reg_set_dfs_region(struct wlan_objmgr_pdev *pdev, 229 enum dfs_reg dfs_reg) 230 { 231 reg_set_dfs_region(pdev, dfs_reg); 232 } 233 234 QDF_STATUS wlan_reg_get_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr, 235 const uint8_t *country_alpha2, enum country_src source) 236 { 237 238 return reg_get_domain_from_country_code(reg_domain_ptr, 239 country_alpha2, source); 240 } 241 242 243 uint16_t wlan_reg_dmn_get_opclass_from_channel(uint8_t *country, 244 uint8_t channel, 245 uint8_t offset) 246 { 247 return reg_dmn_get_opclass_from_channel(country, channel, 248 offset); 249 } 250 251 uint8_t wlan_reg_get_band_cap_from_op_class(const uint8_t *country, 252 uint8_t num_of_opclass, 253 const uint8_t *opclass) 254 { 255 return reg_get_band_cap_from_op_class(country, 256 num_of_opclass, opclass); 257 } 258 259 uint8_t wlan_reg_get_opclass_from_freq_width(uint8_t *country, 260 qdf_freq_t freq, 261 uint16_t ch_width, 262 uint16_t behav_limit) 263 { 264 return reg_dmn_get_opclass_from_freq_width(country, freq, ch_width, 265 behav_limit); 266 } 267 268 void wlan_reg_dmn_print_channels_in_opclass(uint8_t *country, 269 uint8_t opclass) 270 { 271 reg_dmn_print_channels_in_opclass(country, opclass); 272 } 273 274 uint16_t wlan_reg_dmn_get_chanwidth_from_opclass(uint8_t *country, 275 uint8_t channel, 276 uint8_t opclass) 277 { 278 return reg_dmn_get_chanwidth_from_opclass(country, channel, 279 opclass); 280 } 281 282 uint16_t wlan_reg_dmn_get_chanwidth_from_opclass_auto(uint8_t *country, 283 uint8_t channel, 284 uint8_t opclass) 285 { 286 return reg_dmn_get_chanwidth_from_opclass_auto(country, channel, 287 opclass); 288 } 289 290 uint16_t wlan_reg_dmn_set_curr_opclasses(uint8_t num_classes, 291 uint8_t *class) 292 { 293 return reg_dmn_set_curr_opclasses(num_classes, class); 294 } 295 296 uint16_t wlan_reg_dmn_get_curr_opclasses(uint8_t *num_classes, 297 uint8_t *class) 298 { 299 return reg_dmn_get_curr_opclasses(num_classes, class); 300 } 301 302 QDF_STATUS 303 wlan_reg_get_opclass_details(struct wlan_objmgr_pdev *pdev, 304 struct regdmn_ap_cap_opclass_t *reg_ap_cap, 305 uint8_t *n_opclasses, 306 uint8_t max_supp_op_class, 307 bool global_tbl_lookup) 308 { 309 return reg_get_opclass_details(pdev, reg_ap_cap, n_opclasses, 310 max_supp_op_class, 311 global_tbl_lookup); 312 } 313 314 QDF_STATUS 315 wlan_reg_get_opclass_for_cur_hwmode(struct wlan_objmgr_pdev *pdev, 316 struct regdmn_ap_cap_opclass_t *reg_ap_cap, 317 uint8_t *n_opclasses, 318 uint8_t max_supp_op_class, 319 bool global_tbl_lookup, 320 enum phy_ch_width max_chwidth, 321 bool is_80p80_supp) 322 { 323 return reg_get_opclass_for_cur_hwmode(pdev, reg_ap_cap, n_opclasses, 324 max_supp_op_class, 325 global_tbl_lookup, 326 max_chwidth, 327 is_80p80_supp); 328 } 329 330 enum country_src wlan_reg_get_cc_and_src(struct wlan_objmgr_psoc *psoc, 331 uint8_t *alpha) 332 { 333 return reg_get_cc_and_src(psoc, alpha); 334 } 335 336 QDF_STATUS wlan_regulatory_init(void) 337 { 338 QDF_STATUS status; 339 340 status = wlan_objmgr_register_psoc_create_handler( 341 WLAN_UMAC_COMP_REGULATORY, 342 wlan_regulatory_psoc_obj_created_notification, NULL); 343 if (status != QDF_STATUS_SUCCESS) { 344 reg_err("failed to register reg psoc obj create handler"); 345 return status; 346 } 347 348 status = wlan_objmgr_register_psoc_destroy_handler( 349 WLAN_UMAC_COMP_REGULATORY, 350 wlan_regulatory_psoc_obj_destroyed_notification, NULL); 351 if (status != QDF_STATUS_SUCCESS) { 352 reg_err("failed to register reg psoc obj create handler"); 353 goto unreg_psoc_create; 354 } 355 356 status = wlan_objmgr_register_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 register reg psoc obj create handler"); 361 goto unreg_psoc_destroy; 362 } 363 364 status = wlan_objmgr_register_pdev_destroy_handler( 365 WLAN_UMAC_COMP_REGULATORY, 366 wlan_regulatory_pdev_obj_destroyed_notification, NULL); 367 if (status != QDF_STATUS_SUCCESS) { 368 reg_err("failed to register reg psoc obj create handler"); 369 goto unreg_pdev_create; 370 } 371 channel_map = channel_map_global; 372 reg_debug("regulatory handlers registered with obj mgr"); 373 374 return status; 375 376 unreg_pdev_create: 377 status = wlan_objmgr_unregister_pdev_create_handler( 378 WLAN_UMAC_COMP_REGULATORY, 379 wlan_regulatory_pdev_obj_created_notification, 380 NULL); 381 382 unreg_psoc_destroy: 383 status = wlan_objmgr_unregister_psoc_destroy_handler( 384 WLAN_UMAC_COMP_REGULATORY, 385 wlan_regulatory_psoc_obj_destroyed_notification, 386 NULL); 387 388 unreg_psoc_create: 389 status = wlan_objmgr_unregister_psoc_create_handler( 390 WLAN_UMAC_COMP_REGULATORY, 391 wlan_regulatory_psoc_obj_created_notification, 392 NULL); 393 394 return QDF_STATUS_E_FAILURE; 395 } 396 397 QDF_STATUS wlan_regulatory_deinit(void) 398 { 399 QDF_STATUS status, ret_status = QDF_STATUS_SUCCESS; 400 401 status = wlan_objmgr_unregister_pdev_destroy_handler( 402 WLAN_UMAC_COMP_REGULATORY, 403 wlan_regulatory_pdev_obj_destroyed_notification, NULL); 404 if (status != QDF_STATUS_SUCCESS) { 405 reg_err("failed to unregister reg pdev obj destroy handler"); 406 ret_status = status; 407 } 408 409 status = wlan_objmgr_unregister_pdev_create_handler( 410 WLAN_UMAC_COMP_REGULATORY, 411 wlan_regulatory_pdev_obj_created_notification, NULL); 412 if (status != QDF_STATUS_SUCCESS) { 413 reg_err("failed to unregister reg pdev obj create handler"); 414 ret_status = status; 415 } 416 417 status = wlan_objmgr_unregister_psoc_destroy_handler( 418 WLAN_UMAC_COMP_REGULATORY, 419 wlan_regulatory_psoc_obj_destroyed_notification, NULL); 420 if (status != QDF_STATUS_SUCCESS) { 421 reg_err("failed to unregister reg psoc obj destroy handler"); 422 ret_status = status; 423 } 424 425 status = wlan_objmgr_unregister_psoc_create_handler( 426 WLAN_UMAC_COMP_REGULATORY, 427 wlan_regulatory_psoc_obj_created_notification, NULL); 428 if (status != QDF_STATUS_SUCCESS) { 429 reg_err("failed to unregister reg psoc obj create handler"); 430 ret_status = status; 431 } 432 433 reg_debug("deregistered callbacks with obj mgr"); 434 435 return ret_status; 436 } 437 438 #ifdef CONFIG_BAND_6GHZ 439 static void 440 regulatory_assign_register_master_ext_handler(struct wlan_objmgr_psoc *psoc, 441 struct wlan_lmac_if_reg_tx_ops *tx_ops) 442 { 443 if (tx_ops->register_master_ext_handler) 444 tx_ops->register_master_ext_handler(psoc, NULL); 445 } 446 447 static void 448 regulatory_assign_unregister_master_ext_handler(struct wlan_objmgr_psoc *psoc, 449 struct wlan_lmac_if_reg_tx_ops *tx_ops) 450 { 451 if (tx_ops->unregister_master_ext_handler) 452 tx_ops->unregister_master_ext_handler(psoc, NULL); 453 } 454 455 QDF_STATUS wlan_reg_get_6g_ap_master_chan_list( 456 struct wlan_objmgr_pdev *pdev, 457 enum reg_6g_ap_type ap_pwr_type, 458 struct regulatory_channel *chan_list) 459 { 460 return reg_get_6g_ap_master_chan_list(pdev, ap_pwr_type, chan_list); 461 } 462 463 #ifdef CONFIG_REG_CLIENT 464 const char *wlan_reg_get_power_string(enum reg_6g_ap_type power_type) 465 { 466 return reg_get_power_string(power_type); 467 } 468 #endif 469 470 qdf_export_symbol(wlan_reg_get_6g_ap_master_chan_list); 471 472 #ifdef CONFIG_AFC_SUPPORT 473 static void regulatory_assign_register_afc_event_handler( 474 struct wlan_objmgr_psoc *psoc, 475 struct wlan_lmac_if_reg_tx_ops *tx_ops) 476 { 477 if (tx_ops->register_afc_event_handler) 478 tx_ops->register_afc_event_handler(psoc, NULL); 479 } 480 481 static void regulatory_assign_unregister_afc_event_handler( 482 struct wlan_objmgr_psoc *psoc, 483 struct wlan_lmac_if_reg_tx_ops *tx_ops) 484 { 485 if (tx_ops->unregister_afc_event_handler) 486 tx_ops->unregister_afc_event_handler(psoc, NULL); 487 } 488 #else 489 static void regulatory_assign_register_afc_event_handler( 490 struct wlan_objmgr_psoc *psoc, 491 struct wlan_lmac_if_reg_tx_ops *tx_ops) 492 { 493 } 494 495 static void regulatory_assign_unregister_afc_event_handler( 496 struct wlan_objmgr_psoc *psoc, 497 struct wlan_lmac_if_reg_tx_ops *tx_ops) 498 { 499 } 500 #endif 501 #else 502 static inline void 503 regulatory_assign_register_master_ext_handler(struct wlan_objmgr_psoc *psoc, 504 struct wlan_lmac_if_reg_tx_ops *tx_ops) 505 { 506 } 507 508 static inline void 509 regulatory_assign_unregister_master_ext_handler(struct wlan_objmgr_psoc *psoc, 510 struct wlan_lmac_if_reg_tx_ops *tx_ops) 511 { 512 } 513 514 static void 515 regulatory_assign_register_afc_event_handler(struct wlan_objmgr_psoc *psoc, 516 struct wlan_lmac_if_reg_tx_ops *tx_ops) 517 { 518 } 519 520 static void 521 regulatory_assign_unregister_afc_event_handler(struct wlan_objmgr_psoc *psoc, 522 struct wlan_lmac_if_reg_tx_ops *tx_ops) 523 { 524 } 525 #endif 526 527 QDF_STATUS regulatory_psoc_open(struct wlan_objmgr_psoc *psoc) 528 { 529 struct wlan_lmac_if_reg_tx_ops *tx_ops; 530 531 tx_ops = reg_get_psoc_tx_ops(psoc); 532 if (tx_ops->register_master_handler) 533 tx_ops->register_master_handler(psoc, NULL); 534 regulatory_assign_register_master_ext_handler(psoc, tx_ops); 535 regulatory_assign_register_afc_event_handler(psoc, tx_ops); 536 if (tx_ops->register_11d_new_cc_handler) 537 tx_ops->register_11d_new_cc_handler(psoc, NULL); 538 if (tx_ops->register_ch_avoid_event_handler) 539 tx_ops->register_ch_avoid_event_handler(psoc, NULL); 540 541 return QDF_STATUS_SUCCESS; 542 } 543 544 QDF_STATUS regulatory_psoc_close(struct wlan_objmgr_psoc *psoc) 545 { 546 struct wlan_lmac_if_reg_tx_ops *tx_ops; 547 548 tx_ops = reg_get_psoc_tx_ops(psoc); 549 if (tx_ops->unregister_11d_new_cc_handler) 550 tx_ops->unregister_11d_new_cc_handler(psoc, NULL); 551 if (tx_ops->unregister_master_handler) 552 tx_ops->unregister_master_handler(psoc, NULL); 553 regulatory_assign_unregister_master_ext_handler(psoc, tx_ops); 554 regulatory_assign_unregister_afc_event_handler(psoc, tx_ops); 555 if (tx_ops->unregister_ch_avoid_event_handler) 556 tx_ops->unregister_ch_avoid_event_handler(psoc, NULL); 557 558 return QDF_STATUS_SUCCESS; 559 } 560 561 #ifdef CONFIG_REG_CLIENT 562 /** 563 * reg_is_cntry_set_pending() - Check if country set is pending 564 * @pdev: Pointer to pdev object. 565 * @psoc: Pointer to psoc object. 566 */ 567 static bool reg_is_cntry_set_pending(struct wlan_objmgr_pdev *pdev, 568 struct wlan_objmgr_psoc *psoc) 569 { 570 struct wlan_regulatory_psoc_priv_obj *soc_reg; 571 struct wlan_lmac_if_reg_tx_ops *tx_ops; 572 uint8_t phy_id; 573 574 soc_reg = reg_get_psoc_obj(psoc); 575 576 if (!IS_VALID_PSOC_REG_OBJ(soc_reg)) { 577 reg_err("psoc reg component is NULL"); 578 return false; 579 } 580 581 tx_ops = reg_get_psoc_tx_ops(psoc); 582 583 if (tx_ops->get_phy_id_from_pdev_id) 584 tx_ops->get_phy_id_from_pdev_id( 585 psoc, 586 wlan_objmgr_pdev_get_pdev_id(pdev), 587 &phy_id); 588 else 589 phy_id = wlan_objmgr_pdev_get_pdev_id(pdev); 590 591 return (soc_reg->new_user_ctry_pending[phy_id] || 592 soc_reg->new_init_ctry_pending[phy_id] || 593 soc_reg->new_11d_ctry_pending[phy_id] || 594 soc_reg->world_country_pending[phy_id]); 595 } 596 #else 597 static inline bool reg_is_cntry_set_pending(struct wlan_objmgr_pdev *pdev, 598 struct wlan_objmgr_psoc *psoc) 599 { 600 return false; 601 } 602 #endif 603 604 QDF_STATUS regulatory_pdev_open(struct wlan_objmgr_pdev *pdev) 605 { 606 struct wlan_objmgr_psoc *parent_psoc; 607 struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; 608 609 pdev_priv_obj = reg_get_pdev_obj(pdev); 610 611 if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) { 612 reg_err("reg pdev private obj is NULL"); 613 return QDF_STATUS_E_FAILURE; 614 } 615 616 pdev_priv_obj->pdev_opened = true; 617 618 parent_psoc = wlan_pdev_get_psoc(pdev); 619 620 if (reg_is_cntry_set_pending(pdev, parent_psoc)) 621 return QDF_STATUS_SUCCESS; 622 623 reg_send_scheduler_msg_nb(parent_psoc, pdev); 624 625 return QDF_STATUS_SUCCESS; 626 } 627 628 QDF_STATUS regulatory_pdev_close(struct wlan_objmgr_pdev *pdev) 629 { 630 struct wlan_objmgr_psoc *psoc; 631 struct wlan_regulatory_psoc_priv_obj *soc_reg; 632 struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; 633 634 pdev_priv_obj = reg_get_pdev_obj(pdev); 635 if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) { 636 reg_err("reg pdev private obj is NULL"); 637 return QDF_STATUS_E_FAILURE; 638 } 639 640 pdev_priv_obj->pdev_opened = false; 641 642 psoc = wlan_pdev_get_psoc(pdev); 643 soc_reg = reg_get_psoc_obj(psoc); 644 if (!soc_reg) { 645 reg_err("reg psoc private obj is NULL"); 646 return QDF_STATUS_E_FAULT; 647 } 648 649 reg_reset_ctry_pending_hints(soc_reg); 650 651 return QDF_STATUS_SUCCESS; 652 } 653 654 uint8_t wlan_reg_freq_to_chan(struct wlan_objmgr_pdev *pdev, 655 qdf_freq_t freq) 656 { 657 return reg_freq_to_chan(pdev, freq); 658 } 659 660 qdf_export_symbol(wlan_reg_freq_to_chan); 661 662 qdf_freq_t wlan_reg_legacy_chan_to_freq(struct wlan_objmgr_pdev *pdev, 663 uint8_t chan_num) 664 { 665 return reg_legacy_chan_to_freq(pdev, chan_num); 666 } 667 668 QDF_STATUS wlan_reg_set_country(struct wlan_objmgr_pdev *pdev, 669 uint8_t *country) 670 { 671 return reg_set_country(pdev, country); 672 } 673 674 QDF_STATUS wlan_reg_set_11d_country(struct wlan_objmgr_pdev *pdev, 675 uint8_t *country) 676 { 677 return reg_set_11d_country(pdev, country); 678 } 679 680 bool wlan_reg_is_world(uint8_t *country) 681 { 682 return reg_is_world_alpha2(country); 683 } 684 685 bool wlan_reg_is_us(uint8_t *country) 686 { 687 return reg_is_us_alpha2(country); 688 } 689 690 bool wlan_reg_is_etsi(uint8_t *country) 691 { 692 return reg_is_etsi_alpha2(country); 693 } 694 695 bool wlan_reg_ctry_support_vlp(uint8_t *country) 696 { 697 return reg_ctry_support_vlp(country); 698 } 699 700 void wlan_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc, 701 void *cbk, void *arg) 702 { 703 reg_register_chan_change_callback(psoc, (reg_chan_change_callback)cbk, 704 arg); 705 706 } 707 708 void wlan_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc, 709 void *cbk) 710 { 711 reg_unregister_chan_change_callback(psoc, 712 (reg_chan_change_callback)cbk); 713 } 714 715 void wlan_reg_register_ctry_change_callback(struct wlan_objmgr_psoc *psoc, 716 void *cbk) 717 { 718 reg_register_ctry_change_callback(psoc, (reg_ctry_change_callback)cbk); 719 } 720 721 void wlan_reg_unregister_ctry_change_callback(struct wlan_objmgr_psoc *psoc, 722 void *cbk) 723 { 724 reg_unregister_ctry_change_callback(psoc, 725 (reg_ctry_change_callback)cbk); 726 } 727 728 bool wlan_reg_is_11d_offloaded(struct wlan_objmgr_psoc *psoc) 729 { 730 return reg_is_11d_offloaded(psoc); 731 } 732 733 bool wlan_reg_11d_enabled_on_host(struct wlan_objmgr_psoc *psoc) 734 { 735 return reg_11d_enabled_on_host(psoc); 736 } 737 738 bool wlan_reg_is_etsi13_regdmn(struct wlan_objmgr_pdev *pdev) 739 { 740 return reg_is_etsi13_regdmn(pdev); 741 } 742 743 bool wlan_reg_is_etsi13_srd_chan_allowed_master_mode(struct wlan_objmgr_pdev 744 *pdev) 745 { 746 return reg_is_etsi13_srd_chan_allowed_master_mode(pdev); 747 } 748 749 bool wlan_reg_get_fcc_constraint(struct wlan_objmgr_pdev *pdev, uint32_t freq) 750 { 751 return reg_get_fcc_constraint(pdev, freq); 752 } 753 754 QDF_STATUS wlan_reg_get_chip_mode(struct wlan_objmgr_pdev *pdev, 755 uint64_t *chip_mode) 756 { 757 struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; 758 759 pdev_priv_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev, 760 WLAN_UMAC_COMP_REGULATORY); 761 762 if (!pdev_priv_obj) { 763 reg_err("reg pdev private obj is NULL"); 764 return QDF_STATUS_E_FAULT; 765 } 766 767 *chip_mode = pdev_priv_obj->wireless_modes; 768 769 return QDF_STATUS_SUCCESS; 770 } 771 772 QDF_STATUS wlan_reg_get_phybitmap(struct wlan_objmgr_pdev *pdev, 773 uint16_t *phybitmap) 774 { 775 return reg_get_phybitmap(pdev, phybitmap); 776 } 777 778 bool wlan_reg_is_11d_scan_inprogress(struct wlan_objmgr_psoc *psoc) 779 { 780 return reg_is_11d_scan_inprogress(psoc); 781 } 782 783 QDF_STATUS wlan_reg_get_freq_range(struct wlan_objmgr_pdev *pdev, 784 qdf_freq_t *low_2g, 785 qdf_freq_t *high_2g, 786 qdf_freq_t *low_5g, 787 qdf_freq_t *high_5g) 788 { 789 struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; 790 791 pdev_priv_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev, 792 WLAN_UMAC_COMP_REGULATORY); 793 794 if (!pdev_priv_obj) { 795 reg_err("reg pdev private obj is NULL"); 796 return QDF_STATUS_E_FAULT; 797 } 798 799 if (low_2g) 800 *low_2g = pdev_priv_obj->range_2g_low; 801 802 if (high_2g) 803 *high_2g = pdev_priv_obj->range_2g_high; 804 805 if (low_5g) 806 *low_5g = pdev_priv_obj->range_5g_low; 807 808 if (high_5g) 809 *high_5g = pdev_priv_obj->range_5g_high; 810 811 return QDF_STATUS_SUCCESS; 812 } 813 814 struct wlan_lmac_if_reg_tx_ops * 815 wlan_reg_get_tx_ops(struct wlan_objmgr_psoc *psoc) 816 { 817 return reg_get_psoc_tx_ops(psoc); 818 } 819 820 qdf_export_symbol(wlan_reg_get_tx_ops); 821 822 QDF_STATUS wlan_reg_get_curr_regdomain(struct wlan_objmgr_pdev *pdev, 823 struct cur_regdmn_info *cur_regdmn) 824 { 825 return reg_get_curr_regdomain(pdev, cur_regdmn); 826 } 827 828 uint8_t wlan_reg_max_5ghz_ch_num(void) 829 { 830 return reg_max_5ghz_ch_num(); 831 } 832 833 #ifdef CONFIG_CHAN_FREQ_API 834 qdf_freq_t wlan_reg_min_24ghz_chan_freq(void) 835 { 836 return reg_min_24ghz_chan_freq(); 837 } 838 839 qdf_freq_t wlan_reg_max_24ghz_chan_freq(void) 840 { 841 return reg_max_24ghz_chan_freq(); 842 } 843 844 qdf_freq_t wlan_reg_min_5ghz_chan_freq(void) 845 { 846 return reg_min_5ghz_chan_freq(); 847 } 848 849 qdf_freq_t wlan_reg_max_5ghz_chan_freq(void) 850 { 851 return reg_max_5ghz_chan_freq(); 852 } 853 #endif /* CONFIG_CHAN_FREQ_API */ 854 855 bool wlan_reg_is_24ghz_ch_freq(qdf_freq_t freq) 856 { 857 return reg_is_24ghz_ch_freq(freq); 858 } 859 860 bool wlan_reg_is_5ghz_ch_freq(qdf_freq_t freq) 861 { 862 return reg_is_5ghz_ch_freq(freq); 863 } 864 865 bool wlan_reg_is_range_overlap_2g(qdf_freq_t low_freq, qdf_freq_t high_freq) 866 { 867 return reg_is_range_overlap_2g(low_freq, high_freq); 868 } 869 870 bool wlan_reg_is_range_overlap_5g(qdf_freq_t low_freq, qdf_freq_t high_freq) 871 { 872 return reg_is_range_overlap_5g(low_freq, high_freq); 873 } 874 875 bool wlan_reg_is_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) 876 { 877 return reg_is_freq_indoor(pdev, freq); 878 } 879 880 uint16_t wlan_reg_get_min_chwidth(struct wlan_objmgr_pdev *pdev, 881 qdf_freq_t freq) 882 { 883 return reg_get_min_chwidth(pdev, freq); 884 } 885 886 uint16_t wlan_reg_get_max_chwidth(struct wlan_objmgr_pdev *pdev, 887 qdf_freq_t freq) 888 { 889 return reg_get_max_chwidth(pdev, freq); 890 } 891 892 enum phy_ch_width 893 wlan_reg_get_next_lower_bandwidth(enum phy_ch_width ch_width) 894 { 895 return get_next_lower_bandwidth(ch_width); 896 } 897 898 #ifdef CONFIG_REG_CLIENT 899 bool wlan_reg_is_freq_indoor_in_secondary_list(struct wlan_objmgr_pdev *pdev, 900 qdf_freq_t freq) 901 { 902 return reg_is_freq_indoor_in_secondary_list(pdev, freq); 903 } 904 #endif 905 906 #ifdef CONFIG_BAND_6GHZ 907 bool wlan_reg_is_6ghz_chan_freq(uint16_t freq) 908 { 909 return reg_is_6ghz_chan_freq(freq); 910 } 911 912 #ifdef CONFIG_6G_FREQ_OVERLAP 913 bool wlan_reg_is_range_only6g(qdf_freq_t low_freq, qdf_freq_t high_freq) 914 { 915 return reg_is_range_only6g(low_freq, high_freq); 916 } 917 918 bool wlan_reg_is_range_overlap_6g(qdf_freq_t low_freq, qdf_freq_t high_freq) 919 { 920 return reg_is_range_overlap_6g(low_freq, high_freq); 921 } 922 #endif 923 924 uint16_t wlan_reg_min_6ghz_chan_freq(void) 925 { 926 return reg_min_6ghz_chan_freq(); 927 } 928 929 uint16_t wlan_reg_max_6ghz_chan_freq(void) 930 { 931 return reg_max_6ghz_chan_freq(); 932 } 933 934 bool wlan_reg_is_6ghz_psc_chan_freq(uint16_t freq) 935 { 936 return reg_is_6ghz_psc_chan_freq(freq); 937 } 938 939 bool wlan_reg_is_6g_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) 940 { 941 return reg_is_6g_freq_indoor(pdev, freq); 942 } 943 944 QDF_STATUS 945 wlan_reg_get_max_txpower_for_6g_tpe(struct wlan_objmgr_pdev *pdev, 946 qdf_freq_t freq, uint8_t bw, 947 enum reg_6g_ap_type reg_ap, 948 enum reg_6g_client_type reg_client, 949 bool is_psd, 950 uint8_t *tx_power) 951 { 952 return reg_get_max_txpower_for_6g_tpe(pdev, freq, bw, 953 reg_ap, 954 reg_client, is_psd, 955 tx_power); 956 } 957 #endif /* CONFIG_BAND_6GHZ */ 958 959 uint16_t 960 wlan_reg_get_band_channel_list(struct wlan_objmgr_pdev *pdev, 961 uint8_t band_mask, 962 struct regulatory_channel *channel_list) 963 { 964 if (!pdev) { 965 reg_err("pdev object is NULL"); 966 return 0; 967 } 968 969 return reg_get_band_channel_list(pdev, band_mask, channel_list); 970 } 971 972 #ifdef CONFIG_REG_6G_PWRMODE 973 uint16_t 974 wlan_reg_get_band_channel_list_for_pwrmode(struct wlan_objmgr_pdev *pdev, 975 uint8_t band_mask, 976 struct regulatory_channel 977 *channel_list, 978 enum supported_6g_pwr_types 979 in_6g_pwr_type) 980 { 981 if (!pdev) { 982 reg_err("pdev object is NULL"); 983 return 0; 984 } 985 986 return reg_get_band_channel_list_for_pwrmode(pdev, band_mask, 987 channel_list, 988 in_6g_pwr_type); 989 } 990 #endif 991 992 #ifdef CONFIG_REG_CLIENT 993 uint16_t 994 wlan_reg_get_secondary_band_channel_list(struct wlan_objmgr_pdev *pdev, 995 uint8_t band_mask, 996 struct regulatory_channel 997 *channel_list) 998 { 999 if (!pdev) { 1000 reg_err("pdev object is NULL"); 1001 return 0; 1002 } 1003 1004 return reg_get_secondary_band_channel_list(pdev, band_mask, 1005 channel_list); 1006 } 1007 #endif 1008 1009 qdf_freq_t wlan_reg_chan_band_to_freq(struct wlan_objmgr_pdev *pdev, 1010 uint8_t chan, uint8_t band_mask) 1011 { 1012 return reg_chan_band_to_freq(pdev, chan, band_mask); 1013 } 1014 1015 qdf_export_symbol(wlan_reg_chan_band_to_freq); 1016 1017 #ifdef CONFIG_49GHZ_CHAN 1018 bool wlan_reg_is_49ghz_freq(qdf_freq_t freq) 1019 { 1020 return reg_is_49ghz_freq(freq); 1021 } 1022 #endif /* CONFIG_49GHZ_CHAN */ 1023 1024 uint8_t wlan_reg_ch_num(uint32_t ch_enum) 1025 { 1026 return reg_ch_num(ch_enum); 1027 } 1028 1029 qdf_freq_t wlan_reg_ch_to_freq(uint32_t ch_enum) 1030 { 1031 return reg_ch_to_freq(ch_enum); 1032 } 1033 1034 #ifdef WLAN_REG_PARTIAL_OFFLOAD 1035 bool wlan_reg_is_regdmn_en302502_applicable(struct wlan_objmgr_pdev *pdev) 1036 { 1037 return reg_is_regdmn_en302502_applicable(pdev); 1038 } 1039 #endif 1040 1041 /** 1042 * wlan_reg_modify_pdev_chan_range() - Compute current channel list for the 1043 * modified regcap. 1044 * @pdev: pointer to struct wlan_objmgr_pdev 1045 * 1046 */ 1047 QDF_STATUS wlan_reg_modify_pdev_chan_range(struct wlan_objmgr_pdev *pdev) 1048 { 1049 return reg_modify_pdev_chan_range(pdev); 1050 } 1051 1052 QDF_STATUS wlan_reg_update_pdev_wireless_modes(struct wlan_objmgr_pdev *pdev, 1053 uint64_t wireless_modes) 1054 { 1055 return reg_update_pdev_wireless_modes(pdev, wireless_modes); 1056 } 1057 #ifdef DISABLE_UNII_SHARED_BANDS 1058 QDF_STATUS wlan_reg_disable_chan_coex(struct wlan_objmgr_pdev *pdev, 1059 uint8_t unii_5g_bitmap) 1060 { 1061 return reg_disable_chan_coex(pdev, unii_5g_bitmap); 1062 } 1063 #endif 1064 1065 #ifdef CONFIG_CHAN_FREQ_API 1066 bool wlan_reg_is_same_band_freqs(qdf_freq_t freq1, qdf_freq_t freq2) 1067 { 1068 return reg_is_same_band_freqs(freq1, freq2); 1069 } 1070 1071 enum channel_enum wlan_reg_get_chan_enum_for_freq(qdf_freq_t freq) 1072 { 1073 return reg_get_chan_enum_for_freq(freq); 1074 } 1075 1076 bool wlan_reg_is_freq_present_in_cur_chan_list(struct wlan_objmgr_pdev *pdev, 1077 qdf_freq_t freq) 1078 { 1079 return reg_is_freq_present_in_cur_chan_list(pdev, freq); 1080 } 1081 1082 bool wlan_reg_is_etsi13_srd_chan_for_freq(struct wlan_objmgr_pdev *pdev, 1083 qdf_freq_t freq) 1084 { 1085 return reg_is_etsi13_srd_chan_for_freq(pdev, freq); 1086 } 1087 1088 bool wlan_reg_is_dsrc_freq(qdf_freq_t freq) 1089 { 1090 return reg_is_dsrc_freq(freq); 1091 } 1092 1093 void wlan_reg_update_nol_ch_for_freq(struct wlan_objmgr_pdev *pdev, 1094 uint16_t *chan_freq_list, 1095 uint8_t num_ch, 1096 bool nol_ch) 1097 { 1098 reg_update_nol_ch_for_freq(pdev, chan_freq_list, num_ch, nol_ch); 1099 } 1100 1101 void wlan_reg_update_nol_history_ch_for_freq(struct wlan_objmgr_pdev *pdev, 1102 uint16_t *ch_list, 1103 uint8_t num_ch, 1104 bool nol_history_ch) 1105 { 1106 reg_update_nol_history_ch_for_freq(pdev, 1107 ch_list, 1108 num_ch, 1109 nol_history_ch); 1110 } 1111 1112 bool wlan_reg_is_dfs_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) 1113 { 1114 return reg_is_dfs_for_freq(pdev, freq); 1115 } 1116 1117 bool wlan_reg_is_passive_or_disable_for_pwrmode( 1118 struct wlan_objmgr_pdev *pdev, 1119 qdf_freq_t freq, 1120 enum supported_6g_pwr_types in_6g_pwr_mode) 1121 { 1122 return reg_is_passive_or_disable_for_pwrmode(pdev, freq, 1123 in_6g_pwr_mode); 1124 } 1125 1126 #ifdef CONFIG_REG_6G_PWRMODE 1127 bool wlan_reg_is_disable_for_pwrmode(struct wlan_objmgr_pdev *pdev, 1128 qdf_freq_t freq, 1129 enum supported_6g_pwr_types in_6g_pwr_mode) 1130 { 1131 return reg_is_disable_for_pwrmode(pdev, freq, in_6g_pwr_mode); 1132 } 1133 #endif 1134 1135 #ifdef CONFIG_REG_CLIENT 1136 bool wlan_reg_is_disable_in_secondary_list_for_freq( 1137 struct wlan_objmgr_pdev *pdev, 1138 qdf_freq_t freq) 1139 { 1140 return reg_is_disable_in_secondary_list_for_freq(pdev, freq); 1141 } 1142 1143 bool wlan_reg_is_enable_in_secondary_list_for_freq( 1144 struct wlan_objmgr_pdev *pdev, 1145 qdf_freq_t freq) 1146 { 1147 return reg_is_enable_in_secondary_list_for_freq(pdev, freq); 1148 } 1149 1150 bool wlan_reg_is_dfs_in_secondary_list_for_freq(struct wlan_objmgr_pdev *pdev, 1151 qdf_freq_t freq) 1152 { 1153 return reg_is_dfs_in_secondary_list_for_freq(pdev, freq); 1154 } 1155 1156 QDF_STATUS 1157 wlan_reg_get_chan_pwr_attr_from_secondary_list_for_freq( 1158 struct wlan_objmgr_pdev *pdev, qdf_freq_t freq, 1159 bool *is_psd, uint16_t *tx_power, 1160 uint16_t *psd_eirp, uint32_t *flags) 1161 { 1162 return reg_get_channel_power_attr_from_secondary_list_for_freq( 1163 pdev, freq, is_psd, tx_power, psd_eirp, flags); 1164 } 1165 1166 QDF_STATUS 1167 wlan_reg_decide_6ghz_power_within_bw_for_freq(struct wlan_objmgr_pdev *pdev, 1168 qdf_freq_t freq, 1169 enum phy_ch_width bw, 1170 bool *is_psd, 1171 uint16_t *min_tx_power, 1172 int16_t *min_psd_eirp, 1173 enum reg_6g_ap_type *power_type) 1174 { 1175 return reg_decide_6ghz_power_within_bw_for_freq(pdev, 1176 freq, 1177 bw, 1178 is_psd, 1179 min_tx_power, 1180 min_psd_eirp, 1181 power_type); 1182 } 1183 #endif 1184 1185 bool wlan_reg_is_passive_for_freq(struct wlan_objmgr_pdev *pdev, 1186 qdf_freq_t freq) 1187 { 1188 return reg_is_passive_for_freq(pdev, freq); 1189 } 1190 1191 QDF_STATUS 1192 wlan_reg_get_channel_list_with_power_for_freq(struct wlan_objmgr_pdev *pdev, 1193 struct channel_power *ch_list, 1194 uint8_t *num_chan) 1195 { 1196 return reg_get_channel_list_with_power_for_freq(pdev, 1197 ch_list, 1198 num_chan); 1199 } 1200 1201 bool 1202 wlan_reg_chan_has_dfs_attribute_for_freq(struct wlan_objmgr_pdev *pdev, 1203 qdf_freq_t freq) 1204 { 1205 return reg_chan_has_dfs_attribute_for_freq(pdev, freq); 1206 } 1207 1208 enum channel_state 1209 wlan_reg_get_5g_bonded_channel_state_for_freq(struct wlan_objmgr_pdev *pdev, 1210 qdf_freq_t freq, 1211 enum phy_ch_width bw) 1212 { 1213 struct ch_params params = {0}; 1214 1215 if (reg_is_ch_width_320(bw)) { 1216 const struct bonded_channel_freq *bonded_chan_ptr_ptr = NULL; 1217 1218 return reg_get_5g_bonded_channel_for_freq(pdev, freq, bw, 1219 &bonded_chan_ptr_ptr); 1220 } 1221 1222 params.ch_width = bw; 1223 1224 return reg_get_5g_bonded_channel_state_for_freq(pdev, freq, ¶ms); 1225 } 1226 1227 qdf_export_symbol(wlan_reg_get_5g_bonded_channel_state_for_freq); 1228 1229 1230 #ifdef CONFIG_REG_6G_PWRMODE 1231 enum channel_state 1232 wlan_reg_get_5g_bonded_channel_state_for_pwrmode(struct wlan_objmgr_pdev *pdev, 1233 qdf_freq_t freq, 1234 struct ch_params *ch_params, 1235 enum supported_6g_pwr_types 1236 in_6g_pwr_type) 1237 { 1238 enum phy_ch_width bw; 1239 1240 if (!ch_params) { 1241 reg_err_rl("Invalid ch_params"); 1242 return CHANNEL_STATE_INVALID; 1243 } 1244 bw = ch_params->ch_width; 1245 1246 if (reg_is_ch_width_320(bw)) { 1247 const struct bonded_channel_freq *bonded_ch_ptr_ptr = NULL; 1248 uint16_t in_punc_bitmap = reg_fetch_punc_bitmap(ch_params); 1249 1250 return reg_get_5g_bonded_channel_for_pwrmode(pdev, freq, bw, 1251 &bonded_ch_ptr_ptr, 1252 in_6g_pwr_type, 1253 in_punc_bitmap); 1254 } 1255 1256 return reg_get_5g_bonded_channel_state_for_pwrmode(pdev, freq, 1257 ch_params, 1258 in_6g_pwr_type); 1259 } 1260 #else 1261 enum channel_state 1262 wlan_reg_get_5g_bonded_channel_state_for_pwrmode(struct wlan_objmgr_pdev *pdev, 1263 qdf_freq_t freq, 1264 struct ch_params *ch_params, 1265 enum supported_6g_pwr_types 1266 in_6g_pwr_type) 1267 { 1268 enum phy_ch_width bw; 1269 1270 if (!ch_params) { 1271 reg_err_rl("Invalid ch_params"); 1272 return CHANNEL_STATE_INVALID; 1273 } 1274 bw = ch_params->ch_width; 1275 1276 if (reg_is_ch_width_320(bw)) { 1277 const struct bonded_channel_freq *bonded_ch_ptr_ptr = NULL; 1278 1279 return reg_get_5g_bonded_channel_for_freq(pdev, freq, bw, 1280 &bonded_ch_ptr_ptr); 1281 } 1282 1283 return reg_get_5g_bonded_channel_state_for_freq(pdev, freq, ch_params); 1284 } 1285 #endif 1286 1287 qdf_export_symbol(wlan_reg_get_5g_bonded_channel_state_for_pwrmode); 1288 1289 enum channel_state 1290 wlan_reg_get_2g_bonded_channel_state_for_freq(struct wlan_objmgr_pdev *pdev, 1291 qdf_freq_t freq, 1292 qdf_freq_t sec_ch_freq, 1293 enum phy_ch_width bw) 1294 { 1295 return reg_get_2g_bonded_channel_state_for_freq(pdev, 1296 freq, 1297 sec_ch_freq, 1298 bw); 1299 } 1300 1301 #ifdef CONFIG_REG_6G_PWRMODE 1302 void wlan_reg_set_channel_params_for_pwrmode(struct wlan_objmgr_pdev *pdev, 1303 qdf_freq_t freq, 1304 qdf_freq_t sec_ch_2g_freq, 1305 struct ch_params *ch_params, 1306 enum supported_6g_pwr_types 1307 in_6g_pwr_mode) 1308 { 1309 reg_set_channel_params_for_pwrmode(pdev, freq, sec_ch_2g_freq, 1310 ch_params, 1311 in_6g_pwr_mode, true); 1312 } 1313 1314 qdf_export_symbol(wlan_reg_set_channel_params_for_pwrmode); 1315 #endif 1316 1317 const struct bonded_channel_freq * 1318 wlan_reg_get_bonded_chan_entry(qdf_freq_t freq, enum phy_ch_width chwidth, 1319 qdf_freq_t cen320_freq) 1320 { 1321 return reg_get_bonded_chan_entry(freq, chwidth, cen320_freq); 1322 } 1323 1324 #ifdef WLAN_FEATURE_11BE 1325 #ifdef CONFIG_REG_6G_PWRMODE 1326 void 1327 wlan_reg_fill_channel_list_for_pwrmode(struct wlan_objmgr_pdev *pdev, 1328 qdf_freq_t freq, 1329 qdf_freq_t sec_ch_2g_freq, 1330 enum phy_ch_width ch_width, 1331 qdf_freq_t band_center_320, 1332 struct reg_channel_list *chan_list, 1333 enum supported_6g_pwr_types 1334 in_6g_pwr_type, 1335 bool treat_nol_chan_as_disabled) 1336 { 1337 reg_fill_channel_list_for_pwrmode(pdev, freq, sec_ch_2g_freq, ch_width, 1338 band_center_320, chan_list, 1339 in_6g_pwr_type, 1340 treat_nol_chan_as_disabled); 1341 } 1342 #endif /* CONFIG_REG_6G_PWRMODE */ 1343 1344 bool wlan_reg_is_punc_bitmap_valid(enum phy_ch_width bw, 1345 uint16_t puncture_bitmap) 1346 { 1347 return reg_is_punc_bitmap_valid(bw, puncture_bitmap); 1348 } 1349 1350 #ifdef QCA_DFS_BW_PUNCTURE 1351 uint16_t wlan_reg_find_nearest_puncture_pattern(enum phy_ch_width bw, 1352 uint16_t proposed_bitmap) 1353 { 1354 return reg_find_nearest_puncture_pattern(bw, proposed_bitmap); 1355 } 1356 #endif /* QCA_DFS_BW_PUNCTURE */ 1357 1358 QDF_STATUS wlan_reg_extract_puncture_by_bw(enum phy_ch_width ori_bw, 1359 uint16_t ori_puncture_bitmap, 1360 qdf_freq_t freq, 1361 qdf_freq_t cen320_freq, 1362 enum phy_ch_width new_bw, 1363 uint16_t *new_puncture_bitmap) 1364 { 1365 return reg_extract_puncture_by_bw(ori_bw, ori_puncture_bitmap, freq, 1366 cen320_freq, new_bw, 1367 new_puncture_bitmap); 1368 } 1369 1370 void wlan_reg_set_create_punc_bitmap(struct ch_params *ch_params, 1371 bool is_create_punc_bitmap) 1372 { 1373 reg_set_create_punc_bitmap(ch_params, is_create_punc_bitmap); 1374 } 1375 1376 #ifdef CONFIG_REG_CLIENT 1377 QDF_STATUS wlan_reg_apply_puncture(struct wlan_objmgr_pdev *pdev, 1378 uint16_t puncture_bitmap, 1379 qdf_freq_t freq, 1380 enum phy_ch_width bw, 1381 qdf_freq_t cen320_freq) 1382 { 1383 return reg_apply_puncture(pdev, puncture_bitmap, freq, bw, 1384 cen320_freq); 1385 } 1386 1387 QDF_STATUS wlan_reg_remove_puncture(struct wlan_objmgr_pdev *pdev) 1388 { 1389 return reg_remove_puncture(pdev); 1390 } 1391 #endif 1392 #endif /* WLAN_FEATURE_11BE */ 1393 1394 #ifdef CONFIG_REG_6G_PWRMODE 1395 enum channel_state 1396 wlan_reg_get_channel_state_for_pwrmode(struct wlan_objmgr_pdev *pdev, 1397 qdf_freq_t freq, 1398 enum supported_6g_pwr_types 1399 in_6g_pwr_type) 1400 { 1401 return reg_get_channel_state_for_pwrmode(pdev, freq, in_6g_pwr_type); 1402 } 1403 #endif 1404 1405 #ifdef CONFIG_REG_CLIENT 1406 enum channel_state wlan_reg_get_channel_state_from_secondary_list_for_freq( 1407 struct wlan_objmgr_pdev *pdev, 1408 qdf_freq_t freq) 1409 { 1410 return reg_get_channel_state_from_secondary_list_for_freq(pdev, freq); 1411 } 1412 1413 QDF_STATUS 1414 wlan_reg_get_channel_list_with_power(struct wlan_objmgr_pdev *pdev, 1415 struct channel_power *ch_list, 1416 uint8_t *num_chan, 1417 enum supported_6g_pwr_types in_6g_pwr_type) 1418 { 1419 return reg_get_channel_list_with_power(pdev, ch_list, num_chan, 1420 in_6g_pwr_type); 1421 } 1422 #endif 1423 1424 uint8_t wlan_reg_get_channel_reg_power_for_freq(struct wlan_objmgr_pdev *pdev, 1425 qdf_freq_t freq) 1426 { 1427 return reg_get_channel_reg_power_for_freq(pdev, freq); 1428 } 1429 1430 enum reg_wifi_band wlan_reg_freq_to_band(qdf_freq_t freq) 1431 { 1432 return reg_freq_to_band(freq); 1433 } 1434 qdf_export_symbol(wlan_reg_freq_to_band); 1435 1436 qdf_freq_t wlan_reg_min_chan_freq(void) 1437 { 1438 return reg_min_chan_freq(); 1439 } 1440 1441 qdf_freq_t wlan_reg_max_chan_freq(void) 1442 { 1443 return reg_max_chan_freq(); 1444 } 1445 1446 void wlan_reg_freq_width_to_chan_op_class(struct wlan_objmgr_pdev *pdev, 1447 qdf_freq_t freq, 1448 uint16_t chan_width, 1449 bool global_tbl_lookup, 1450 uint16_t behav_limit, 1451 uint8_t *op_class, 1452 uint8_t *chan_num) 1453 { 1454 return reg_freq_width_to_chan_op_class(pdev, freq, chan_width, 1455 global_tbl_lookup, 1456 behav_limit, 1457 op_class, 1458 chan_num); 1459 } 1460 1461 void wlan_reg_freq_width_to_chan_op_class_auto(struct wlan_objmgr_pdev *pdev, 1462 qdf_freq_t freq, 1463 uint16_t chan_width, 1464 bool global_tbl_lookup, 1465 uint16_t behav_limit, 1466 uint8_t *op_class, 1467 uint8_t *chan_num) 1468 { 1469 reg_freq_width_to_chan_op_class_auto(pdev, freq, chan_width, 1470 global_tbl_lookup, 1471 behav_limit, 1472 op_class, 1473 chan_num); 1474 } 1475 1476 qdf_export_symbol(wlan_reg_freq_width_to_chan_op_class_auto); 1477 1478 void wlan_reg_freq_to_chan_op_class(struct wlan_objmgr_pdev *pdev, 1479 qdf_freq_t freq, 1480 bool global_tbl_lookup, 1481 uint16_t behav_limit, 1482 uint8_t *op_class, 1483 uint8_t *chan_num) 1484 { 1485 return reg_freq_to_chan_op_class(pdev, freq, 1486 global_tbl_lookup, 1487 behav_limit, 1488 op_class, 1489 chan_num); 1490 } 1491 1492 bool wlan_reg_is_freq_in_country_opclass(struct wlan_objmgr_pdev *pdev, 1493 const uint8_t country[3], 1494 uint8_t op_class, 1495 qdf_freq_t chan_freq) 1496 { 1497 return reg_is_freq_in_country_opclass(pdev, country, 1498 op_class, chan_freq); 1499 } 1500 1501 enum channel_state 1502 wlan_reg_get_5g_bonded_channel_and_state_for_freq(struct wlan_objmgr_pdev *pdev, 1503 uint16_t freq, 1504 enum phy_ch_width bw, 1505 const 1506 struct bonded_channel_freq 1507 **bonded_chan_ptr_ptr) 1508 { 1509 /* 1510 * Get channel frequencies and state from regulatory 1511 */ 1512 return reg_get_5g_bonded_channel_for_freq(pdev, freq, bw, 1513 bonded_chan_ptr_ptr); 1514 } 1515 1516 #ifdef CONFIG_REG_6G_PWRMODE 1517 enum channel_state 1518 wlan_reg_get_5g_bonded_channel_and_state_for_pwrmode( 1519 struct wlan_objmgr_pdev *pdev, 1520 uint16_t freq, 1521 enum phy_ch_width bw, 1522 const 1523 struct bonded_channel_freq 1524 **bonded_chan_ptr_ptr, 1525 enum supported_6g_pwr_types 1526 in_6g_pwr_mode, 1527 uint16_t input_puncture_bitmap) 1528 { 1529 /* 1530 * Get channel frequencies and state from regulatory 1531 */ 1532 return reg_get_5g_bonded_channel_for_pwrmode(pdev, freq, bw, 1533 bonded_chan_ptr_ptr, 1534 in_6g_pwr_mode, 1535 input_puncture_bitmap); 1536 } 1537 1538 qdf_export_symbol(wlan_reg_get_5g_bonded_channel_and_state_for_pwrmode); 1539 #endif 1540 1541 #if defined(WLAN_FEATURE_11BE) && defined(CONFIG_REG_CLIENT) 1542 enum channel_state 1543 wlan_reg_get_bonded_channel_state_for_freq(struct wlan_objmgr_pdev *pdev, 1544 qdf_freq_t freq, 1545 enum phy_ch_width bw, 1546 qdf_freq_t sec_freq) 1547 { 1548 if (WLAN_REG_IS_24GHZ_CH_FREQ(freq)) 1549 return reg_get_2g_bonded_channel_state_for_freq(pdev, freq, 1550 sec_freq, bw); 1551 if (bw == CH_WIDTH_320MHZ) { 1552 const struct bonded_channel_freq *bonded_chan_ptr_ptr = NULL; 1553 1554 return reg_get_5g_bonded_channel_for_freq(pdev, freq, bw, 1555 &bonded_chan_ptr_ptr); 1556 } else { 1557 struct ch_params params = {0}; 1558 1559 params.ch_width = bw; 1560 1561 return reg_get_5g_bonded_channel_state_for_freq(pdev, freq, 1562 ¶ms); 1563 } 1564 } 1565 1566 qdf_export_symbol(wlan_reg_get_5g_bonded_channel_and_state_for_freq); 1567 1568 #else 1569 enum channel_state 1570 wlan_reg_get_bonded_channel_state_for_freq(struct wlan_objmgr_pdev *pdev, 1571 qdf_freq_t freq, 1572 enum phy_ch_width bw, 1573 qdf_freq_t sec_freq) 1574 { 1575 if (WLAN_REG_IS_24GHZ_CH_FREQ(freq)) { 1576 return reg_get_2g_bonded_channel_state_for_freq(pdev, freq, 1577 sec_freq, bw); 1578 } else { 1579 struct ch_params params = {0}; 1580 1581 params.ch_width = bw; 1582 1583 return reg_get_5g_bonded_channel_state_for_freq(pdev, freq, 1584 ¶ms); 1585 } 1586 } 1587 1588 qdf_export_symbol(wlan_reg_get_5g_bonded_channel_and_state_for_freq); 1589 1590 #ifdef CONFIG_REG_6G_PWRMODE 1591 enum channel_state 1592 wlan_reg_get_bonded_channel_state_for_pwrmode(struct wlan_objmgr_pdev *pdev, 1593 qdf_freq_t freq, 1594 enum phy_ch_width bw, 1595 qdf_freq_t sec_freq, 1596 enum supported_6g_pwr_types 1597 in_6g_pwr_mode, 1598 uint16_t input_punc_bitmap) 1599 { 1600 if (WLAN_REG_IS_24GHZ_CH_FREQ(freq)) { 1601 return reg_get_2g_bonded_channel_state_for_freq(pdev, freq, 1602 sec_freq, bw); 1603 } else { 1604 struct ch_params params = {0}; 1605 1606 params.ch_width = bw; 1607 1608 return reg_get_5g_bonded_channel_state_for_pwrmode(pdev, freq, 1609 ¶ms, 1610 in_6g_pwr_mode); 1611 } 1612 } 1613 1614 qdf_export_symbol(wlan_reg_get_bonded_channel_state_for_pwrmode); 1615 #endif 1616 #endif 1617 #endif /* CONFIG CHAN FREQ API */ 1618 1619 uint16_t wlan_reg_get_op_class_width(struct wlan_objmgr_pdev *pdev, 1620 uint8_t op_class, 1621 bool global_tbl_lookup) 1622 { 1623 return reg_get_op_class_width(pdev, op_class, 1624 global_tbl_lookup); 1625 } 1626 1627 bool wlan_reg_is_5ghz_op_class(const uint8_t *country, uint8_t op_class) 1628 { 1629 return reg_is_5ghz_op_class(country, op_class); 1630 } 1631 1632 bool wlan_reg_is_2ghz_op_class(const uint8_t *country, uint8_t op_class) 1633 { 1634 return reg_is_2ghz_op_class(country, op_class); 1635 } 1636 1637 bool wlan_reg_is_6ghz_op_class(struct wlan_objmgr_pdev *pdev, 1638 uint8_t op_class) 1639 { 1640 return reg_is_6ghz_op_class(pdev, op_class); 1641 } 1642 1643 #ifdef CONFIG_REG_CLIENT 1644 bool wlan_reg_is_6ghz_supported(struct wlan_objmgr_psoc *psoc) 1645 { 1646 return reg_is_6ghz_supported(psoc); 1647 } 1648 #endif 1649 1650 #ifdef HOST_OPCLASS_EXT 1651 qdf_freq_t 1652 wlan_reg_country_chan_opclass_to_freq(struct wlan_objmgr_pdev *pdev, 1653 const uint8_t country[3], 1654 uint8_t chan, uint8_t op_class, 1655 bool strict) 1656 { 1657 return reg_country_chan_opclass_to_freq(pdev, country, chan, op_class, 1658 strict); 1659 } 1660 #endif 1661 1662 uint16_t wlan_reg_chan_opclass_to_freq(uint8_t chan, 1663 uint8_t op_class, 1664 bool global_tbl_lookup) 1665 { 1666 if (!chan || !op_class) 1667 return 0; 1668 1669 return reg_chan_opclass_to_freq(chan, op_class, global_tbl_lookup); 1670 } 1671 1672 qdf_freq_t wlan_reg_chan_opclass_to_freq_auto(uint8_t chan, uint8_t op_class, 1673 bool global_tbl_lookup) 1674 { 1675 if (!chan || !op_class) 1676 return 0; 1677 1678 return reg_chan_opclass_to_freq_auto(chan, op_class, global_tbl_lookup); 1679 } 1680 1681 #ifdef CHECK_REG_PHYMODE 1682 enum reg_phymode wlan_reg_get_max_phymode(struct wlan_objmgr_pdev *pdev, 1683 enum reg_phymode phy_in, 1684 qdf_freq_t freq) 1685 { 1686 return reg_get_max_phymode(pdev, phy_in, freq); 1687 } 1688 #endif /* CHECK_REG_PHYMODE */ 1689 1690 #ifdef CONFIG_REG_CLIENT 1691 enum band_info wlan_reg_band_bitmap_to_band_info(uint32_t band_bitmap) 1692 { 1693 return reg_band_bitmap_to_band_info(band_bitmap); 1694 } 1695 1696 QDF_STATUS 1697 wlan_reg_update_tx_power_on_ctry_change(struct wlan_objmgr_pdev *pdev, 1698 uint8_t vdev_id) 1699 { 1700 return reg_update_tx_power_on_ctry_change(pdev, vdev_id); 1701 } 1702 #endif 1703 1704 #if defined(CONFIG_BAND_6GHZ) 1705 QDF_STATUS wlan_reg_get_rnr_tpe_usable(struct wlan_objmgr_pdev *pdev, 1706 bool *reg_rnr_tpe_usable) 1707 { 1708 return reg_get_rnr_tpe_usable(pdev, reg_rnr_tpe_usable); 1709 } 1710 1711 QDF_STATUS wlan_reg_get_unspecified_ap_usable(struct wlan_objmgr_pdev *pdev, 1712 bool *reg_unspecified_ap_usable) 1713 { 1714 return reg_get_unspecified_ap_usable(pdev, reg_unspecified_ap_usable); 1715 } 1716 1717 QDF_STATUS 1718 wlan_reg_get_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev, 1719 enum reg_6g_ap_type *reg_cur_6g_ap_pwr_type) 1720 { 1721 return reg_get_cur_6g_ap_pwr_type(pdev, reg_cur_6g_ap_pwr_type); 1722 } 1723 1724 qdf_export_symbol(wlan_reg_get_cur_6g_ap_pwr_type); 1725 1726 QDF_STATUS 1727 wlan_reg_get_cur_6g_client_type(struct wlan_objmgr_pdev *pdev, 1728 enum reg_6g_client_type 1729 *reg_cur_6g_client_mobility_type) 1730 { 1731 return reg_get_cur_6g_client_type(pdev, 1732 reg_cur_6g_client_mobility_type); 1733 } 1734 1735 qdf_export_symbol(wlan_reg_get_cur_6g_client_type); 1736 1737 QDF_STATUS 1738 wlan_reg_set_cur_6ghz_client_type(struct wlan_objmgr_pdev *pdev, 1739 enum reg_6g_client_type in_6ghz_client_type) 1740 { 1741 return reg_set_cur_6ghz_client_type(pdev, in_6ghz_client_type); 1742 } 1743 1744 QDF_STATUS 1745 wlan_reg_set_6ghz_client_type_from_target(struct wlan_objmgr_pdev *pdev) 1746 { 1747 return reg_set_6ghz_client_type_from_target(pdev); 1748 } 1749 1750 bool wlan_reg_is_6g_psd_power(struct wlan_objmgr_pdev *pdev) 1751 { 1752 return reg_is_6g_psd_power(pdev); 1753 } 1754 1755 QDF_STATUS wlan_reg_get_6g_chan_ap_power(struct wlan_objmgr_pdev *pdev, 1756 qdf_freq_t chan_freq, bool *is_psd, 1757 uint16_t *tx_power, 1758 uint16_t *eirp_psd_power) 1759 { 1760 return reg_get_6g_chan_ap_power(pdev, chan_freq, is_psd, 1761 tx_power, eirp_psd_power); 1762 } 1763 1764 qdf_export_symbol(wlan_reg_get_6g_chan_ap_power); 1765 1766 QDF_STATUS 1767 wlan_reg_get_client_power_for_connecting_ap(struct wlan_objmgr_pdev *pdev, 1768 enum reg_6g_ap_type ap_type, 1769 qdf_freq_t chan_freq, 1770 bool is_psd, uint16_t *tx_power, 1771 uint16_t *eirp_psd_power) 1772 { 1773 return reg_get_client_power_for_connecting_ap(pdev, ap_type, chan_freq, 1774 is_psd, tx_power, 1775 eirp_psd_power); 1776 } 1777 1778 QDF_STATUS 1779 wlan_reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev *pdev, 1780 enum reg_6g_client_type client_type, 1781 qdf_freq_t chan_freq, 1782 bool *is_psd, uint16_t *tx_power, 1783 uint16_t *eirp_psd_power) 1784 { 1785 return reg_get_client_power_for_6ghz_ap(pdev, client_type, chan_freq, 1786 is_psd, tx_power, 1787 eirp_psd_power); 1788 } 1789 1790 enum reg_6g_ap_type 1791 wlan_reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev) 1792 { 1793 return reg_decide_6g_ap_pwr_type(pdev); 1794 } 1795 1796 QDF_STATUS 1797 wlan_reg_set_ap_pwr_and_update_chan_list(struct wlan_objmgr_pdev *pdev, 1798 enum reg_6g_ap_type ap_pwr_type) 1799 { 1800 return reg_set_ap_pwr_and_update_chan_list(pdev, ap_pwr_type); 1801 } 1802 1803 qdf_export_symbol(wlan_reg_set_ap_pwr_and_update_chan_list); 1804 1805 uint8_t 1806 wlan_reg_get_num_rules_of_ap_pwr_type(struct wlan_objmgr_pdev *pdev, 1807 enum reg_6g_ap_type ap_pwr_type) 1808 { 1809 return reg_get_num_rules_of_ap_pwr_type(pdev, ap_pwr_type); 1810 } 1811 1812 qdf_export_symbol(wlan_reg_get_num_rules_of_ap_pwr_type); 1813 1814 QDF_STATUS wlan_reg_get_superchan_entry( 1815 struct wlan_objmgr_pdev *pdev, 1816 enum channel_enum chan_enum, 1817 const struct super_chan_info **p_sup_chan_entry) 1818 { 1819 return reg_get_superchan_entry(pdev, chan_enum, p_sup_chan_entry); 1820 } 1821 1822 enum supported_6g_pwr_types 1823 wlan_reg_conv_6g_ap_type_to_supported_6g_pwr_types(enum reg_6g_ap_type 1824 ap_pwr_type) 1825 { 1826 return reg_conv_6g_ap_type_to_supported_6g_pwr_types(ap_pwr_type); 1827 } 1828 1829 enum supported_6g_pwr_types 1830 wlan_reg_get_best_6g_pwr_type(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) 1831 { 1832 return reg_get_best_6g_pwr_type(pdev, freq); 1833 } 1834 1835 enum reg_6g_ap_type 1836 wlan_reg_conv_supported_6g_pwr_type_to_ap_pwr_type(enum supported_6g_pwr_types 1837 in_6g_pwr_type) 1838 { 1839 return reg_convert_supported_6g_pwr_type_to_ap_pwr_type(in_6g_pwr_type); 1840 } 1841 #endif /* CONFIG_BAND_6GHZ */ 1842 1843 bool wlan_reg_is_ext_tpc_supported(struct wlan_objmgr_psoc *psoc) 1844 { 1845 return reg_is_ext_tpc_supported(psoc); 1846 } 1847 1848 #ifdef CONFIG_AFC_SUPPORT 1849 bool wlan_reg_is_afc_power_event_received(struct wlan_objmgr_pdev *pdev) 1850 { 1851 return reg_is_afc_power_event_received(pdev); 1852 } 1853 1854 qdf_export_symbol(wlan_reg_is_afc_power_event_received); 1855 1856 bool wlan_reg_is_afc_done(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) 1857 { 1858 return reg_is_afc_done(pdev, freq); 1859 } 1860 1861 qdf_export_symbol(wlan_reg_is_afc_done); 1862 1863 QDF_STATUS wlan_reg_get_afc_req_id(struct wlan_objmgr_pdev *pdev, 1864 uint64_t *req_id) 1865 { 1866 return reg_get_afc_req_id(pdev, req_id); 1867 } 1868 1869 qdf_export_symbol(wlan_reg_get_afc_req_id); 1870 1871 bool wlan_reg_is_afc_expiry_event_received(struct wlan_objmgr_pdev *pdev) 1872 { 1873 return reg_is_afc_expiry_event_received(pdev); 1874 } 1875 1876 qdf_export_symbol(wlan_reg_is_afc_expiry_event_received); 1877 1878 bool wlan_reg_is_noaction_on_afc_pwr_evt(struct wlan_objmgr_pdev *pdev) 1879 { 1880 return reg_is_noaction_on_afc_pwr_evt(pdev); 1881 } 1882 1883 QDF_STATUS 1884 wlan_reg_get_afc_dev_deploy_type(struct wlan_objmgr_pdev *pdev, 1885 enum reg_afc_dev_deploy_type *afc_dev_type) 1886 { 1887 return reg_get_afc_dev_deploy_type(pdev, afc_dev_type); 1888 } 1889 1890 qdf_export_symbol(wlan_reg_get_afc_dev_deploy_type); 1891 1892 bool 1893 wlan_reg_is_sta_connect_allowed(struct wlan_objmgr_pdev *pdev, 1894 enum reg_6g_ap_type root_ap_pwr_mode) 1895 { 1896 return reg_is_sta_connect_allowed(pdev, root_ap_pwr_mode); 1897 } 1898 1899 qdf_export_symbol(wlan_reg_is_sta_connect_allowed); 1900 #endif /* CONFIG_AFC_SUPPORT */ 1901 1902 QDF_STATUS wlan_reg_is_chwidth_supported(struct wlan_objmgr_pdev *pdev, 1903 enum phy_ch_width ch_width, 1904 bool *is_supported) 1905 { 1906 return reg_is_chwidth_supported(pdev, ch_width, is_supported); 1907 } 1908 1909 qdf_export_symbol(wlan_reg_is_chwidth_supported); 1910 1911 #ifdef CONFIG_BAND_6GHZ 1912 qdf_freq_t wlan_reg_get_thresh_priority_freq(struct wlan_objmgr_pdev *pdev) 1913 { 1914 return reg_get_thresh_priority_freq(pdev); 1915 } 1916 1917 QDF_STATUS wlan_reg_psd_2_eirp(struct wlan_objmgr_pdev *pdev, 1918 int16_t psd, 1919 uint16_t ch_bw, 1920 int16_t *eirp) 1921 { 1922 return reg_psd_2_eirp(pdev, psd, ch_bw, eirp); 1923 } 1924 1925 qdf_export_symbol(wlan_reg_psd_2_eirp); 1926 1927 QDF_STATUS wlan_reg_eirp_2_psd(struct wlan_objmgr_pdev *pdev, uint16_t ch_bw, 1928 int16_t eirp, int16_t *psd) 1929 { 1930 return reg_eirp_2_psd(pdev, ch_bw, eirp, psd); 1931 } 1932 1933 enum reg_6g_ap_type 1934 wlan_reg_get_best_pwr_mode(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq, 1935 qdf_freq_t cen320, 1936 uint16_t bw, uint16_t in_punc_pattern) 1937 { 1938 return reg_get_best_pwr_mode(pdev, freq, cen320, bw, in_punc_pattern); 1939 } 1940 1941 qdf_export_symbol(wlan_reg_get_best_pwr_mode); 1942 1943 uint8_t wlan_reg_get_eirp_pwr(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq, 1944 qdf_freq_t cen320, uint16_t bw, 1945 enum reg_6g_ap_type ap_pwr_type, 1946 uint16_t in_punc_pattern, 1947 bool is_client_list_lookup_needed, 1948 enum reg_6g_client_type client_type) 1949 { 1950 return reg_get_eirp_pwr(pdev, freq, cen320, bw, ap_pwr_type, 1951 in_punc_pattern, is_client_list_lookup_needed, 1952 client_type); 1953 } 1954 1955 qdf_export_symbol(wlan_reg_get_eirp_pwr); 1956 1957 #endif /* CONFIG_BAND_6GHZ */ 1958 1959 enum phy_ch_width wlan_reg_find_chwidth_from_bw(uint16_t bw) 1960 { 1961 return reg_find_chwidth_from_bw(bw); 1962 } 1963 1964 #ifdef WLAN_FEATURE_11BE 1965 enum channel_state 1966 wlan_reg_get_chan_state_for_320(struct wlan_objmgr_pdev *pdev, 1967 uint16_t freq, 1968 qdf_freq_t center_320, 1969 enum phy_ch_width ch_width, 1970 const struct bonded_channel_freq 1971 **bonded_chan_ptr_ptr, 1972 enum supported_6g_pwr_types in_6g_pwr_type, 1973 bool treat_nol_chan_as_disabled, 1974 uint16_t input_puncture_bitmap) 1975 { 1976 return reg_get_chan_state_for_320(pdev, freq, center_320, 1977 ch_width, bonded_chan_ptr_ptr, 1978 in_6g_pwr_type, 1979 treat_nol_chan_as_disabled, 1980 input_puncture_bitmap); 1981 } 1982 #endif 1983 1984 #ifdef CONFIG_BAND_6GHZ 1985 bool wlan_is_sup_chan_entry_afc_done(struct wlan_objmgr_pdev *pdev, 1986 enum channel_enum chan_idx, 1987 enum supported_6g_pwr_types in_6g_pwr_mode) 1988 { 1989 return reg_is_sup_chan_entry_afc_done(pdev, chan_idx, in_6g_pwr_mode); 1990 } 1991 1992 qdf_export_symbol(wlan_is_sup_chan_entry_afc_done); 1993 1994 QDF_STATUS 1995 wlan_reg_display_super_chan_list(struct wlan_objmgr_pdev *pdev) 1996 { 1997 return reg_display_super_chan_list(pdev); 1998 } 1999 2000 #if defined(CONFIG_AFC_SUPPORT) && defined(CONFIG_BAND_6GHZ) 2001 QDF_STATUS 2002 wlan_reg_get_afc_freq_range_and_psd_limits(struct wlan_objmgr_pdev *pdev, 2003 uint8_t num_freq_obj, 2004 struct afc_freq_obj *afc_obj) 2005 { 2006 return reg_get_afc_freq_range_and_psd_limits(pdev, num_freq_obj, 2007 afc_obj); 2008 } 2009 2010 QDF_STATUS 2011 wlan_reg_get_num_afc_freq_obj(struct wlan_objmgr_pdev *pdev, 2012 uint8_t *num_freq_obj) 2013 { 2014 return reg_get_num_afc_freq_obj(pdev, num_freq_obj); 2015 } 2016 2017 QDF_STATUS wlan_reg_set_afc_power_event_received(struct wlan_objmgr_pdev *pdev, 2018 bool val) 2019 { 2020 return reg_set_afc_power_event_received(pdev, val); 2021 } 2022 #endif 2023 2024 #endif 2025 2026 #ifdef CONFIG_REG_CLIENT 2027 QDF_STATUS 2028 wlan_reg_recompute_current_chan_list(struct wlan_objmgr_psoc *psoc, 2029 struct wlan_objmgr_pdev *pdev) 2030 { 2031 struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; 2032 2033 pdev_priv_obj = reg_get_pdev_obj(pdev); 2034 if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) { 2035 reg_err("reg pdev priv obj is NULL"); 2036 return QDF_STATUS_E_FAILURE; 2037 } 2038 2039 reg_debug("Recomputing the current channel list"); 2040 reg_compute_pdev_current_chan_list(pdev_priv_obj); 2041 return reg_send_scheduler_msg_nb(psoc, pdev); 2042 } 2043 2044 QDF_STATUS 2045 wlan_reg_modify_indoor_concurrency(struct wlan_objmgr_pdev *pdev, 2046 uint8_t vdev_id, uint32_t freq, 2047 enum phy_ch_width width, bool add) 2048 { 2049 if (add) 2050 return reg_add_indoor_concurrency(pdev, vdev_id, freq, width); 2051 else 2052 return reg_remove_indoor_concurrency(pdev, vdev_id, freq); 2053 } 2054 #endif 2055