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 enum supported_6g_pwr_types in_6g_pwr_mode) 309 { 310 return reg_get_opclass_details(pdev, reg_ap_cap, n_opclasses, 311 max_supp_op_class, 312 global_tbl_lookup, 313 in_6g_pwr_mode); 314 } 315 316 QDF_STATUS 317 wlan_reg_get_opclass_for_cur_hwmode(struct wlan_objmgr_pdev *pdev, 318 struct regdmn_ap_cap_opclass_t *reg_ap_cap, 319 uint8_t *n_opclasses, 320 uint8_t max_supp_op_class, 321 bool global_tbl_lookup, 322 enum phy_ch_width max_chwidth, 323 bool is_80p80_supp, 324 enum supported_6g_pwr_types in_6g_pwr_mode) 325 { 326 return reg_get_opclass_for_cur_hwmode(pdev, reg_ap_cap, n_opclasses, 327 max_supp_op_class, 328 global_tbl_lookup, 329 max_chwidth, 330 is_80p80_supp, 331 in_6g_pwr_mode); 332 } 333 334 enum country_src wlan_reg_get_cc_and_src(struct wlan_objmgr_psoc *psoc, 335 uint8_t *alpha) 336 { 337 return reg_get_cc_and_src(psoc, alpha); 338 } 339 340 QDF_STATUS wlan_regulatory_init(void) 341 { 342 QDF_STATUS status; 343 344 status = wlan_objmgr_register_psoc_create_handler( 345 WLAN_UMAC_COMP_REGULATORY, 346 wlan_regulatory_psoc_obj_created_notification, NULL); 347 if (status != QDF_STATUS_SUCCESS) { 348 reg_err("failed to register reg psoc obj create handler"); 349 return status; 350 } 351 352 status = wlan_objmgr_register_psoc_destroy_handler( 353 WLAN_UMAC_COMP_REGULATORY, 354 wlan_regulatory_psoc_obj_destroyed_notification, NULL); 355 if (status != QDF_STATUS_SUCCESS) { 356 reg_err("failed to register reg psoc obj create handler"); 357 goto unreg_psoc_create; 358 } 359 360 status = wlan_objmgr_register_pdev_create_handler( 361 WLAN_UMAC_COMP_REGULATORY, 362 wlan_regulatory_pdev_obj_created_notification, NULL); 363 if (status != QDF_STATUS_SUCCESS) { 364 reg_err("failed to register reg psoc obj create handler"); 365 goto unreg_psoc_destroy; 366 } 367 368 status = wlan_objmgr_register_pdev_destroy_handler( 369 WLAN_UMAC_COMP_REGULATORY, 370 wlan_regulatory_pdev_obj_destroyed_notification, NULL); 371 if (status != QDF_STATUS_SUCCESS) { 372 reg_err("failed to register reg psoc obj create handler"); 373 goto unreg_pdev_create; 374 } 375 channel_map = channel_map_global; 376 reg_debug("regulatory handlers registered with obj mgr"); 377 378 return status; 379 380 unreg_pdev_create: 381 status = wlan_objmgr_unregister_pdev_create_handler( 382 WLAN_UMAC_COMP_REGULATORY, 383 wlan_regulatory_pdev_obj_created_notification, 384 NULL); 385 386 unreg_psoc_destroy: 387 status = wlan_objmgr_unregister_psoc_destroy_handler( 388 WLAN_UMAC_COMP_REGULATORY, 389 wlan_regulatory_psoc_obj_destroyed_notification, 390 NULL); 391 392 unreg_psoc_create: 393 status = wlan_objmgr_unregister_psoc_create_handler( 394 WLAN_UMAC_COMP_REGULATORY, 395 wlan_regulatory_psoc_obj_created_notification, 396 NULL); 397 398 return QDF_STATUS_E_FAILURE; 399 } 400 401 QDF_STATUS wlan_regulatory_deinit(void) 402 { 403 QDF_STATUS status, ret_status = QDF_STATUS_SUCCESS; 404 405 status = wlan_objmgr_unregister_pdev_destroy_handler( 406 WLAN_UMAC_COMP_REGULATORY, 407 wlan_regulatory_pdev_obj_destroyed_notification, NULL); 408 if (status != QDF_STATUS_SUCCESS) { 409 reg_err("failed to unregister reg pdev obj destroy handler"); 410 ret_status = status; 411 } 412 413 status = wlan_objmgr_unregister_pdev_create_handler( 414 WLAN_UMAC_COMP_REGULATORY, 415 wlan_regulatory_pdev_obj_created_notification, NULL); 416 if (status != QDF_STATUS_SUCCESS) { 417 reg_err("failed to unregister reg pdev obj create handler"); 418 ret_status = status; 419 } 420 421 status = wlan_objmgr_unregister_psoc_destroy_handler( 422 WLAN_UMAC_COMP_REGULATORY, 423 wlan_regulatory_psoc_obj_destroyed_notification, NULL); 424 if (status != QDF_STATUS_SUCCESS) { 425 reg_err("failed to unregister reg psoc obj destroy handler"); 426 ret_status = status; 427 } 428 429 status = wlan_objmgr_unregister_psoc_create_handler( 430 WLAN_UMAC_COMP_REGULATORY, 431 wlan_regulatory_psoc_obj_created_notification, NULL); 432 if (status != QDF_STATUS_SUCCESS) { 433 reg_err("failed to unregister reg psoc obj create handler"); 434 ret_status = status; 435 } 436 437 reg_debug("deregistered callbacks with obj mgr"); 438 439 return ret_status; 440 } 441 442 #ifdef CONFIG_BAND_6GHZ 443 static void 444 regulatory_assign_register_master_ext_handler(struct wlan_objmgr_psoc *psoc, 445 struct wlan_lmac_if_reg_tx_ops *tx_ops) 446 { 447 if (tx_ops->register_master_ext_handler) 448 tx_ops->register_master_ext_handler(psoc, NULL); 449 } 450 451 static void 452 regulatory_assign_unregister_master_ext_handler(struct wlan_objmgr_psoc *psoc, 453 struct wlan_lmac_if_reg_tx_ops *tx_ops) 454 { 455 if (tx_ops->unregister_master_ext_handler) 456 tx_ops->unregister_master_ext_handler(psoc, NULL); 457 } 458 459 QDF_STATUS wlan_reg_get_6g_ap_master_chan_list( 460 struct wlan_objmgr_pdev *pdev, 461 enum reg_6g_ap_type ap_pwr_type, 462 struct regulatory_channel *chan_list) 463 { 464 return reg_get_6g_ap_master_chan_list(pdev, ap_pwr_type, chan_list); 465 } 466 467 #ifdef CONFIG_REG_CLIENT 468 const char *wlan_reg_get_power_string(enum reg_6g_ap_type power_type) 469 { 470 return reg_get_power_string(power_type); 471 } 472 #endif 473 474 qdf_export_symbol(wlan_reg_get_6g_ap_master_chan_list); 475 476 #ifdef CONFIG_AFC_SUPPORT 477 static void regulatory_assign_register_afc_event_handler( 478 struct wlan_objmgr_psoc *psoc, 479 struct wlan_lmac_if_reg_tx_ops *tx_ops) 480 { 481 if (tx_ops->register_afc_event_handler) 482 tx_ops->register_afc_event_handler(psoc, NULL); 483 } 484 485 static void regulatory_assign_unregister_afc_event_handler( 486 struct wlan_objmgr_psoc *psoc, 487 struct wlan_lmac_if_reg_tx_ops *tx_ops) 488 { 489 if (tx_ops->unregister_afc_event_handler) 490 tx_ops->unregister_afc_event_handler(psoc, NULL); 491 } 492 #else 493 static void regulatory_assign_register_afc_event_handler( 494 struct wlan_objmgr_psoc *psoc, 495 struct wlan_lmac_if_reg_tx_ops *tx_ops) 496 { 497 } 498 499 static void regulatory_assign_unregister_afc_event_handler( 500 struct wlan_objmgr_psoc *psoc, 501 struct wlan_lmac_if_reg_tx_ops *tx_ops) 502 { 503 } 504 #endif 505 #else 506 static inline void 507 regulatory_assign_register_master_ext_handler(struct wlan_objmgr_psoc *psoc, 508 struct wlan_lmac_if_reg_tx_ops *tx_ops) 509 { 510 } 511 512 static inline void 513 regulatory_assign_unregister_master_ext_handler(struct wlan_objmgr_psoc *psoc, 514 struct wlan_lmac_if_reg_tx_ops *tx_ops) 515 { 516 } 517 518 static void 519 regulatory_assign_register_afc_event_handler(struct wlan_objmgr_psoc *psoc, 520 struct wlan_lmac_if_reg_tx_ops *tx_ops) 521 { 522 } 523 524 static void 525 regulatory_assign_unregister_afc_event_handler(struct wlan_objmgr_psoc *psoc, 526 struct wlan_lmac_if_reg_tx_ops *tx_ops) 527 { 528 } 529 #endif 530 531 QDF_STATUS regulatory_psoc_open(struct wlan_objmgr_psoc *psoc) 532 { 533 struct wlan_lmac_if_reg_tx_ops *tx_ops; 534 535 tx_ops = reg_get_psoc_tx_ops(psoc); 536 if (tx_ops->register_master_handler) 537 tx_ops->register_master_handler(psoc, NULL); 538 regulatory_assign_register_master_ext_handler(psoc, tx_ops); 539 regulatory_assign_register_afc_event_handler(psoc, tx_ops); 540 if (tx_ops->register_11d_new_cc_handler) 541 tx_ops->register_11d_new_cc_handler(psoc, NULL); 542 if (tx_ops->register_ch_avoid_event_handler) 543 tx_ops->register_ch_avoid_event_handler(psoc, NULL); 544 545 return QDF_STATUS_SUCCESS; 546 } 547 548 QDF_STATUS regulatory_psoc_close(struct wlan_objmgr_psoc *psoc) 549 { 550 struct wlan_lmac_if_reg_tx_ops *tx_ops; 551 552 tx_ops = reg_get_psoc_tx_ops(psoc); 553 if (tx_ops->unregister_11d_new_cc_handler) 554 tx_ops->unregister_11d_new_cc_handler(psoc, NULL); 555 if (tx_ops->unregister_master_handler) 556 tx_ops->unregister_master_handler(psoc, NULL); 557 regulatory_assign_unregister_master_ext_handler(psoc, tx_ops); 558 regulatory_assign_unregister_afc_event_handler(psoc, tx_ops); 559 if (tx_ops->unregister_ch_avoid_event_handler) 560 tx_ops->unregister_ch_avoid_event_handler(psoc, NULL); 561 562 return QDF_STATUS_SUCCESS; 563 } 564 565 #ifdef CONFIG_REG_CLIENT 566 /** 567 * reg_is_cntry_set_pending() - Check if country set is pending 568 * @pdev: Pointer to pdev object. 569 * @psoc: Pointer to psoc object. 570 */ 571 static bool reg_is_cntry_set_pending(struct wlan_objmgr_pdev *pdev, 572 struct wlan_objmgr_psoc *psoc) 573 { 574 struct wlan_regulatory_psoc_priv_obj *soc_reg; 575 struct wlan_lmac_if_reg_tx_ops *tx_ops; 576 uint8_t phy_id; 577 578 soc_reg = reg_get_psoc_obj(psoc); 579 580 if (!IS_VALID_PSOC_REG_OBJ(soc_reg)) { 581 reg_err("psoc reg component is NULL"); 582 return false; 583 } 584 585 tx_ops = reg_get_psoc_tx_ops(psoc); 586 587 if (tx_ops->get_phy_id_from_pdev_id) 588 tx_ops->get_phy_id_from_pdev_id( 589 psoc, 590 wlan_objmgr_pdev_get_pdev_id(pdev), 591 &phy_id); 592 else 593 phy_id = wlan_objmgr_pdev_get_pdev_id(pdev); 594 595 return (soc_reg->new_user_ctry_pending[phy_id] || 596 soc_reg->new_init_ctry_pending[phy_id] || 597 soc_reg->new_11d_ctry_pending[phy_id] || 598 soc_reg->world_country_pending[phy_id]); 599 } 600 #else 601 static inline bool reg_is_cntry_set_pending(struct wlan_objmgr_pdev *pdev, 602 struct wlan_objmgr_psoc *psoc) 603 { 604 return false; 605 } 606 #endif 607 608 QDF_STATUS regulatory_pdev_open(struct wlan_objmgr_pdev *pdev) 609 { 610 struct wlan_objmgr_psoc *parent_psoc; 611 struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; 612 613 pdev_priv_obj = reg_get_pdev_obj(pdev); 614 615 if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) { 616 reg_err("reg pdev private obj is NULL"); 617 return QDF_STATUS_E_FAILURE; 618 } 619 620 pdev_priv_obj->pdev_opened = true; 621 622 parent_psoc = wlan_pdev_get_psoc(pdev); 623 624 if (reg_is_cntry_set_pending(pdev, parent_psoc)) 625 return QDF_STATUS_SUCCESS; 626 627 reg_send_scheduler_msg_nb(parent_psoc, pdev); 628 629 return QDF_STATUS_SUCCESS; 630 } 631 632 QDF_STATUS regulatory_pdev_close(struct wlan_objmgr_pdev *pdev) 633 { 634 struct wlan_objmgr_psoc *psoc; 635 struct wlan_regulatory_psoc_priv_obj *soc_reg; 636 struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; 637 638 pdev_priv_obj = reg_get_pdev_obj(pdev); 639 if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) { 640 reg_err("reg pdev private obj is NULL"); 641 return QDF_STATUS_E_FAILURE; 642 } 643 644 pdev_priv_obj->pdev_opened = false; 645 646 psoc = wlan_pdev_get_psoc(pdev); 647 soc_reg = reg_get_psoc_obj(psoc); 648 if (!soc_reg) { 649 reg_err("reg psoc private obj is NULL"); 650 return QDF_STATUS_E_FAULT; 651 } 652 653 reg_reset_ctry_pending_hints(soc_reg); 654 655 return QDF_STATUS_SUCCESS; 656 } 657 658 uint8_t wlan_reg_freq_to_chan(struct wlan_objmgr_pdev *pdev, 659 qdf_freq_t freq) 660 { 661 return reg_freq_to_chan(pdev, freq); 662 } 663 664 qdf_export_symbol(wlan_reg_freq_to_chan); 665 666 qdf_freq_t wlan_reg_legacy_chan_to_freq(struct wlan_objmgr_pdev *pdev, 667 uint8_t chan_num) 668 { 669 return reg_legacy_chan_to_freq(pdev, chan_num); 670 } 671 672 QDF_STATUS wlan_reg_set_country(struct wlan_objmgr_pdev *pdev, 673 uint8_t *country) 674 { 675 return reg_set_country(pdev, country); 676 } 677 678 QDF_STATUS wlan_reg_set_11d_country(struct wlan_objmgr_pdev *pdev, 679 uint8_t *country) 680 { 681 return reg_set_11d_country(pdev, country); 682 } 683 684 bool wlan_reg_is_world(uint8_t *country) 685 { 686 return reg_is_world_alpha2(country); 687 } 688 689 bool wlan_reg_is_us(uint8_t *country) 690 { 691 return reg_is_us_alpha2(country); 692 } 693 694 bool wlan_reg_is_etsi(uint8_t *country) 695 { 696 return reg_is_etsi_alpha2(country); 697 } 698 699 bool wlan_reg_ctry_support_vlp(uint8_t *country) 700 { 701 return reg_ctry_support_vlp(country); 702 } 703 704 void wlan_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc, 705 void *cbk, void *arg) 706 { 707 reg_register_chan_change_callback(psoc, (reg_chan_change_callback)cbk, 708 arg); 709 710 } 711 712 void wlan_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc, 713 void *cbk) 714 { 715 reg_unregister_chan_change_callback(psoc, 716 (reg_chan_change_callback)cbk); 717 } 718 719 void wlan_reg_register_ctry_change_callback(struct wlan_objmgr_psoc *psoc, 720 void *cbk) 721 { 722 reg_register_ctry_change_callback(psoc, (reg_ctry_change_callback)cbk); 723 } 724 725 void wlan_reg_unregister_ctry_change_callback(struct wlan_objmgr_psoc *psoc, 726 void *cbk) 727 { 728 reg_unregister_ctry_change_callback(psoc, 729 (reg_ctry_change_callback)cbk); 730 } 731 732 bool wlan_reg_is_11d_offloaded(struct wlan_objmgr_psoc *psoc) 733 { 734 return reg_is_11d_offloaded(psoc); 735 } 736 737 bool wlan_reg_11d_enabled_on_host(struct wlan_objmgr_psoc *psoc) 738 { 739 return reg_11d_enabled_on_host(psoc); 740 } 741 742 bool wlan_reg_is_etsi13_regdmn(struct wlan_objmgr_pdev *pdev) 743 { 744 return reg_is_etsi13_regdmn(pdev); 745 } 746 747 bool wlan_reg_is_etsi13_srd_chan_allowed_master_mode(struct wlan_objmgr_pdev 748 *pdev) 749 { 750 return reg_is_etsi13_srd_chan_allowed_master_mode(pdev); 751 } 752 753 bool wlan_reg_get_fcc_constraint(struct wlan_objmgr_pdev *pdev, uint32_t freq) 754 { 755 return reg_get_fcc_constraint(pdev, freq); 756 } 757 758 QDF_STATUS wlan_reg_get_chip_mode(struct wlan_objmgr_pdev *pdev, 759 uint64_t *chip_mode) 760 { 761 struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; 762 763 pdev_priv_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev, 764 WLAN_UMAC_COMP_REGULATORY); 765 766 if (!pdev_priv_obj) { 767 reg_err("reg pdev private obj is NULL"); 768 return QDF_STATUS_E_FAULT; 769 } 770 771 *chip_mode = pdev_priv_obj->wireless_modes; 772 773 return QDF_STATUS_SUCCESS; 774 } 775 776 QDF_STATUS wlan_reg_get_phybitmap(struct wlan_objmgr_pdev *pdev, 777 uint16_t *phybitmap) 778 { 779 return reg_get_phybitmap(pdev, phybitmap); 780 } 781 782 bool wlan_reg_is_11d_scan_inprogress(struct wlan_objmgr_psoc *psoc) 783 { 784 return reg_is_11d_scan_inprogress(psoc); 785 } 786 787 QDF_STATUS wlan_reg_get_freq_range(struct wlan_objmgr_pdev *pdev, 788 qdf_freq_t *low_2g, 789 qdf_freq_t *high_2g, 790 qdf_freq_t *low_5g, 791 qdf_freq_t *high_5g) 792 { 793 struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; 794 795 pdev_priv_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev, 796 WLAN_UMAC_COMP_REGULATORY); 797 798 if (!pdev_priv_obj) { 799 reg_err("reg pdev private obj is NULL"); 800 return QDF_STATUS_E_FAULT; 801 } 802 803 if (low_2g) 804 *low_2g = pdev_priv_obj->range_2g_low; 805 806 if (high_2g) 807 *high_2g = pdev_priv_obj->range_2g_high; 808 809 if (low_5g) 810 *low_5g = pdev_priv_obj->range_5g_low; 811 812 if (high_5g) 813 *high_5g = pdev_priv_obj->range_5g_high; 814 815 return QDF_STATUS_SUCCESS; 816 } 817 818 struct wlan_lmac_if_reg_tx_ops * 819 wlan_reg_get_tx_ops(struct wlan_objmgr_psoc *psoc) 820 { 821 return reg_get_psoc_tx_ops(psoc); 822 } 823 824 qdf_export_symbol(wlan_reg_get_tx_ops); 825 826 QDF_STATUS wlan_reg_get_curr_regdomain(struct wlan_objmgr_pdev *pdev, 827 struct cur_regdmn_info *cur_regdmn) 828 { 829 return reg_get_curr_regdomain(pdev, cur_regdmn); 830 } 831 832 uint8_t wlan_reg_max_5ghz_ch_num(void) 833 { 834 return reg_max_5ghz_ch_num(); 835 } 836 837 #ifdef CONFIG_CHAN_FREQ_API 838 qdf_freq_t wlan_reg_min_24ghz_chan_freq(void) 839 { 840 return reg_min_24ghz_chan_freq(); 841 } 842 843 qdf_freq_t wlan_reg_max_24ghz_chan_freq(void) 844 { 845 return reg_max_24ghz_chan_freq(); 846 } 847 848 qdf_freq_t wlan_reg_min_5ghz_chan_freq(void) 849 { 850 return reg_min_5ghz_chan_freq(); 851 } 852 853 qdf_freq_t wlan_reg_max_5ghz_chan_freq(void) 854 { 855 return reg_max_5ghz_chan_freq(); 856 } 857 #endif /* CONFIG_CHAN_FREQ_API */ 858 859 bool wlan_reg_is_24ghz_ch_freq(qdf_freq_t freq) 860 { 861 return reg_is_24ghz_ch_freq(freq); 862 } 863 864 bool wlan_reg_is_5ghz_ch_freq(qdf_freq_t freq) 865 { 866 return reg_is_5ghz_ch_freq(freq); 867 } 868 869 bool wlan_reg_is_range_overlap_2g(qdf_freq_t low_freq, qdf_freq_t high_freq) 870 { 871 return reg_is_range_overlap_2g(low_freq, high_freq); 872 } 873 874 bool wlan_reg_is_range_overlap_5g(qdf_freq_t low_freq, qdf_freq_t high_freq) 875 { 876 return reg_is_range_overlap_5g(low_freq, high_freq); 877 } 878 879 bool wlan_reg_is_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) 880 { 881 return reg_is_freq_indoor(pdev, freq); 882 } 883 884 uint16_t wlan_reg_get_min_chwidth(struct wlan_objmgr_pdev *pdev, 885 qdf_freq_t freq) 886 { 887 return reg_get_min_chwidth(pdev, freq); 888 } 889 890 uint16_t wlan_reg_get_max_chwidth(struct wlan_objmgr_pdev *pdev, 891 qdf_freq_t freq) 892 { 893 return reg_get_max_chwidth(pdev, freq); 894 } 895 896 enum phy_ch_width 897 wlan_reg_get_next_lower_bandwidth(enum phy_ch_width ch_width) 898 { 899 return get_next_lower_bandwidth(ch_width); 900 } 901 902 #ifdef CONFIG_REG_CLIENT 903 bool wlan_reg_is_freq_indoor_in_secondary_list(struct wlan_objmgr_pdev *pdev, 904 qdf_freq_t freq) 905 { 906 return reg_is_freq_indoor_in_secondary_list(pdev, freq); 907 } 908 #endif 909 910 #ifdef CONFIG_BAND_6GHZ 911 bool wlan_reg_is_6ghz_chan_freq(uint16_t freq) 912 { 913 return reg_is_6ghz_chan_freq(freq); 914 } 915 916 #ifdef CONFIG_6G_FREQ_OVERLAP 917 bool wlan_reg_is_range_only6g(qdf_freq_t low_freq, qdf_freq_t high_freq) 918 { 919 return reg_is_range_only6g(low_freq, high_freq); 920 } 921 922 bool wlan_reg_is_range_overlap_6g(qdf_freq_t low_freq, qdf_freq_t high_freq) 923 { 924 return reg_is_range_overlap_6g(low_freq, high_freq); 925 } 926 #endif 927 928 uint16_t wlan_reg_min_6ghz_chan_freq(void) 929 { 930 return reg_min_6ghz_chan_freq(); 931 } 932 933 uint16_t wlan_reg_max_6ghz_chan_freq(void) 934 { 935 return reg_max_6ghz_chan_freq(); 936 } 937 938 bool wlan_reg_is_6ghz_psc_chan_freq(uint16_t freq) 939 { 940 return reg_is_6ghz_psc_chan_freq(freq); 941 } 942 943 bool wlan_reg_is_6g_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) 944 { 945 return reg_is_6g_freq_indoor(pdev, freq); 946 } 947 948 QDF_STATUS 949 wlan_reg_get_max_txpower_for_6g_tpe(struct wlan_objmgr_pdev *pdev, 950 qdf_freq_t freq, uint8_t bw, 951 enum reg_6g_ap_type reg_ap, 952 enum reg_6g_client_type reg_client, 953 bool is_psd, 954 uint8_t *tx_power) 955 { 956 return reg_get_max_txpower_for_6g_tpe(pdev, freq, bw, 957 reg_ap, 958 reg_client, is_psd, 959 tx_power); 960 } 961 #endif /* CONFIG_BAND_6GHZ */ 962 963 uint16_t 964 wlan_reg_get_band_channel_list(struct wlan_objmgr_pdev *pdev, 965 uint8_t band_mask, 966 struct regulatory_channel *channel_list) 967 { 968 if (!pdev) { 969 reg_err("pdev object is NULL"); 970 return 0; 971 } 972 973 return reg_get_band_channel_list(pdev, band_mask, channel_list); 974 } 975 976 #ifdef CONFIG_REG_6G_PWRMODE 977 uint16_t 978 wlan_reg_get_band_channel_list_for_pwrmode(struct wlan_objmgr_pdev *pdev, 979 uint8_t band_mask, 980 struct regulatory_channel 981 *channel_list, 982 enum supported_6g_pwr_types 983 in_6g_pwr_type) 984 { 985 if (!pdev) { 986 reg_err("pdev object is NULL"); 987 return 0; 988 } 989 990 return reg_get_band_channel_list_for_pwrmode(pdev, band_mask, 991 channel_list, 992 in_6g_pwr_type); 993 } 994 #endif 995 996 #ifdef CONFIG_REG_CLIENT 997 uint16_t 998 wlan_reg_get_secondary_band_channel_list(struct wlan_objmgr_pdev *pdev, 999 uint8_t band_mask, 1000 struct regulatory_channel 1001 *channel_list) 1002 { 1003 if (!pdev) { 1004 reg_err("pdev object is NULL"); 1005 return 0; 1006 } 1007 1008 return reg_get_secondary_band_channel_list(pdev, band_mask, 1009 channel_list); 1010 } 1011 #endif 1012 1013 qdf_freq_t wlan_reg_chan_band_to_freq(struct wlan_objmgr_pdev *pdev, 1014 uint8_t chan, uint8_t band_mask) 1015 { 1016 return reg_chan_band_to_freq(pdev, chan, band_mask); 1017 } 1018 1019 qdf_export_symbol(wlan_reg_chan_band_to_freq); 1020 1021 #ifdef CONFIG_49GHZ_CHAN 1022 bool wlan_reg_is_49ghz_freq(qdf_freq_t freq) 1023 { 1024 return reg_is_49ghz_freq(freq); 1025 } 1026 #endif /* CONFIG_49GHZ_CHAN */ 1027 1028 uint8_t wlan_reg_ch_num(uint32_t ch_enum) 1029 { 1030 return reg_ch_num(ch_enum); 1031 } 1032 1033 qdf_freq_t wlan_reg_ch_to_freq(uint32_t ch_enum) 1034 { 1035 return reg_ch_to_freq(ch_enum); 1036 } 1037 1038 #ifdef WLAN_REG_PARTIAL_OFFLOAD 1039 bool wlan_reg_is_regdmn_en302502_applicable(struct wlan_objmgr_pdev *pdev) 1040 { 1041 return reg_is_regdmn_en302502_applicable(pdev); 1042 } 1043 #endif 1044 1045 /** 1046 * wlan_reg_modify_pdev_chan_range() - Compute current channel list for the 1047 * modified regcap. 1048 * @pdev: pointer to struct wlan_objmgr_pdev 1049 * 1050 */ 1051 QDF_STATUS wlan_reg_modify_pdev_chan_range(struct wlan_objmgr_pdev *pdev) 1052 { 1053 return reg_modify_pdev_chan_range(pdev); 1054 } 1055 1056 QDF_STATUS wlan_reg_update_pdev_wireless_modes(struct wlan_objmgr_pdev *pdev, 1057 uint64_t wireless_modes) 1058 { 1059 return reg_update_pdev_wireless_modes(pdev, wireless_modes); 1060 } 1061 #ifdef DISABLE_UNII_SHARED_BANDS 1062 QDF_STATUS wlan_reg_disable_chan_coex(struct wlan_objmgr_pdev *pdev, 1063 uint8_t unii_5g_bitmap) 1064 { 1065 return reg_disable_chan_coex(pdev, unii_5g_bitmap); 1066 } 1067 #endif 1068 1069 #ifdef CONFIG_CHAN_FREQ_API 1070 bool wlan_reg_is_same_band_freqs(qdf_freq_t freq1, qdf_freq_t freq2) 1071 { 1072 return reg_is_same_band_freqs(freq1, freq2); 1073 } 1074 1075 enum channel_enum wlan_reg_get_chan_enum_for_freq(qdf_freq_t freq) 1076 { 1077 return reg_get_chan_enum_for_freq(freq); 1078 } 1079 1080 bool wlan_reg_is_freq_present_in_cur_chan_list(struct wlan_objmgr_pdev *pdev, 1081 qdf_freq_t freq) 1082 { 1083 return reg_is_freq_present_in_cur_chan_list(pdev, freq); 1084 } 1085 1086 bool wlan_reg_is_etsi13_srd_chan_for_freq(struct wlan_objmgr_pdev *pdev, 1087 qdf_freq_t freq) 1088 { 1089 return reg_is_etsi13_srd_chan_for_freq(pdev, freq); 1090 } 1091 1092 bool wlan_reg_is_dsrc_freq(qdf_freq_t freq) 1093 { 1094 return reg_is_dsrc_freq(freq); 1095 } 1096 1097 void wlan_reg_update_nol_ch_for_freq(struct wlan_objmgr_pdev *pdev, 1098 uint16_t *chan_freq_list, 1099 uint8_t num_ch, 1100 bool nol_ch) 1101 { 1102 reg_update_nol_ch_for_freq(pdev, chan_freq_list, num_ch, nol_ch); 1103 } 1104 1105 void wlan_reg_update_nol_history_ch_for_freq(struct wlan_objmgr_pdev *pdev, 1106 uint16_t *ch_list, 1107 uint8_t num_ch, 1108 bool nol_history_ch) 1109 { 1110 reg_update_nol_history_ch_for_freq(pdev, 1111 ch_list, 1112 num_ch, 1113 nol_history_ch); 1114 } 1115 1116 bool wlan_reg_is_dfs_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) 1117 { 1118 return reg_is_dfs_for_freq(pdev, freq); 1119 } 1120 1121 bool wlan_reg_is_passive_or_disable_for_pwrmode( 1122 struct wlan_objmgr_pdev *pdev, 1123 qdf_freq_t freq, 1124 enum supported_6g_pwr_types in_6g_pwr_mode) 1125 { 1126 return reg_is_passive_or_disable_for_pwrmode(pdev, freq, 1127 in_6g_pwr_mode); 1128 } 1129 1130 #ifdef CONFIG_REG_6G_PWRMODE 1131 bool wlan_reg_is_disable_for_pwrmode(struct wlan_objmgr_pdev *pdev, 1132 qdf_freq_t freq, 1133 enum supported_6g_pwr_types in_6g_pwr_mode) 1134 { 1135 return reg_is_disable_for_pwrmode(pdev, freq, in_6g_pwr_mode); 1136 } 1137 #endif 1138 1139 #ifdef CONFIG_REG_CLIENT 1140 bool wlan_reg_is_disable_in_secondary_list_for_freq( 1141 struct wlan_objmgr_pdev *pdev, 1142 qdf_freq_t freq) 1143 { 1144 return reg_is_disable_in_secondary_list_for_freq(pdev, freq); 1145 } 1146 1147 bool wlan_reg_is_enable_in_secondary_list_for_freq( 1148 struct wlan_objmgr_pdev *pdev, 1149 qdf_freq_t freq) 1150 { 1151 return reg_is_enable_in_secondary_list_for_freq(pdev, freq); 1152 } 1153 1154 bool wlan_reg_is_dfs_in_secondary_list_for_freq(struct wlan_objmgr_pdev *pdev, 1155 qdf_freq_t freq) 1156 { 1157 return reg_is_dfs_in_secondary_list_for_freq(pdev, freq); 1158 } 1159 1160 QDF_STATUS 1161 wlan_reg_get_chan_pwr_attr_from_secondary_list_for_freq( 1162 struct wlan_objmgr_pdev *pdev, qdf_freq_t freq, 1163 bool *is_psd, uint16_t *tx_power, 1164 uint16_t *psd_eirp, uint32_t *flags) 1165 { 1166 return reg_get_channel_power_attr_from_secondary_list_for_freq( 1167 pdev, freq, is_psd, tx_power, psd_eirp, flags); 1168 } 1169 1170 QDF_STATUS 1171 wlan_reg_decide_6ghz_power_within_bw_for_freq(struct wlan_objmgr_pdev *pdev, 1172 qdf_freq_t freq, 1173 enum phy_ch_width bw, 1174 bool *is_psd, 1175 uint16_t *min_tx_power, 1176 int16_t *min_psd_eirp, 1177 enum reg_6g_ap_type *power_type, 1178 enum supported_6g_pwr_types pwr_mode, 1179 uint16_t input_punc_bitmap) 1180 { 1181 return reg_decide_6ghz_power_within_bw_for_freq(pdev, 1182 freq, 1183 bw, 1184 is_psd, 1185 min_tx_power, 1186 min_psd_eirp, 1187 power_type, 1188 pwr_mode, 1189 input_punc_bitmap); 1190 } 1191 #endif 1192 1193 bool wlan_reg_is_passive_for_freq(struct wlan_objmgr_pdev *pdev, 1194 qdf_freq_t freq) 1195 { 1196 return reg_is_passive_for_freq(pdev, freq); 1197 } 1198 1199 QDF_STATUS 1200 wlan_reg_get_channel_list_with_power_for_freq(struct wlan_objmgr_pdev *pdev, 1201 struct channel_power *ch_list, 1202 uint8_t *num_chan) 1203 { 1204 return reg_get_channel_list_with_power_for_freq(pdev, 1205 ch_list, 1206 num_chan); 1207 } 1208 1209 bool 1210 wlan_reg_chan_has_dfs_attribute_for_freq(struct wlan_objmgr_pdev *pdev, 1211 qdf_freq_t freq) 1212 { 1213 return reg_chan_has_dfs_attribute_for_freq(pdev, freq); 1214 } 1215 1216 enum channel_state 1217 wlan_reg_get_5g_bonded_channel_state_for_pwrmode(struct wlan_objmgr_pdev *pdev, 1218 qdf_freq_t freq, 1219 struct ch_params *ch_params, 1220 enum supported_6g_pwr_types 1221 in_6g_pwr_type) 1222 { 1223 enum phy_ch_width bw; 1224 1225 if (!ch_params) { 1226 reg_err_rl("Invalid ch_params"); 1227 return CHANNEL_STATE_INVALID; 1228 } 1229 bw = ch_params->ch_width; 1230 1231 if (reg_is_ch_width_320(bw)) { 1232 const struct bonded_channel_freq *bonded_ch_ptr_ptr = NULL; 1233 uint16_t in_punc_bitmap = reg_fetch_punc_bitmap(ch_params); 1234 1235 return reg_get_5g_bonded_channel_for_pwrmode(pdev, freq, bw, 1236 &bonded_ch_ptr_ptr, 1237 in_6g_pwr_type, 1238 in_punc_bitmap); 1239 } 1240 1241 return reg_get_5g_bonded_channel_state_for_pwrmode(pdev, freq, 1242 ch_params, 1243 in_6g_pwr_type); 1244 } 1245 1246 qdf_export_symbol(wlan_reg_get_5g_bonded_channel_state_for_pwrmode); 1247 1248 enum channel_state 1249 wlan_reg_get_2g_bonded_channel_state_for_freq(struct wlan_objmgr_pdev *pdev, 1250 qdf_freq_t freq, 1251 qdf_freq_t sec_ch_freq, 1252 enum phy_ch_width bw) 1253 { 1254 return reg_get_2g_bonded_channel_state_for_freq(pdev, 1255 freq, 1256 sec_ch_freq, 1257 bw); 1258 } 1259 1260 #ifdef CONFIG_REG_6G_PWRMODE 1261 void wlan_reg_set_channel_params_for_pwrmode(struct wlan_objmgr_pdev *pdev, 1262 qdf_freq_t freq, 1263 qdf_freq_t sec_ch_2g_freq, 1264 struct ch_params *ch_params, 1265 enum supported_6g_pwr_types 1266 in_6g_pwr_mode) 1267 { 1268 reg_set_channel_params_for_pwrmode(pdev, freq, sec_ch_2g_freq, 1269 ch_params, 1270 in_6g_pwr_mode, true); 1271 } 1272 1273 qdf_export_symbol(wlan_reg_set_channel_params_for_pwrmode); 1274 #endif 1275 1276 const struct bonded_channel_freq * 1277 wlan_reg_get_bonded_chan_entry(qdf_freq_t freq, enum phy_ch_width chwidth, 1278 qdf_freq_t cen320_freq) 1279 { 1280 return reg_get_bonded_chan_entry(freq, chwidth, cen320_freq); 1281 } 1282 1283 #ifdef WLAN_FEATURE_11BE 1284 #ifdef CONFIG_REG_6G_PWRMODE 1285 void 1286 wlan_reg_fill_channel_list_for_pwrmode(struct wlan_objmgr_pdev *pdev, 1287 qdf_freq_t freq, 1288 qdf_freq_t sec_ch_2g_freq, 1289 enum phy_ch_width ch_width, 1290 qdf_freq_t band_center_320, 1291 struct reg_channel_list *chan_list, 1292 enum supported_6g_pwr_types 1293 in_6g_pwr_type, 1294 bool treat_nol_chan_as_disabled) 1295 { 1296 reg_fill_channel_list_for_pwrmode(pdev, freq, sec_ch_2g_freq, ch_width, 1297 band_center_320, chan_list, 1298 in_6g_pwr_type, 1299 treat_nol_chan_as_disabled); 1300 } 1301 #endif /* CONFIG_REG_6G_PWRMODE */ 1302 1303 bool wlan_reg_is_punc_bitmap_valid(enum phy_ch_width bw, 1304 uint16_t puncture_bitmap) 1305 { 1306 return reg_is_punc_bitmap_valid(bw, puncture_bitmap); 1307 } 1308 1309 uint16_t wlan_reg_find_nearest_puncture_pattern(enum phy_ch_width bw, 1310 uint16_t proposed_bitmap) 1311 { 1312 return reg_find_nearest_puncture_pattern(bw, proposed_bitmap); 1313 } 1314 1315 QDF_STATUS wlan_reg_extract_puncture_by_bw(enum phy_ch_width ori_bw, 1316 uint16_t ori_puncture_bitmap, 1317 qdf_freq_t freq, 1318 qdf_freq_t cen320_freq, 1319 enum phy_ch_width new_bw, 1320 uint16_t *new_puncture_bitmap) 1321 { 1322 return reg_extract_puncture_by_bw(ori_bw, ori_puncture_bitmap, freq, 1323 cen320_freq, new_bw, 1324 new_puncture_bitmap); 1325 } 1326 1327 void wlan_reg_set_create_punc_bitmap(struct ch_params *ch_params, 1328 bool is_create_punc_bitmap) 1329 { 1330 reg_set_create_punc_bitmap(ch_params, is_create_punc_bitmap); 1331 } 1332 1333 #ifdef CONFIG_REG_CLIENT 1334 QDF_STATUS wlan_reg_apply_puncture(struct wlan_objmgr_pdev *pdev, 1335 uint16_t puncture_bitmap, 1336 qdf_freq_t freq, 1337 enum phy_ch_width bw, 1338 qdf_freq_t cen320_freq) 1339 { 1340 return reg_apply_puncture(pdev, puncture_bitmap, freq, bw, 1341 cen320_freq); 1342 } 1343 1344 QDF_STATUS wlan_reg_remove_puncture(struct wlan_objmgr_pdev *pdev) 1345 { 1346 return reg_remove_puncture(pdev); 1347 } 1348 #endif 1349 #endif /* WLAN_FEATURE_11BE */ 1350 1351 #ifdef CONFIG_REG_6G_PWRMODE 1352 enum channel_state 1353 wlan_reg_get_channel_state_for_pwrmode(struct wlan_objmgr_pdev *pdev, 1354 qdf_freq_t freq, 1355 enum supported_6g_pwr_types 1356 in_6g_pwr_type) 1357 { 1358 return reg_get_channel_state_for_pwrmode(pdev, freq, in_6g_pwr_type); 1359 } 1360 #endif 1361 1362 #ifdef CONFIG_REG_CLIENT 1363 enum channel_state wlan_reg_get_channel_state_from_secondary_list_for_freq( 1364 struct wlan_objmgr_pdev *pdev, 1365 qdf_freq_t freq) 1366 { 1367 return reg_get_channel_state_from_secondary_list_for_freq(pdev, freq); 1368 } 1369 1370 QDF_STATUS 1371 wlan_reg_get_channel_list_with_power(struct wlan_objmgr_pdev *pdev, 1372 struct channel_power *ch_list, 1373 uint8_t *num_chan, 1374 enum supported_6g_pwr_types in_6g_pwr_type) 1375 { 1376 return reg_get_channel_list_with_power(pdev, ch_list, num_chan, 1377 in_6g_pwr_type); 1378 } 1379 #endif 1380 1381 uint8_t wlan_reg_get_channel_reg_power_for_freq(struct wlan_objmgr_pdev *pdev, 1382 qdf_freq_t freq) 1383 { 1384 return reg_get_channel_reg_power_for_freq(pdev, freq); 1385 } 1386 1387 enum reg_wifi_band wlan_reg_freq_to_band(qdf_freq_t freq) 1388 { 1389 return reg_freq_to_band(freq); 1390 } 1391 qdf_export_symbol(wlan_reg_freq_to_band); 1392 1393 qdf_freq_t wlan_reg_min_chan_freq(void) 1394 { 1395 return reg_min_chan_freq(); 1396 } 1397 1398 qdf_freq_t wlan_reg_max_chan_freq(void) 1399 { 1400 return reg_max_chan_freq(); 1401 } 1402 1403 void wlan_reg_freq_width_to_chan_op_class(struct wlan_objmgr_pdev *pdev, 1404 qdf_freq_t freq, 1405 uint16_t chan_width, 1406 bool global_tbl_lookup, 1407 uint16_t behav_limit, 1408 uint8_t *op_class, 1409 uint8_t *chan_num) 1410 { 1411 return reg_freq_width_to_chan_op_class(pdev, freq, chan_width, 1412 global_tbl_lookup, 1413 behav_limit, 1414 op_class, 1415 chan_num); 1416 } 1417 1418 void wlan_reg_freq_width_to_chan_op_class_auto(struct wlan_objmgr_pdev *pdev, 1419 qdf_freq_t freq, 1420 uint16_t chan_width, 1421 bool global_tbl_lookup, 1422 uint16_t behav_limit, 1423 uint8_t *op_class, 1424 uint8_t *chan_num) 1425 { 1426 reg_freq_width_to_chan_op_class_auto(pdev, freq, chan_width, 1427 global_tbl_lookup, 1428 behav_limit, 1429 op_class, 1430 chan_num); 1431 } 1432 1433 qdf_export_symbol(wlan_reg_freq_width_to_chan_op_class_auto); 1434 1435 void wlan_reg_freq_to_chan_op_class(struct wlan_objmgr_pdev *pdev, 1436 qdf_freq_t freq, 1437 bool global_tbl_lookup, 1438 uint16_t behav_limit, 1439 uint8_t *op_class, 1440 uint8_t *chan_num) 1441 { 1442 return reg_freq_to_chan_op_class(pdev, freq, 1443 global_tbl_lookup, 1444 behav_limit, 1445 op_class, 1446 chan_num); 1447 } 1448 1449 bool wlan_reg_is_freq_in_country_opclass(struct wlan_objmgr_pdev *pdev, 1450 const uint8_t country[3], 1451 uint8_t op_class, 1452 qdf_freq_t chan_freq) 1453 { 1454 return reg_is_freq_in_country_opclass(pdev, country, 1455 op_class, chan_freq); 1456 } 1457 1458 enum channel_state 1459 wlan_reg_get_5g_bonded_channel_and_state_for_pwrmode( 1460 struct wlan_objmgr_pdev *pdev, 1461 uint16_t freq, 1462 enum phy_ch_width bw, 1463 const 1464 struct bonded_channel_freq 1465 **bonded_chan_ptr_ptr, 1466 enum supported_6g_pwr_types 1467 in_6g_pwr_mode, 1468 uint16_t input_puncture_bitmap) 1469 { 1470 /* 1471 * Get channel frequencies and state from regulatory 1472 */ 1473 return reg_get_5g_bonded_channel_for_pwrmode(pdev, freq, bw, 1474 bonded_chan_ptr_ptr, 1475 in_6g_pwr_mode, 1476 input_puncture_bitmap); 1477 } 1478 1479 qdf_export_symbol(wlan_reg_get_5g_bonded_channel_and_state_for_pwrmode); 1480 1481 #if defined(WLAN_FEATURE_11BE) && defined(CONFIG_REG_CLIENT) 1482 enum channel_state 1483 wlan_reg_get_bonded_channel_state_for_pwrmode(struct wlan_objmgr_pdev *pdev, 1484 qdf_freq_t freq, 1485 enum phy_ch_width bw, 1486 qdf_freq_t sec_freq, 1487 enum supported_6g_pwr_types 1488 in_6g_pwr_mode) 1489 { 1490 if (WLAN_REG_IS_24GHZ_CH_FREQ(freq)) 1491 return reg_get_2g_bonded_channel_state_for_freq(pdev, freq, 1492 sec_freq, bw); 1493 if (bw == CH_WIDTH_320MHZ) { 1494 const struct bonded_channel_freq *bonded_chan_ptr_ptr = NULL; 1495 1496 return reg_get_chan_state_for_320(pdev, freq, 0, 1497 bw, 1498 &bonded_chan_ptr_ptr, 1499 in_6g_pwr_mode, true, 1500 NO_SCHANS_PUNC); 1501 } else { 1502 struct ch_params params = {0}; 1503 1504 params.ch_width = bw; 1505 1506 return reg_get_5g_bonded_channel_state_for_pwrmode( 1507 pdev, freq, 1508 ¶ms, in_6g_pwr_mode); 1509 } 1510 } 1511 1512 qdf_export_symbol(wlan_reg_get_bonded_channel_state_for_pwrmode); 1513 #endif 1514 #endif /* CONFIG CHAN FREQ API */ 1515 1516 uint16_t wlan_reg_get_op_class_width(struct wlan_objmgr_pdev *pdev, 1517 uint8_t op_class, 1518 bool global_tbl_lookup) 1519 { 1520 return reg_get_op_class_width(pdev, op_class, 1521 global_tbl_lookup); 1522 } 1523 1524 bool wlan_reg_is_5ghz_op_class(const uint8_t *country, uint8_t op_class) 1525 { 1526 return reg_is_5ghz_op_class(country, op_class); 1527 } 1528 1529 bool wlan_reg_is_2ghz_op_class(const uint8_t *country, uint8_t op_class) 1530 { 1531 return reg_is_2ghz_op_class(country, op_class); 1532 } 1533 1534 bool wlan_reg_is_6ghz_op_class(struct wlan_objmgr_pdev *pdev, 1535 uint8_t op_class) 1536 { 1537 return reg_is_6ghz_op_class(pdev, op_class); 1538 } 1539 1540 #ifdef CONFIG_REG_CLIENT 1541 bool wlan_reg_is_6ghz_supported(struct wlan_objmgr_psoc *psoc) 1542 { 1543 return reg_is_6ghz_supported(psoc); 1544 } 1545 #endif 1546 1547 #ifdef HOST_OPCLASS_EXT 1548 qdf_freq_t 1549 wlan_reg_country_chan_opclass_to_freq(struct wlan_objmgr_pdev *pdev, 1550 const uint8_t country[3], 1551 uint8_t chan, uint8_t op_class, 1552 bool strict) 1553 { 1554 return reg_country_chan_opclass_to_freq(pdev, country, chan, op_class, 1555 strict); 1556 } 1557 #endif 1558 1559 uint16_t wlan_reg_chan_opclass_to_freq(uint8_t chan, 1560 uint8_t op_class, 1561 bool global_tbl_lookup) 1562 { 1563 if (!chan || !op_class) 1564 return 0; 1565 1566 return reg_chan_opclass_to_freq(chan, op_class, global_tbl_lookup); 1567 } 1568 1569 qdf_freq_t wlan_reg_chan_opclass_to_freq_auto(uint8_t chan, uint8_t op_class, 1570 bool global_tbl_lookup) 1571 { 1572 if (!chan || !op_class) 1573 return 0; 1574 1575 return reg_chan_opclass_to_freq_auto(chan, op_class, global_tbl_lookup); 1576 } 1577 1578 #ifdef CHECK_REG_PHYMODE 1579 enum reg_phymode wlan_reg_get_max_phymode(struct wlan_objmgr_pdev *pdev, 1580 enum reg_phymode phy_in, 1581 qdf_freq_t freq) 1582 { 1583 return reg_get_max_phymode(pdev, phy_in, freq); 1584 } 1585 #endif /* CHECK_REG_PHYMODE */ 1586 1587 #ifdef CONFIG_REG_CLIENT 1588 enum band_info wlan_reg_band_bitmap_to_band_info(uint32_t band_bitmap) 1589 { 1590 return reg_band_bitmap_to_band_info(band_bitmap); 1591 } 1592 1593 QDF_STATUS 1594 wlan_reg_update_tx_power_on_ctry_change(struct wlan_objmgr_pdev *pdev, 1595 uint8_t vdev_id) 1596 { 1597 return reg_update_tx_power_on_ctry_change(pdev, vdev_id); 1598 } 1599 #endif 1600 1601 #if defined(CONFIG_BAND_6GHZ) 1602 QDF_STATUS wlan_reg_get_rnr_tpe_usable(struct wlan_objmgr_pdev *pdev, 1603 bool *reg_rnr_tpe_usable) 1604 { 1605 return reg_get_rnr_tpe_usable(pdev, reg_rnr_tpe_usable); 1606 } 1607 1608 QDF_STATUS wlan_reg_get_unspecified_ap_usable(struct wlan_objmgr_pdev *pdev, 1609 bool *reg_unspecified_ap_usable) 1610 { 1611 return reg_get_unspecified_ap_usable(pdev, reg_unspecified_ap_usable); 1612 } 1613 1614 QDF_STATUS 1615 wlan_reg_get_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev, 1616 enum reg_6g_ap_type *reg_cur_6g_ap_pwr_type) 1617 { 1618 return reg_get_cur_6g_ap_pwr_type(pdev, reg_cur_6g_ap_pwr_type); 1619 } 1620 1621 qdf_export_symbol(wlan_reg_get_cur_6g_ap_pwr_type); 1622 1623 QDF_STATUS 1624 wlan_reg_get_cur_6g_client_type(struct wlan_objmgr_pdev *pdev, 1625 enum reg_6g_client_type 1626 *reg_cur_6g_client_mobility_type) 1627 { 1628 return reg_get_cur_6g_client_type(pdev, 1629 reg_cur_6g_client_mobility_type); 1630 } 1631 1632 qdf_export_symbol(wlan_reg_get_cur_6g_client_type); 1633 1634 QDF_STATUS 1635 wlan_reg_set_cur_6ghz_client_type(struct wlan_objmgr_pdev *pdev, 1636 enum reg_6g_client_type in_6ghz_client_type) 1637 { 1638 return reg_set_cur_6ghz_client_type(pdev, in_6ghz_client_type); 1639 } 1640 1641 QDF_STATUS 1642 wlan_reg_set_6ghz_client_type_from_target(struct wlan_objmgr_pdev *pdev) 1643 { 1644 return reg_set_6ghz_client_type_from_target(pdev); 1645 } 1646 1647 bool wlan_reg_is_6g_psd_power(struct wlan_objmgr_pdev *pdev) 1648 { 1649 return reg_is_6g_psd_power(pdev); 1650 } 1651 1652 QDF_STATUS wlan_reg_get_6g_chan_ap_power(struct wlan_objmgr_pdev *pdev, 1653 qdf_freq_t chan_freq, bool *is_psd, 1654 uint16_t *tx_power, 1655 uint16_t *eirp_psd_power) 1656 { 1657 return reg_get_6g_chan_ap_power(pdev, chan_freq, is_psd, 1658 tx_power, eirp_psd_power); 1659 } 1660 1661 qdf_export_symbol(wlan_reg_get_6g_chan_ap_power); 1662 1663 QDF_STATUS 1664 wlan_reg_get_client_power_for_connecting_ap(struct wlan_objmgr_pdev *pdev, 1665 enum reg_6g_ap_type ap_type, 1666 qdf_freq_t chan_freq, 1667 bool is_psd, uint16_t *tx_power, 1668 uint16_t *eirp_psd_power) 1669 { 1670 return reg_get_client_power_for_connecting_ap(pdev, ap_type, chan_freq, 1671 is_psd, tx_power, 1672 eirp_psd_power); 1673 } 1674 1675 QDF_STATUS 1676 wlan_reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev *pdev, 1677 enum reg_6g_client_type client_type, 1678 qdf_freq_t chan_freq, 1679 bool *is_psd, uint16_t *tx_power, 1680 uint16_t *eirp_psd_power) 1681 { 1682 return reg_get_client_power_for_6ghz_ap(pdev, client_type, chan_freq, 1683 is_psd, tx_power, 1684 eirp_psd_power); 1685 } 1686 1687 enum reg_6g_ap_type 1688 wlan_reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev) 1689 { 1690 return reg_decide_6g_ap_pwr_type(pdev); 1691 } 1692 1693 QDF_STATUS 1694 wlan_reg_set_ap_pwr_and_update_chan_list(struct wlan_objmgr_pdev *pdev, 1695 enum reg_6g_ap_type ap_pwr_type) 1696 { 1697 return reg_set_ap_pwr_and_update_chan_list(pdev, ap_pwr_type); 1698 } 1699 1700 qdf_export_symbol(wlan_reg_set_ap_pwr_and_update_chan_list); 1701 1702 uint8_t 1703 wlan_reg_get_num_rules_of_ap_pwr_type(struct wlan_objmgr_pdev *pdev, 1704 enum reg_6g_ap_type ap_pwr_type) 1705 { 1706 return reg_get_num_rules_of_ap_pwr_type(pdev, ap_pwr_type); 1707 } 1708 1709 qdf_export_symbol(wlan_reg_get_num_rules_of_ap_pwr_type); 1710 1711 QDF_STATUS wlan_reg_get_superchan_entry( 1712 struct wlan_objmgr_pdev *pdev, 1713 enum channel_enum chan_enum, 1714 const struct super_chan_info **p_sup_chan_entry) 1715 { 1716 return reg_get_superchan_entry(pdev, chan_enum, p_sup_chan_entry); 1717 } 1718 1719 enum supported_6g_pwr_types 1720 wlan_reg_conv_6g_ap_type_to_supported_6g_pwr_types(enum reg_6g_ap_type 1721 ap_pwr_type) 1722 { 1723 return reg_conv_6g_ap_type_to_supported_6g_pwr_types(ap_pwr_type); 1724 } 1725 1726 enum supported_6g_pwr_types 1727 wlan_reg_get_best_6g_pwr_type(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) 1728 { 1729 return reg_get_best_6g_pwr_type(pdev, freq); 1730 } 1731 1732 enum reg_6g_ap_type 1733 wlan_reg_conv_supported_6g_pwr_type_to_ap_pwr_type(enum supported_6g_pwr_types 1734 in_6g_pwr_type) 1735 { 1736 return reg_convert_supported_6g_pwr_type_to_ap_pwr_type(in_6g_pwr_type); 1737 } 1738 #endif /* CONFIG_BAND_6GHZ */ 1739 1740 bool wlan_reg_is_ext_tpc_supported(struct wlan_objmgr_psoc *psoc) 1741 { 1742 return reg_is_ext_tpc_supported(psoc); 1743 } 1744 1745 #ifdef CONFIG_AFC_SUPPORT 1746 bool wlan_reg_is_afc_power_event_received(struct wlan_objmgr_pdev *pdev) 1747 { 1748 return reg_is_afc_power_event_received(pdev); 1749 } 1750 1751 qdf_export_symbol(wlan_reg_is_afc_power_event_received); 1752 1753 bool wlan_reg_is_afc_done(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) 1754 { 1755 return reg_is_afc_done(pdev, freq); 1756 } 1757 1758 qdf_export_symbol(wlan_reg_is_afc_done); 1759 1760 QDF_STATUS wlan_reg_get_afc_req_id(struct wlan_objmgr_pdev *pdev, 1761 uint64_t *req_id) 1762 { 1763 return reg_get_afc_req_id(pdev, req_id); 1764 } 1765 1766 qdf_export_symbol(wlan_reg_get_afc_req_id); 1767 1768 bool wlan_reg_is_afc_expiry_event_received(struct wlan_objmgr_pdev *pdev) 1769 { 1770 return reg_is_afc_expiry_event_received(pdev); 1771 } 1772 1773 qdf_export_symbol(wlan_reg_is_afc_expiry_event_received); 1774 1775 bool wlan_reg_is_noaction_on_afc_pwr_evt(struct wlan_objmgr_pdev *pdev) 1776 { 1777 return reg_is_noaction_on_afc_pwr_evt(pdev); 1778 } 1779 1780 QDF_STATUS 1781 wlan_reg_get_afc_dev_deploy_type(struct wlan_objmgr_pdev *pdev, 1782 enum reg_afc_dev_deploy_type *afc_dev_type) 1783 { 1784 return reg_get_afc_dev_deploy_type(pdev, afc_dev_type); 1785 } 1786 1787 qdf_export_symbol(wlan_reg_get_afc_dev_deploy_type); 1788 1789 bool 1790 wlan_reg_is_sta_connect_allowed(struct wlan_objmgr_pdev *pdev, 1791 enum reg_6g_ap_type root_ap_pwr_mode) 1792 { 1793 return reg_is_sta_connect_allowed(pdev, root_ap_pwr_mode); 1794 } 1795 1796 qdf_export_symbol(wlan_reg_is_sta_connect_allowed); 1797 #endif /* CONFIG_AFC_SUPPORT */ 1798 1799 QDF_STATUS wlan_reg_is_chwidth_supported(struct wlan_objmgr_pdev *pdev, 1800 enum phy_ch_width ch_width, 1801 bool *is_supported) 1802 { 1803 return reg_is_chwidth_supported(pdev, ch_width, is_supported); 1804 } 1805 1806 qdf_export_symbol(wlan_reg_is_chwidth_supported); 1807 1808 #ifdef CONFIG_BAND_6GHZ 1809 qdf_freq_t wlan_reg_get_thresh_priority_freq(struct wlan_objmgr_pdev *pdev) 1810 { 1811 return reg_get_thresh_priority_freq(pdev); 1812 } 1813 1814 QDF_STATUS wlan_reg_psd_2_eirp(struct wlan_objmgr_pdev *pdev, 1815 int16_t psd, 1816 uint16_t ch_bw, 1817 int16_t *eirp) 1818 { 1819 return reg_psd_2_eirp(pdev, psd, ch_bw, eirp); 1820 } 1821 1822 qdf_export_symbol(wlan_reg_psd_2_eirp); 1823 1824 QDF_STATUS wlan_reg_eirp_2_psd(struct wlan_objmgr_pdev *pdev, uint16_t ch_bw, 1825 int16_t eirp, int16_t *psd) 1826 { 1827 return reg_eirp_2_psd(pdev, ch_bw, eirp, psd); 1828 } 1829 1830 enum reg_6g_ap_type 1831 wlan_reg_get_best_pwr_mode(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq, 1832 qdf_freq_t cen320, 1833 uint16_t bw, uint16_t in_punc_pattern) 1834 { 1835 return reg_get_best_pwr_mode(pdev, freq, cen320, bw, in_punc_pattern); 1836 } 1837 1838 qdf_export_symbol(wlan_reg_get_best_pwr_mode); 1839 1840 uint8_t wlan_reg_get_eirp_pwr(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq, 1841 qdf_freq_t cen320, uint16_t bw, 1842 enum reg_6g_ap_type ap_pwr_type, 1843 uint16_t in_punc_pattern, 1844 bool is_client_list_lookup_needed, 1845 enum reg_6g_client_type client_type) 1846 { 1847 return reg_get_eirp_pwr(pdev, freq, cen320, bw, ap_pwr_type, 1848 in_punc_pattern, is_client_list_lookup_needed, 1849 client_type); 1850 } 1851 1852 qdf_export_symbol(wlan_reg_get_eirp_pwr); 1853 1854 #endif /* CONFIG_BAND_6GHZ */ 1855 1856 enum phy_ch_width wlan_reg_find_chwidth_from_bw(uint16_t bw) 1857 { 1858 return reg_find_chwidth_from_bw(bw); 1859 } 1860 1861 #ifdef WLAN_FEATURE_11BE 1862 enum channel_state 1863 wlan_reg_get_chan_state_for_320(struct wlan_objmgr_pdev *pdev, 1864 uint16_t freq, 1865 qdf_freq_t center_320, 1866 enum phy_ch_width ch_width, 1867 const struct bonded_channel_freq 1868 **bonded_chan_ptr_ptr, 1869 enum supported_6g_pwr_types in_6g_pwr_type, 1870 bool treat_nol_chan_as_disabled, 1871 uint16_t input_puncture_bitmap) 1872 { 1873 return reg_get_chan_state_for_320(pdev, freq, center_320, 1874 ch_width, bonded_chan_ptr_ptr, 1875 in_6g_pwr_type, 1876 treat_nol_chan_as_disabled, 1877 input_puncture_bitmap); 1878 } 1879 #endif 1880 1881 #ifdef CONFIG_BAND_6GHZ 1882 bool wlan_is_sup_chan_entry_afc_done(struct wlan_objmgr_pdev *pdev, 1883 enum channel_enum chan_idx, 1884 enum supported_6g_pwr_types in_6g_pwr_mode) 1885 { 1886 return reg_is_sup_chan_entry_afc_done(pdev, chan_idx, in_6g_pwr_mode); 1887 } 1888 1889 qdf_export_symbol(wlan_is_sup_chan_entry_afc_done); 1890 1891 QDF_STATUS 1892 wlan_reg_display_super_chan_list(struct wlan_objmgr_pdev *pdev) 1893 { 1894 return reg_display_super_chan_list(pdev); 1895 } 1896 1897 #if defined(CONFIG_AFC_SUPPORT) && defined(CONFIG_BAND_6GHZ) 1898 QDF_STATUS 1899 wlan_reg_get_afc_freq_range_and_psd_limits(struct wlan_objmgr_pdev *pdev, 1900 uint8_t num_freq_obj, 1901 struct afc_freq_obj *afc_obj) 1902 { 1903 return reg_get_afc_freq_range_and_psd_limits(pdev, num_freq_obj, 1904 afc_obj); 1905 } 1906 1907 QDF_STATUS 1908 wlan_reg_get_num_afc_freq_obj(struct wlan_objmgr_pdev *pdev, 1909 uint8_t *num_freq_obj) 1910 { 1911 return reg_get_num_afc_freq_obj(pdev, num_freq_obj); 1912 } 1913 1914 QDF_STATUS wlan_reg_set_afc_power_event_received(struct wlan_objmgr_pdev *pdev, 1915 bool val) 1916 { 1917 return reg_set_afc_power_event_received(pdev, val); 1918 } 1919 #endif 1920 1921 #endif 1922 1923 #ifdef CONFIG_REG_CLIENT 1924 QDF_STATUS 1925 wlan_reg_recompute_current_chan_list(struct wlan_objmgr_psoc *psoc, 1926 struct wlan_objmgr_pdev *pdev) 1927 { 1928 struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; 1929 1930 pdev_priv_obj = reg_get_pdev_obj(pdev); 1931 if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) { 1932 reg_err("reg pdev priv obj is NULL"); 1933 return QDF_STATUS_E_FAILURE; 1934 } 1935 1936 reg_debug("Recomputing the current channel list"); 1937 reg_compute_pdev_current_chan_list(pdev_priv_obj); 1938 return reg_send_scheduler_msg_nb(psoc, pdev); 1939 } 1940 1941 QDF_STATUS 1942 wlan_reg_modify_indoor_concurrency(struct wlan_objmgr_pdev *pdev, 1943 uint8_t vdev_id, uint32_t freq, 1944 enum phy_ch_width width, bool add) 1945 { 1946 if (add) 1947 return reg_add_indoor_concurrency(pdev, vdev_id, freq, width); 1948 else 1949 return reg_remove_indoor_concurrency(pdev, vdev_id, freq); 1950 } 1951 #endif 1952