1 /* 2 * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. 4 * 5 * Permission to use, copy, modify, and/or distribute this software for 6 * any purpose with or without fee is hereby granted, provided that the 7 * above copyright notice and this permission notice appear in all 8 * copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 /** 21 * DOC: wlan_reg_services_api.h 22 * This file provides prototypes of the routines needed for the 23 * external components to utilize the services provided by the 24 * regulatory component. 25 */ 26 27 #ifndef __WLAN_REG_SERVICES_API_H 28 #define __WLAN_REG_SERVICES_API_H 29 30 #include <reg_services_public_struct.h> 31 32 /** 33 * wlan_reg_max_5ghz_ch_num() - Get maximum 5GHz channel number 34 * 35 * Return: Maximum 5GHz channel number 36 */ 37 #define WLAN_REG_MAX_5GHZ_CH_NUM wlan_reg_max_5ghz_ch_num() 38 uint8_t wlan_reg_max_5ghz_ch_num(void); 39 40 #ifdef CONFIG_CHAN_FREQ_API 41 /** 42 * wlan_reg_min_24ghz_chan_freq() - Get minimum 2.4GHz channel frequency 43 * 44 * Return: Minimum 2.4GHz channel frequency 45 */ 46 #define WLAN_REG_MIN_24GHZ_CHAN_FREQ wlan_reg_min_24ghz_chan_freq() 47 qdf_freq_t wlan_reg_min_24ghz_chan_freq(void); 48 49 /** 50 * wlan_reg_max_24ghz_chan_freq() - Get maximum 2.4GHz channel frequency 51 * 52 * Return: Maximum 2.4GHz channel frequency 53 */ 54 #define WLAN_REG_MAX_24GHZ_CHAN_FREQ wlan_reg_max_24ghz_chan_freq() 55 qdf_freq_t wlan_reg_max_24ghz_chan_freq(void); 56 57 /** 58 * wlan_reg_min_5ghz_chan_freq() - Get minimum 5GHz channel frequency 59 * 60 * Return: Minimum 5GHz channel frequency 61 */ 62 #define WLAN_REG_MIN_5GHZ_CHAN_FREQ wlan_reg_min_5ghz_chan_freq() 63 qdf_freq_t wlan_reg_min_5ghz_chan_freq(void); 64 65 /** 66 * wlan_reg_max_5ghz_chan_freq() - Get maximum 5GHz channel frequency 67 * 68 * Return: Maximum 5GHz channel frequency 69 */ 70 #define WLAN_REG_MAX_5GHZ_CHAN_FREQ wlan_reg_max_5ghz_chan_freq() 71 qdf_freq_t wlan_reg_max_5ghz_chan_freq(void); 72 #endif /* CONFIG_CHAN_FREQ_API */ 73 74 /** 75 * wlan_reg_is_24ghz_ch_freq() - Check if the given channel frequency is 2.4GHz 76 * @freq: Channel frequency 77 * 78 * Return: true if channel frequency is 2.4GHz, else false 79 */ 80 #define WLAN_REG_IS_24GHZ_CH_FREQ(freq) wlan_reg_is_24ghz_ch_freq(freq) 81 bool wlan_reg_is_24ghz_ch_freq(qdf_freq_t freq); 82 83 /** 84 * wlan_reg_is_5ghz_ch_freq() - Check if the given channel frequency is 5GHz 85 * @freq: Channel frequency 86 * 87 * Return: true if channel frequency is 5GHz, else false 88 */ 89 #define WLAN_REG_IS_5GHZ_CH_FREQ(freq) wlan_reg_is_5ghz_ch_freq(freq) 90 bool wlan_reg_is_5ghz_ch_freq(qdf_freq_t freq); 91 92 /** 93 * wlan_reg_is_range_overlap_2g() - Check if the given low_freq and high_freq 94 * is in the 2G range. 95 * 96 * @low_freq - Low frequency. 97 * @high_freq - High frequency. 98 * 99 * Return: Return true if given low_freq and high_freq overlaps 2G range, 100 * else false. 101 */ 102 bool wlan_reg_is_range_overlap_2g(qdf_freq_t low_freq, qdf_freq_t high_freq); 103 104 /** 105 * wlan_reg_is_range_overlap_5g() - Check if the given low_freq and high_freq 106 * is in the 5G range. 107 * 108 * @low_freq - Low frequency. 109 * @high_freq - High frequency. 110 * 111 * Return: Return true if given low_freq and high_freq overlaps 5G range, 112 * else false. 113 */ 114 bool wlan_reg_is_range_overlap_5g(qdf_freq_t low_freq, qdf_freq_t high_freq); 115 116 /** 117 * wlan_reg_is_freq_indoor() - Check if a frequency is indoor. 118 * @pdev: Pointer to pdev. 119 * @freq: Channel frequency. 120 * 121 * Return: Return true if a frequency is indoor, else false. 122 */ 123 bool wlan_reg_is_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); 124 125 /** 126 * wlan_reg_get_min_chwidth() - Return min chanwidth supported by freq. 127 * @pdev: Pointer to pdev. 128 * @freq: Channel frequency. 129 * 130 * Return: Min chwidth supported by freq as per regulatory DB. 131 */ 132 uint16_t wlan_reg_get_min_chwidth(struct wlan_objmgr_pdev *pdev, 133 qdf_freq_t freq); 134 135 /** 136 * wlan_reg_get_max_chwidth() - Return max chanwidth supported by freq. 137 * @pdev: Pointer to pdev. 138 * @freq: Channel frequency. 139 * 140 * Return: Max chwidth supported by freq as per regulatory DB. 141 */ 142 uint16_t wlan_reg_get_max_chwidth(struct wlan_objmgr_pdev *pdev, 143 qdf_freq_t freq); 144 145 /** 146 * wlan_reg_get_next_lower_bandwidth() - Get next lower bandwdith 147 * @ch_width: channel bandwdith 148 * 149 * Return: Return next lower bandwidth of input channel bandwidth 150 */ 151 enum phy_ch_width 152 wlan_reg_get_next_lower_bandwidth(enum phy_ch_width ch_width); 153 154 #ifdef CONFIG_REG_CLIENT 155 /** 156 * wlan_reg_is_freq_indoor_in_secondary_list() - Check if the input frequency is 157 * an indoor frequency in the secondary list 158 * @pdev: Pointer to pdev. 159 * @freq: Channel frequency. 160 * 161 * Return: Return true if a frequency is indoor, else false. 162 */ 163 bool wlan_reg_is_freq_indoor_in_secondary_list(struct wlan_objmgr_pdev *pdev, 164 qdf_freq_t freq); 165 #endif 166 167 #ifdef CONFIG_BAND_6GHZ 168 /** 169 * wlan_reg_is_6ghz_chan_freq() - Check if the given channel frequency is 6GHz 170 * @freq: Channel frequency 171 * 172 * Return: true if channel frequency is 6GHz, else false 173 */ 174 #define WLAN_REG_IS_6GHZ_CHAN_FREQ(freq) wlan_reg_is_6ghz_chan_freq(freq) 175 bool wlan_reg_is_6ghz_chan_freq(uint16_t freq); 176 177 #ifdef CONFIG_6G_FREQ_OVERLAP 178 /** 179 * wlan_reg_is_range_only6g() - Check if the given low_freq and high_freq 180 * is in the 6G range. 181 * @low_freq - Low frequency. 182 * @high_freq - High frequency. 183 * 184 * Return: Return true if given low_freq and high_freq overlaps 6G range, 185 * else false. 186 */ 187 bool wlan_reg_is_range_only6g(qdf_freq_t low_freq, qdf_freq_t high_freq); 188 189 /** 190 * wlan_reg_is_range_overlap_6g() - Check if the given low_freq and high_freq 191 * is in the 6G range. 192 * 193 * @low_freq - Low frequency. 194 * @high_freq - High frequency. 195 * 196 * Return: Return true if given low_freq and high_freq overlaps 6G range, 197 * else false. 198 */ 199 bool wlan_reg_is_range_overlap_6g(qdf_freq_t low_freq, qdf_freq_t high_freq); 200 #else 201 static inline bool wlan_reg_is_range_only6g(qdf_freq_t low_freq, 202 qdf_freq_t high_freq) 203 { 204 return false; 205 } 206 207 static inline bool wlan_reg_is_range_overlap_6g(qdf_freq_t low_freq, 208 qdf_freq_t high_freq) 209 { 210 return false; 211 } 212 #endif 213 214 /** 215 * wlan_reg_get_6g_ap_master_chan_list() - provide the appropriate ap master 216 * channel list 217 * @pdev: pdev pointer 218 * @ap_pwr_type: The ap power type (LPI/VLP/SP) 219 * @chan_list: channel list pointer 220 * 221 * Return: QDF_STATUS 222 */ 223 QDF_STATUS wlan_reg_get_6g_ap_master_chan_list( 224 struct wlan_objmgr_pdev *pdev, 225 enum reg_6g_ap_type ap_pwr_type, 226 struct regulatory_channel *chan_list); 227 228 #ifdef CONFIG_REG_CLIENT 229 /** 230 * wlan_reg_get_power_string () - wlan reg get power type string 231 * @power_type: power type enum 232 * 233 * Return: power type string 234 */ 235 const char *wlan_reg_get_power_string(enum reg_6g_ap_type power_type); 236 #endif 237 238 /** 239 * wlan_reg_is_6ghz_psc_chan_freq() - Check if the given 6GHz channel frequency 240 * is preferred scanning channel frequency. 241 * @freq: Channel frequency 242 * 243 * Return: true if given 6GHz channel frequency is preferred scanning channel 244 * frequency, else false 245 */ 246 #define WLAN_REG_IS_6GHZ_PSC_CHAN_FREQ(freq) \ 247 wlan_reg_is_6ghz_psc_chan_freq(freq) 248 bool wlan_reg_is_6ghz_psc_chan_freq(uint16_t freq); 249 250 /** 251 * wlan_reg_min_6ghz_chan_freq() - Get minimum 6GHz channel center frequency 252 * 253 * Return: Minimum 6GHz channel center frequency 254 */ 255 #define WLAN_REG_MIN_6GHZ_CHAN_FREQ wlan_reg_min_6ghz_chan_freq() 256 uint16_t wlan_reg_min_6ghz_chan_freq(void); 257 258 /** 259 * wlan_reg_max_6ghz_chan_freq() - Get maximum 6GHz channel center frequency 260 * 261 * Return: Maximum 6GHz channel center frequency 262 */ 263 #define WLAN_REG_MAX_6GHZ_CHAN_FREQ wlan_reg_max_6ghz_chan_freq() 264 uint16_t wlan_reg_max_6ghz_chan_freq(void); 265 266 /** 267 * wlan_reg_is_6g_freq_indoor() - Check if a 6GHz frequency is indoor. 268 * @pdev: Pointer to pdev. 269 * @freq: Channel frequency. 270 * 271 * Return: Return true if a 6GHz frequency is indoor, else false. 272 */ 273 #define WLAN_REG_IS_6GHZ_FREQ_INDOOR(pdev, freq) \ 274 wlan_reg_is_6g_freq_indoor(pdev, freq) 275 bool wlan_reg_is_6g_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); 276 277 /** 278 * wlan_reg_get_max_txpower_for_6g_tpe() - Get max txpower for 6G TPE IE. 279 * @pdev: Pointer to pdev. 280 * @freq: Channel frequency. 281 * @bw: Channel bandwidth. 282 * @reg_ap: Regulatory 6G AP type. 283 * @reg_client: Regulatory client type. 284 * @is_psd: True if txpower is needed in PSD format, and false if needed in EIRP 285 * format. 286 * @tx_power: Pointer to tx-power. 287 * 288 * Return: Return QDF_STATUS_SUCCESS, if tx_power is filled for 6G TPE IE 289 * else return QDF_STATUS_E_FAILURE. 290 */ 291 QDF_STATUS 292 wlan_reg_get_max_txpower_for_6g_tpe(struct wlan_objmgr_pdev *pdev, 293 qdf_freq_t freq, uint8_t bw, 294 enum reg_6g_ap_type reg_ap, 295 enum reg_6g_client_type reg_client, 296 bool is_psd, 297 uint8_t *tx_power); 298 299 /** 300 * wlan_reg_get_superchan_entry() - Get the address of the super channel list 301 * entry for a given input channel index. 302 * 303 * @pdev: pdev ptr 304 * @chan_enum: Channel enum 305 * @p_sup_chan_entry: Pointer to address of *p_sup_chan_entry 306 * 307 * Return: QDF_STATUS_SUCCESS if super channel entry is available for the input 308 * chan_enum else QDF_STATUS_E_FAILURE 309 */ 310 QDF_STATUS wlan_reg_get_superchan_entry( 311 struct wlan_objmgr_pdev *pdev, 312 enum channel_enum chan_enum, 313 const struct super_chan_info **p_sup_chan_entry); 314 #else 315 316 #define WLAN_REG_IS_6GHZ_CHAN_FREQ(freq) (false) 317 static inline bool wlan_reg_is_6ghz_chan_freq(uint16_t freq) 318 { 319 return false; 320 } 321 322 static inline bool wlan_reg_is_range_only6g(qdf_freq_t low_freq, 323 qdf_freq_t high_freq) 324 { 325 return false; 326 } 327 328 #define WLAN_REG_IS_6GHZ_PSC_CHAN_FREQ(freq) (false) 329 static inline bool wlan_reg_is_6ghz_psc_chan_freq(uint16_t freq) 330 { 331 return false; 332 } 333 334 #define WLAN_REG_MIN_6GHZ_CHAN_FREQ (false) 335 static inline uint16_t wlan_reg_min_6ghz_chan_freq(void) 336 { 337 return 0; 338 } 339 340 #define WLAN_REG_MAX_6GHZ_CHAN_FREQ (false) 341 static inline uint16_t wlan_reg_max_6ghz_chan_freq(void) 342 { 343 return 0; 344 } 345 346 #define WLAN_REG_IS_6GHZ_FREQ_INDOOR(pdev, freq) (false) 347 static inline bool 348 wlan_reg_is_6g_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) 349 { 350 return false; 351 } 352 353 static inline bool wlan_reg_is_range_overlap_6g(qdf_freq_t low_freq, 354 qdf_freq_t high_freq) 355 { 356 return false; 357 } 358 359 static inline QDF_STATUS 360 wlan_reg_get_max_txpower_for_6g_tpe(struct wlan_objmgr_pdev *pdev, 361 qdf_freq_t freq, uint8_t bw, 362 enum reg_6g_ap_type reg_ap, 363 enum reg_6g_client_type reg_client, 364 bool is_psd, 365 uint8_t *tx_power) 366 { 367 return QDF_STATUS_E_FAILURE; 368 } 369 370 static inline QDF_STATUS 371 wlan_reg_get_6g_ap_master_chan_list(struct wlan_objmgr_pdev *pdev, 372 enum reg_6g_ap_type ap_pwr_type, 373 struct regulatory_channel *chan_list) 374 { 375 return QDF_STATUS_E_FAILURE; 376 } 377 378 static inline 379 QDF_STATUS wlan_reg_get_superchan_entry( 380 struct wlan_objmgr_pdev *pdev, 381 enum channel_enum chan_enum, 382 const struct super_chan_info **p_sup_chan_entry) 383 { 384 *p_sup_chan_entry = NULL; 385 return QDF_STATUS_E_NOSUPPORT; 386 } 387 388 static inline 389 const char *wlan_reg_get_power_string(enum reg_6g_ap_type power_type) 390 { 391 return "INVALID"; 392 } 393 #endif /* CONFIG_BAND_6GHZ */ 394 395 /** 396 * wlan_reg_get_band_channel_list() - Get channel list based on the band_mask 397 * @pdev: pdev ptr 398 * @band_mask: Input bitmap with band set 399 * @channel_list: Pointer to Channel List 400 * 401 * Get the given channel list and number of channels from the current channel 402 * list based on input band bitmap. 403 * 404 * Return: Number of channels, else 0 to indicate error 405 */ 406 uint16_t 407 wlan_reg_get_band_channel_list(struct wlan_objmgr_pdev *pdev, 408 uint8_t band_mask, 409 struct regulatory_channel *channel_list); 410 411 #ifdef CONFIG_REG_6G_PWRMODE 412 /** 413 * wlan_reg_get_band_channel_list_for_pwrmode() - Get channel list based on the 414 * band_mask and input 6G power mode. 415 * @pdev: pdev ptr 416 * @band_mask: Input bitmap with band set 417 * @channel_list: Pointer to Channel List 418 * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup. 419 * 420 * Get the given channel list and number of channels from the current channel 421 * list based on input band bitmap. 422 * 423 * Return: Number of channels, else 0 to indicate error 424 */ 425 uint16_t 426 wlan_reg_get_band_channel_list_for_pwrmode(struct wlan_objmgr_pdev *pdev, 427 uint8_t band_mask, 428 struct regulatory_channel 429 *channel_list, 430 enum supported_6g_pwr_types 431 in_6g_pwr_type); 432 #endif 433 434 #ifdef CONFIG_REG_CLIENT 435 /** 436 * wlan_reg_get_secondary_band_channel_list() - Get secondary channel list for 437 * SAP based on the band_mask 438 * @pdev: pdev ptr 439 * @band_mask: Input bitmap with band set 440 * @channel_list: Pointer to Channel List 441 * 442 * Get the given channel list and number of channels from the secondary current 443 * channel list based on input band bitmap. 444 * 445 * Return: Number of channels, else 0 to indicate error 446 */ 447 uint16_t 448 wlan_reg_get_secondary_band_channel_list(struct wlan_objmgr_pdev *pdev, 449 uint8_t band_mask, 450 struct regulatory_channel 451 *channel_list); 452 #endif 453 454 /** 455 * wlan_reg_chan_band_to_freq - Return channel frequency based on the channel 456 * number and band. 457 * @pdev: pdev ptr 458 * @chan: Channel Number 459 * @band_mask: Bitmap for bands 460 * 461 * Return: Return channel frequency or return 0, if the channel is disabled or 462 * if the input channel number or band_mask is invalid. Composite bands are 463 * supported only for 2.4Ghz and 5Ghz bands. For other bands the following 464 * priority is given: 1) 6Ghz 2) 5Ghz 3) 2.4Ghz. 465 */ 466 qdf_freq_t wlan_reg_chan_band_to_freq(struct wlan_objmgr_pdev *pdev, 467 uint8_t chan, 468 uint8_t band_mask); 469 470 #ifdef CONFIG_49GHZ_CHAN 471 /** 472 * wlan_reg_is_49ghz_freq() - Check if the given channel frequency is 4.9GHz 473 * @freq: Channel frequency 474 * 475 * Return: true if channel frequency is 4.9GHz, else false 476 */ 477 #define WLAN_REG_IS_49GHZ_FREQ(freq) wlan_reg_is_49ghz_freq(freq) 478 bool wlan_reg_is_49ghz_freq(qdf_freq_t freq); 479 480 #else 481 482 #define WLAN_REG_IS_49GHZ_FREQ(freq) (false) 483 static inline bool wlan_reg_is_49ghz_freq(qdf_freq_t freq) 484 { 485 return false; 486 } 487 #endif /* CONFIG_49GHZ_CHAN */ 488 489 /** 490 * wlan_reg_ch_num() - Get channel number from channel enum 491 * @ch_enum: Channel enum 492 * 493 * Return: channel number 494 */ 495 #define WLAN_REG_CH_NUM(ch_enum) wlan_reg_ch_num(ch_enum) 496 uint8_t wlan_reg_ch_num(uint32_t ch_enum); 497 498 /** 499 * wlan_reg_ch_to_freq() - Get channel frequency from channel enum 500 * @ch_enum: Channel enum 501 * 502 * Return: channel frequency 503 */ 504 #define WLAN_REG_CH_TO_FREQ(ch_enum) wlan_reg_ch_to_freq(ch_enum) 505 qdf_freq_t wlan_reg_ch_to_freq(uint32_t ch_enum); 506 507 /** 508 * wlan_reg_read_default_country() - Read the default country for the regdomain 509 * @country: pointer to the country code. 510 * 511 * Return: QDF_STATUS 512 */ 513 QDF_STATUS wlan_reg_read_default_country(struct wlan_objmgr_psoc *psoc, 514 uint8_t *country); 515 516 /** 517 * wlan_reg_get_ctry_idx_max_bw_from_country_code() - Get the max 5G 518 * bandwidth from country code 519 * @pdev: pdev pointer 520 * @cc: Country Code 521 * @max_bw_5g: Max 5G bandwidth supported by the country 522 * 523 * Return: QDF_STATUS 524 */ 525 526 QDF_STATUS wlan_reg_get_max_5g_bw_from_country_code( 527 struct wlan_objmgr_pdev *pdev, 528 uint16_t cc, 529 uint16_t *max_bw_5g); 530 531 /** 532 * wlan_reg_get_max_5g_bw_from_regdomain() - Get the max 5G bandwidth 533 * supported by the regdomain 534 * @pdev: pdev pointer 535 * @orig_regdmn: Regdomain Pair value 536 * @max_bw_5g: Max 5G bandwidth supported by the country 537 * 538 * Return: QDF_STATUS 539 */ 540 QDF_STATUS wlan_reg_get_max_5g_bw_from_regdomain( 541 struct wlan_objmgr_pdev *pdev, 542 uint16_t regdmn, 543 uint16_t *max_bw_5g); 544 545 /** 546 * wlan_reg_get_max_bw_5G_for_fo() - get max_5g_bw for FullOffload 547 * @pdev: PDEV object 548 * 549 * API to get max_bw_5g from pdev object 550 * 551 * Return: @max_bw_5g 552 */ 553 QDF_STATUS wlan_reg_get_max_bw_5G_for_fo(struct wlan_objmgr_pdev *pdev); 554 555 /** 556 * wlan_reg_is_regdb_offloaded() - get offload_enabled 557 * @psoc: Psoc object 558 * 559 * API to get offload_enabled from psoc. 560 * 561 * Return: true if offload enabled 562 */ 563 564 bool wlan_reg_is_regdb_offloaded(struct wlan_objmgr_psoc *psoc); 565 566 /** 567 * wlan_reg_get_fcc_constraint() - Check FCC constraint on given frequency 568 * @pdev: physical dev to get 569 * @freq: frequency to be checked 570 * 571 * Return: If FCC constraint is on applied given frequency return true 572 * else return false. 573 */ 574 bool wlan_reg_get_fcc_constraint(struct wlan_objmgr_pdev *pdev, uint32_t freq); 575 576 #ifdef CONFIG_REG_CLIENT 577 /** 578 * wlan_reg_read_current_country() - Read the current country for the regdomain 579 * @country: pointer to the country code. 580 * 581 * Return: QDF_STATUS 582 */ 583 QDF_STATUS wlan_reg_read_current_country(struct wlan_objmgr_psoc *psoc, 584 uint8_t *country); 585 586 #ifdef CONFIG_REG_CLIENT 587 /** 588 * wlan_reg_get_6g_power_type_for_ctry() - Return power type for 6G based 589 * on country IE 590 * @ap_ctry: ptr to country string in country IE 591 * @sta_ctry: ptr to sta programmed country 592 * @pwr_type_6g: ptr to 6G power type 593 * @ctry_code_match: Check for country IE and sta country code match 594 * @ap_pwr_type: AP's power type for 6G as advertised in HE ops IE 595 * Return: QDF_STATUS 596 */ 597 QDF_STATUS 598 wlan_reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc, 599 uint8_t *ap_ctry, uint8_t *sta_ctry, 600 enum reg_6g_ap_type *pwr_type_6g, 601 bool *ctry_code_match, 602 enum reg_6g_ap_type ap_pwr_type); 603 #endif 604 605 #ifdef CONFIG_CHAN_FREQ_API 606 /** 607 * wlan_reg_is_etsi13_srd_chan_for_freq () - Checks if the ch is ETSI13 srd ch 608 * or not 609 * @pdev: pdev ptr 610 * @freq: channel center frequency 611 * 612 * Return: true or false 613 */ 614 bool wlan_reg_is_etsi13_srd_chan_for_freq(struct wlan_objmgr_pdev *pdev, 615 qdf_freq_t freq); 616 #endif /*CONFIG_CHAN_FREQ_API*/ 617 618 /** 619 * wlan_reg_is_etsi13_regdmn() - Checks if current reg domain is ETSI13 or not 620 * @pdev: pdev ptr 621 * 622 * Return: true or false 623 */ 624 bool wlan_reg_is_etsi13_regdmn(struct wlan_objmgr_pdev *pdev); 625 626 /** 627 * wlan_reg_is_etsi13_srd_chan_allowed_master_mode() - Checks if regdmn is 628 * ETSI13 and SRD channels are allowed in master mode or not. 629 * 630 * @pdev: pdev ptr 631 * 632 * Return: true or false 633 */ 634 bool wlan_reg_is_etsi13_srd_chan_allowed_master_mode(struct wlan_objmgr_pdev 635 *pdev); 636 #endif 637 638 /** 639 * wlan_reg_is_world() - reg is world mode 640 * @country: The country information 641 * 642 * Return: true or false 643 */ 644 bool wlan_reg_is_world(uint8_t *country); 645 646 /** 647 * wlan_reg_get_dfs_region () - Get the current dfs region 648 * @dfs_reg: pointer to dfs region 649 * 650 * Return: Status 651 */ 652 QDF_STATUS wlan_reg_get_dfs_region(struct wlan_objmgr_pdev *pdev, 653 enum dfs_reg *dfs_reg); 654 655 /** 656 * wlan_reg_is_chan_disabled_and_not_nol() - In the regulatory channel list, a 657 * channel may be disabled by the regulatory/device or by radar. Radar is 658 * temporary and a radar disabled channel does not mean that the channel is 659 * permanently disabled. The API checks if the channel is disabled, but not due 660 * to radar. 661 * @chan - Regulatory channel object 662 * 663 * Return - True, the channel is disabled, but not due to radar, else false. 664 */ 665 bool wlan_reg_is_chan_disabled_and_not_nol(struct regulatory_channel *chan); 666 667 /** 668 * wlan_reg_get_current_chan_list() - provide the pdev current channel list 669 * @pdev: pdev pointer 670 * @chan_list: channel list pointer 671 * 672 * Return: QDF_STATUS 673 */ 674 QDF_STATUS wlan_reg_get_current_chan_list(struct wlan_objmgr_pdev *pdev, 675 struct regulatory_channel *chan_list); 676 677 /** 678 * wlan_reg_is_freq_enabled() - Checks if the given frequency is enabled on the 679 * given power mode or not. If the frequency is not a 6G frequency then the 680 * input power mode is ignored and only current channel list is searched. 681 * 682 * @pdev: pdev pointer. 683 * @freq: input frequency. 684 * @in_6g_pwr_mode: Power mode on which the freq is enabled or not is to be 685 * checked. 686 * 687 * Return: True if the frequency is present in the given power mode channel 688 * list. 689 */ 690 bool wlan_reg_is_freq_enabled(struct wlan_objmgr_pdev *pdev, 691 qdf_freq_t freq, 692 enum supported_6g_pwr_types in_6g_pwr_mode); 693 694 /** 695 * wlan_reg_is_freq_idx_enabled() - Checks if the given frequency index is 696 * enabled on the given power mode or not. If the frequency index is not a 6G 697 * frequency then the input power mode is ignored and only current channel list 698 * is searched. 699 * 700 * @pdev: pdev pointer. 701 * @freq_idx: input frequency index. 702 * @in_6g_pwr_mode: Power mode on which the frequency index is enabled or not 703 * is to be checked. 704 * 705 * Return: True if the frequency index is present in the given power mode 706 * channel list. 707 */ 708 bool wlan_reg_is_freq_idx_enabled(struct wlan_objmgr_pdev *pdev, 709 enum channel_enum freq_idx, 710 enum supported_6g_pwr_types in_6g_pwr_mode); 711 712 /** 713 * wlan_reg_get_pwrmode_chan_list() - Get the modified channel list. A modified 714 * current channel list consists of 2G and 5G portions of the current channel 715 * list and the 6G portion of the current channel list is derived from the input 716 * 6g power type. 717 * @pdev: Pointer to pdev 718 * @chan_list: Pointer to buffer which stores list of regulatory_channels. 719 * @in_6g_pwr_mode: 6GHz power type 720 * 721 * Return: 722 * QDF_STATUS_SUCCESS: Success 723 * QDF_STATUS_E_INVAL: Failed to get channel list 724 */ 725 QDF_STATUS wlan_reg_get_pwrmode_chan_list(struct wlan_objmgr_pdev *pdev, 726 struct regulatory_channel *chan_list, 727 enum supported_6g_pwr_types 728 in_6g_pwr_mode); 729 730 #ifdef CONFIG_REG_CLIENT 731 /** 732 * wlan_reg_get_secondary_current_chan_list() - provide the pdev secondary 733 * current channel list 734 * @pdev: pdev pointer 735 * @chan_list: channel list pointer 736 * 737 * Return: QDF_STATUS 738 */ 739 QDF_STATUS wlan_reg_get_secondary_current_chan_list( 740 struct wlan_objmgr_pdev *pdev, 741 struct regulatory_channel *chan_list); 742 #endif 743 744 #if defined(CONFIG_AFC_SUPPORT) && defined(CONFIG_BAND_6GHZ) 745 /** 746 * wlan_reg_get_6g_afc_chan_list() - provide the pdev afc channel list 747 * @pdev: pdev pointer 748 * @chan_list: channel list pointer 749 * 750 * Return: QDF_STATUS 751 */ 752 QDF_STATUS wlan_reg_get_6g_afc_chan_list(struct wlan_objmgr_pdev *pdev, 753 struct regulatory_channel *chan_list); 754 755 /** 756 * wlan_reg_get_6g_afc_mas_chan_list() - provide the pdev afc master channel 757 * list 758 * @pdev: pdev pointer 759 * @chan_list: channel list pointer 760 * 761 * Return: QDF_STATUS 762 */ 763 QDF_STATUS 764 wlan_reg_get_6g_afc_mas_chan_list(struct wlan_objmgr_pdev *pdev, 765 struct regulatory_channel *chan_list); 766 767 /** 768 * wlan_reg_is_afc_power_event_received() - Checks if AFC power event is 769 * received from the FW. 770 * 771 * @pdev: pdev ptr 772 * 773 * Return: true if AFC power event is received from the FW or false otherwise 774 */ 775 bool wlan_reg_is_afc_power_event_received(struct wlan_objmgr_pdev *pdev); 776 777 /** 778 * wlan_reg_is_afc_done() - Check if AFC response enables the given frequency. 779 * @pdev: pdev ptr 780 * @freq: given frequency. 781 * 782 * Return: True if frequency is enabled, false otherwise. 783 */ 784 bool wlan_reg_is_afc_done(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); 785 786 /** 787 * wlan_reg_get_afc_req_id() - Get the AFC request ID 788 * @pdev: pdev pointer 789 * @req_id: Pointer to request id 790 * 791 * Return: QDF_STATUS 792 */ 793 QDF_STATUS wlan_reg_get_afc_req_id(struct wlan_objmgr_pdev *pdev, 794 uint64_t *req_id); 795 796 /** 797 * wlan_reg_is_afc_expiry_event_received() - Checks if AFC power event is 798 * received from the FW. 799 * 800 * @pdev: pdev ptr 801 * 802 * Return: true if AFC exipry event is received from the FW or false otherwise 803 */ 804 bool wlan_reg_is_afc_expiry_event_received(struct wlan_objmgr_pdev *pdev); 805 806 /** 807 * wlan_reg_is_noaction_on_afc_pwr_evt() - Checks whether driver needs to 808 * take action for AFC action or the response should be handled by the 809 * user application. 810 * 811 * @pdev: pdev ptr 812 * 813 * Return: true if driver need not take action for AFC resp, false otherwise. 814 */ 815 bool 816 wlan_reg_is_noaction_on_afc_pwr_evt(struct wlan_objmgr_pdev *pdev); 817 818 /** 819 * wlan_reg_get_afc_dev_deploy_type() - Get AFC device deployment type 820 * @pdev: pdev pointer 821 * @afc_dev_type: Pointer to afc device deployment type 822 * 823 * Return: QDF_STATUS 824 */ 825 QDF_STATUS 826 wlan_reg_get_afc_dev_deploy_type(struct wlan_objmgr_pdev *pdev, 827 enum reg_afc_dev_deploy_type *afc_dev_type); 828 829 /** 830 * wlan_reg_is_sta_connect_allowed() - Check if STA connection allowed 831 * @pdev: pdev pointer 832 * @root_ap_pwr_mode: power mode of the Root AP. 833 * 834 * Return : True if STA Vap connection is allowed. 835 */ 836 bool 837 wlan_reg_is_sta_connect_allowed(struct wlan_objmgr_pdev *pdev, 838 enum reg_6g_ap_type root_ap_pwr_mode); 839 #else 840 static inline bool 841 wlan_reg_is_afc_power_event_received(struct wlan_objmgr_pdev *pdev) 842 { 843 return false; 844 } 845 846 static inline bool 847 wlan_reg_is_afc_done(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) 848 { 849 return true; 850 } 851 852 static inline QDF_STATUS 853 wlan_reg_get_6g_afc_chan_list(struct wlan_objmgr_pdev *pdev, 854 struct regulatory_channel *chan_list) 855 { 856 return QDF_STATUS_E_NOSUPPORT; 857 } 858 859 static inline bool 860 wlan_reg_is_sta_connect_allowed(struct wlan_objmgr_pdev *pdev, 861 enum reg_6g_ap_type root_ap_pwr_mode) 862 { 863 return true; 864 } 865 #endif 866 867 /** 868 * wlan_reg_get_bonded_channel_state_for_freq() - Get bonded channel freq state 869 * @freq: channel frequency 870 * @bw: channel band width 871 * @sec_freq: secondary frequency 872 * 873 * Return: channel state 874 */ 875 enum channel_state 876 wlan_reg_get_bonded_channel_state_for_freq(struct wlan_objmgr_pdev *pdev, 877 qdf_freq_t freq, 878 enum phy_ch_width bw, 879 qdf_freq_t sec_freq); 880 881 #ifdef CONFIG_REG_6G_PWRMODE 882 /** 883 * wlan_reg_get_bonded_channel_state_for_pwrmode() - Get bonded channel freq 884 * state 885 * @freq: channel frequency 886 * @bw: channel band width 887 * @sec_freq: secondary frequency 888 * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup. 889 * 890 * Return: channel state 891 */ 892 enum channel_state 893 wlan_reg_get_bonded_channel_state_for_pwrmode(struct wlan_objmgr_pdev *pdev, 894 qdf_freq_t freq, 895 enum phy_ch_width bw, 896 qdf_freq_t sec_freq, 897 enum supported_6g_pwr_types 898 in_6g_pwr_mode); 899 #endif 900 901 /** 902 * wlan_reg_set_dfs_region() - set the dfs region 903 * @pdev: pdev ptr 904 * @dfs_reg: dfs region 905 * 906 * Return: void 907 */ 908 void wlan_reg_set_dfs_region(struct wlan_objmgr_pdev *pdev, 909 enum dfs_reg dfs_reg); 910 911 /** 912 * wlan_reg_get_bw_value() - provide the channel center freq 913 * @chan_num: chennal number 914 * 915 * Return: int 916 */ 917 uint16_t wlan_reg_get_bw_value(enum phy_ch_width bw); 918 919 /** 920 * wlan_reg_get_domain_from_country_code() - provide the channel center freq 921 * @reg_domain_ptr: regulatory domain ptr 922 * @country_alpha2: country alpha2 923 * @source: alpha2 source 924 * 925 * Return: int 926 */ 927 QDF_STATUS wlan_reg_get_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr, 928 const uint8_t *country_alpha2, 929 enum country_src source); 930 931 /** 932 * wlan_reg_dmn_get_opclass_from_channel() - provide the channel center freq 933 * @country: country alpha2 934 * @channel: channel number 935 * @offset: offset 936 * 937 * Return: int 938 */ 939 uint16_t wlan_reg_dmn_get_opclass_from_channel(uint8_t *country, 940 uint8_t channel, 941 uint8_t offset); 942 943 /** 944 * wlan_reg_get_opclass_from_freq_width() - Get operating class from frequency 945 * @country: Country code. 946 * @freq: Channel center frequency. 947 * @ch_width: Channel width. 948 * @behav_limit: Behaviour limit. 949 * 950 * Return: Error code. 951 */ 952 uint8_t wlan_reg_get_opclass_from_freq_width(uint8_t *country, 953 qdf_freq_t freq, 954 uint16_t ch_width, 955 uint16_t behav_limit); 956 957 /** 958 * wlan_reg_get_band_cap_from_op_class() - Return band capability bitmap 959 * @country: Pointer to Country code. 960 * @num_of_opclass: Number of Operating class. 961 * @opclass: Pointer to opclass. 962 * 963 * Return supported band bitmap based on the input operating class list 964 * provided. 965 * 966 * Return: Return supported band capability 967 */ 968 uint8_t wlan_reg_get_band_cap_from_op_class(const uint8_t *country, 969 uint8_t num_of_opclass, 970 const uint8_t *opclass); 971 972 /** 973 * wlan_reg_dmn_print_channels_in_opclass() - Print channels in op-class 974 * @country: country alpha2 975 * @opclass: oplcass 976 * 977 * Return: void 978 */ 979 void wlan_reg_dmn_print_channels_in_opclass(uint8_t *country, 980 uint8_t opclass); 981 982 983 /** 984 * wlan_reg_dmn_get_chanwidth_from_opclass() - get channel width from 985 * operating class 986 * @country: country alpha2 987 * @channel: channel number 988 * @opclass: operating class 989 * 990 * Return: int 991 */ 992 uint16_t wlan_reg_dmn_get_chanwidth_from_opclass(uint8_t *country, 993 uint8_t channel, 994 uint8_t opclass); 995 996 /** 997 * wlan_reg_dmn_get_chanwidth_from_opclass_auto() - get channel width from 998 * operating class. If opclass not found then search in global opclass. 999 * @country: country alpha2 1000 * @channel: channel number 1001 * @opclass: operating class 1002 * 1003 * Return: int 1004 */ 1005 uint16_t wlan_reg_dmn_get_chanwidth_from_opclass_auto(uint8_t *country, 1006 uint8_t channel, 1007 uint8_t opclass); 1008 1009 /** 1010 * wlan_reg_dmn_set_curr_opclasses() - set operating class 1011 * @num_classes: number of classes 1012 * @class: operating class 1013 * 1014 * Return: int 1015 */ 1016 uint16_t wlan_reg_dmn_set_curr_opclasses(uint8_t num_classes, 1017 uint8_t *class); 1018 1019 /** 1020 * wlan_reg_dmn_get_curr_opclasses() - get current oper classes 1021 * @num_classes: number of classes 1022 * @class: operating class 1023 * 1024 * Return: int 1025 */ 1026 uint16_t wlan_reg_dmn_get_curr_opclasses(uint8_t *num_classes, 1027 uint8_t *class); 1028 1029 1030 /** 1031 * wlan_reg_get_opclass_details() - Get details about the current opclass table. 1032 * @pdev: Pointer to pdev. 1033 * @reg_ap_cap: Pointer to reg_ap_cap. 1034 * @n_opclasses: Pointer to number of opclasses. 1035 * @max_supp_op_class: Maximum number of operating classes supported. 1036 * @global_tbl_lookup: Whether to lookup global op class tbl. 1037 * 1038 * Return: QDF_STATUS_SUCCESS if success, else return QDF_STATUS_FAILURE. 1039 */ 1040 QDF_STATUS 1041 wlan_reg_get_opclass_details(struct wlan_objmgr_pdev *pdev, 1042 struct regdmn_ap_cap_opclass_t *reg_ap_cap, 1043 uint8_t *n_opclasses, 1044 uint8_t max_supp_op_class, 1045 bool global_tbl_lookup); 1046 1047 /** 1048 * wlan_reg_get_opclass_for_cur_hwmode() - Get details about the 1049 * opclass table for the current hwmode. 1050 * @pdev: Pointer to pdev. 1051 * @reg_ap_cap: Pointer to reg_ap_cap. 1052 * @n_opclasses: Pointer to number of opclasses. 1053 * @max_supp_op_class: Maximum number of operating classes supported. 1054 * @global_tbl_lookup: Whether to lookup global op class tbl. 1055 * @max_chwidth: Maximum channel width supported by cur hwmode 1056 * @is_80p80_supp: Bool to indicate if 80p80 is supported. 1057 * 1058 * Return: QDF_STATUS_SUCCESS if success, else return QDF_STATUS_FAILURE. 1059 */ 1060 QDF_STATUS 1061 wlan_reg_get_opclass_for_cur_hwmode(struct wlan_objmgr_pdev *pdev, 1062 struct regdmn_ap_cap_opclass_t *reg_ap_cap, 1063 uint8_t *n_opclasses, 1064 uint8_t max_supp_op_class, 1065 bool global_tbl_lookup, 1066 enum phy_ch_width max_chwidth, 1067 bool is_80p80_supp); 1068 /** 1069 * wlan_reg_get_cc_and_src () - get country code and src 1070 * @psoc: psoc ptr 1071 * @alpha2: country code alpha2 1072 * 1073 * Return: country_src 1074 */ 1075 enum country_src wlan_reg_get_cc_and_src(struct wlan_objmgr_psoc *psoc, 1076 uint8_t *alpha); 1077 1078 /** 1079 * wlan_regulatory_init() - init regulatory component 1080 * 1081 * Return: Success or Failure 1082 */ 1083 QDF_STATUS wlan_regulatory_init(void); 1084 1085 /** 1086 * wlan_regulatory_deinit() - deinit regulatory component 1087 * 1088 * Return: Success or Failure 1089 */ 1090 QDF_STATUS wlan_regulatory_deinit(void); 1091 1092 /** 1093 * regulatory_psoc_open() - open regulatory component 1094 * 1095 * Return: Success or Failure 1096 */ 1097 QDF_STATUS regulatory_psoc_open(struct wlan_objmgr_psoc *psoc); 1098 1099 1100 /** 1101 * regulatory_psoc_close() - close regulatory component 1102 * 1103 * Return: Success or Failure 1104 */ 1105 QDF_STATUS regulatory_psoc_close(struct wlan_objmgr_psoc *psoc); 1106 1107 /** 1108 * regulatory_pdev_open() - Open regulatory component 1109 * @pdev: Pointer to pdev structure 1110 * 1111 * Return: Success or Failure 1112 */ 1113 QDF_STATUS regulatory_pdev_open(struct wlan_objmgr_pdev *pdev); 1114 1115 /** 1116 * regulatory_pdev_close() - Close regulatory component 1117 * @pdev: Pointer to pdev structure. 1118 * 1119 * Return: Success or Failure 1120 */ 1121 QDF_STATUS regulatory_pdev_close(struct wlan_objmgr_pdev *pdev); 1122 1123 /** 1124 * wlan_reg_freq_to_chan () - convert channel freq to channel number 1125 * @pdev: The physical dev to set current country for 1126 * @freq: frequency 1127 * 1128 * Return: true or false 1129 */ 1130 uint8_t wlan_reg_freq_to_chan(struct wlan_objmgr_pdev *pdev, 1131 qdf_freq_t freq); 1132 1133 /** 1134 * wlan_reg_legacy_chan_to_freq () - convert chan to freq, for 2G and 5G 1135 * @chan: channel number 1136 * 1137 * Return: frequency 1138 */ 1139 qdf_freq_t wlan_reg_legacy_chan_to_freq(struct wlan_objmgr_pdev *pdev, 1140 uint8_t chan); 1141 1142 /** 1143 * wlan_reg_is_us() - reg is us country 1144 * @country: The country information 1145 * 1146 * Return: true or false 1147 */ 1148 bool wlan_reg_is_us(uint8_t *country); 1149 1150 /** 1151 * wlan_reg_is_etsi() - reg is a country in EU 1152 * @country: The country information 1153 * 1154 * Return: true or false 1155 */ 1156 bool wlan_reg_is_etsi(uint8_t *country); 1157 1158 1159 /** 1160 * wlan_reg_ctry_support_vlp() - Country supports VLP or not 1161 * @country: The country information 1162 * 1163 * Return: true or false 1164 */ 1165 bool wlan_reg_ctry_support_vlp(uint8_t *country); 1166 1167 /** 1168 * wlan_reg_set_country() - Set the current regulatory country 1169 * @pdev: The physical dev to set current country for 1170 * @country: The country information to configure 1171 * 1172 * Return: QDF_STATUS 1173 */ 1174 QDF_STATUS wlan_reg_set_country(struct wlan_objmgr_pdev *pdev, 1175 uint8_t *country); 1176 1177 /** 1178 * wlan_reg_set_11d_country() - Set the 11d regulatory country 1179 * @pdev: The physical dev to set current country for 1180 * @country: The country information to configure 1181 * 1182 * Return: QDF_STATUS 1183 */ 1184 QDF_STATUS wlan_reg_set_11d_country(struct wlan_objmgr_pdev *pdev, 1185 uint8_t *country); 1186 1187 /** 1188 * wlan_reg_register_chan_change_callback () - add chan change cbk 1189 * @psoc: psoc ptr 1190 * @cbk: callback 1191 * @arg: argument 1192 * 1193 * Return: true or false 1194 */ 1195 void wlan_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc, 1196 void *cbk, void *arg); 1197 1198 /** 1199 * wlan_reg_unregister_chan_change_callback () - remove chan change cbk 1200 * @psoc: psoc ptr 1201 * @cbk:callback 1202 * 1203 * Return: true or false 1204 */ 1205 void wlan_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc, 1206 void *cbk); 1207 1208 /** 1209 * wlan_reg_is_11d_offloaded() - 11d offloaded supported 1210 * @psoc: psoc ptr 1211 * 1212 * Return: bool 1213 */ 1214 bool wlan_reg_is_11d_offloaded(struct wlan_objmgr_psoc *psoc); 1215 1216 /** 1217 * wlan_reg_11d_enabled_on_host() - 11d enabled don host 1218 * @psoc: psoc ptr 1219 * 1220 * Return: bool 1221 */ 1222 bool wlan_reg_11d_enabled_on_host(struct wlan_objmgr_psoc *psoc); 1223 1224 /** 1225 * wlan_reg_get_chip_mode() - get supported chip mode 1226 * @pdev: pdev pointer 1227 * @chip_mode: chip mode 1228 * 1229 * Return: QDF STATUS 1230 */ 1231 QDF_STATUS wlan_reg_get_chip_mode(struct wlan_objmgr_pdev *pdev, 1232 uint64_t *chip_mode); 1233 1234 /** 1235 * wlan_reg_is_11d_scan_inprogress() - checks 11d scan status 1236 * @psoc: psoc ptr 1237 * 1238 * Return: bool 1239 */ 1240 bool wlan_reg_is_11d_scan_inprogress(struct wlan_objmgr_psoc *psoc); 1241 /** 1242 * wlan_reg_get_freq_range() - Get 2GHz and 5GHz frequency range 1243 * @pdev: pdev pointer 1244 * @low_2g: low 2GHz frequency range 1245 * @high_2g: high 2GHz frequency range 1246 * @low_5g: low 5GHz frequency range 1247 * @high_5g: high 5GHz frequency range 1248 * 1249 * Return: QDF status 1250 */ 1251 QDF_STATUS wlan_reg_get_freq_range(struct wlan_objmgr_pdev *pdev, 1252 qdf_freq_t *low_2g, 1253 qdf_freq_t *high_2g, 1254 qdf_freq_t *low_5g, 1255 qdf_freq_t *high_5g); 1256 /** 1257 * wlan_reg_get_tx_ops () - get regulatory tx ops 1258 * @psoc: psoc ptr 1259 * 1260 */ 1261 struct wlan_lmac_if_reg_tx_ops * 1262 wlan_reg_get_tx_ops(struct wlan_objmgr_psoc *psoc); 1263 1264 /** 1265 * wlan_reg_get_curr_regdomain() - Get current regdomain in use 1266 * @pdev: pdev pointer 1267 * @cur_regdmn: Current regdomain info 1268 * 1269 * Return: QDF status 1270 */ 1271 QDF_STATUS wlan_reg_get_curr_regdomain(struct wlan_objmgr_pdev *pdev, 1272 struct cur_regdmn_info *cur_regdmn); 1273 1274 #ifdef WLAN_REG_PARTIAL_OFFLOAD 1275 /** 1276 * wlan_reg_is_regdmn_en302502_applicable() - Find if ETSI EN302_502 radar 1277 * pattern is applicable in the current regulatory domain. 1278 * @pdev: Pdev ptr. 1279 * 1280 * Return: Boolean. 1281 * True: If EN302_502 is applicable. 1282 * False: otherwise. 1283 */ 1284 bool wlan_reg_is_regdmn_en302502_applicable(struct wlan_objmgr_pdev *pdev); 1285 #endif 1286 1287 /** 1288 * wlan_reg_modify_pdev_chan_range() - Compute current channel list for the 1289 * modified channel range in the regcap. 1290 * @pdev: pointer to wlan_objmgr_pdev. 1291 * 1292 * Return : QDF_STATUS 1293 */ 1294 QDF_STATUS wlan_reg_modify_pdev_chan_range(struct wlan_objmgr_pdev *pdev); 1295 1296 /** 1297 * wlan_reg_get_phybitmap() - Get phybitmap from regulatory pdev_priv_obj 1298 * @pdev: pdev pointer 1299 * @phybitmap: pointer to phybitmap 1300 * 1301 * Return: QDF STATUS 1302 */ 1303 QDF_STATUS wlan_reg_get_phybitmap(struct wlan_objmgr_pdev *pdev, 1304 uint16_t *phybitmap); 1305 1306 /** 1307 * wlan_reg_update_pdev_wireless_modes() - Update the wireless_modes in the 1308 * pdev_priv_obj with the input wireless_modes 1309 * @pdev: pointer to wlan_objmgr_pdev. 1310 * @wireless_modes: Wireless modes. 1311 * 1312 * Return : QDF_STATUS 1313 */ 1314 QDF_STATUS wlan_reg_update_pdev_wireless_modes(struct wlan_objmgr_pdev *pdev, 1315 uint64_t wireless_modes); 1316 /** 1317 * wlan_reg_disable_chan_coex() - Disable Coexisting channels based on the input 1318 * bitmask 1319 * @pdev: pointer to wlan_objmgr_pdev. 1320 * unii_5g_bitmap: UNII 5G bitmap. 1321 * 1322 * Return : QDF_STATUS 1323 */ 1324 #ifdef DISABLE_UNII_SHARED_BANDS 1325 QDF_STATUS wlan_reg_disable_chan_coex(struct wlan_objmgr_pdev *pdev, 1326 uint8_t unii_5g_bitmap); 1327 #else 1328 static inline QDF_STATUS 1329 wlan_reg_disable_chan_coex(struct wlan_objmgr_pdev *pdev, 1330 uint8_t unii_5g_bitmap) 1331 { 1332 return QDF_STATUS_SUCCESS; 1333 } 1334 #endif 1335 1336 #ifdef WLAN_FEATURE_GET_USABLE_CHAN_LIST 1337 /** 1338 * wlan_reg_get_usable_channel() - Get usable channels 1339 * @pdev: Pointer to pdev 1340 * @req_msg: Request msg 1341 * @res_msg: Response msg 1342 * @count: no of usable channels 1343 * 1344 * Return: qdf status 1345 */ 1346 QDF_STATUS 1347 wlan_reg_get_usable_channel(struct wlan_objmgr_pdev *pdev, 1348 struct get_usable_chan_req_params req_msg, 1349 struct get_usable_chan_res_params *res_msg, 1350 uint32_t *count); 1351 #endif 1352 1353 #ifdef CONFIG_CHAN_FREQ_API 1354 /** 1355 * wlan_reg_is_same_band_freqs() - Check if two channel frequencies 1356 * have same band 1357 * @freq1: Frequency 1 1358 * @freq2: Frequency 2 1359 * 1360 * Return: true if both the channel frequency has the same band. 1361 */ 1362 #define WLAN_REG_IS_SAME_BAND_FREQS(freq1, freq2) \ 1363 wlan_reg_is_same_band_freqs(freq1, freq2) 1364 bool wlan_reg_is_same_band_freqs(qdf_freq_t freq1, qdf_freq_t freq2); 1365 1366 /** 1367 * wlan_reg_get_chan_enum_for_freq() - Get channel enum for given channel center 1368 * frequency 1369 * @freq: Channel center frequency 1370 * 1371 * Return: Channel enum 1372 */ 1373 enum channel_enum wlan_reg_get_chan_enum_for_freq(qdf_freq_t freq); 1374 1375 /** 1376 * wlan_reg_is_freq_present_in_cur_chan_list() - Check if channel is present 1377 * in the current channel list 1378 * @pdev: pdev pointer 1379 * @freq: Channel center frequency 1380 * 1381 * Return: true if channel is present in current channel list 1382 */ 1383 bool wlan_reg_is_freq_present_in_cur_chan_list(struct wlan_objmgr_pdev *pdev, 1384 qdf_freq_t freq); 1385 1386 /** 1387 * wlan_reg_update_nol_history_ch_for_freq() - Set nol-history flag for the 1388 * channels in the list. 1389 * 1390 * @pdev: Pdev ptr 1391 * @ch_list: Input channel list. 1392 * @num_ch: Number of channels. 1393 * @nol_history_ch: Nol history value. 1394 * 1395 * Return: void 1396 */ 1397 void wlan_reg_update_nol_history_ch_for_freq(struct wlan_objmgr_pdev *pdev, 1398 uint16_t *ch_list, 1399 uint8_t num_ch, 1400 bool nol_history_ch); 1401 1402 /** 1403 * wlan_reg_chan_has_dfs_attribute_for_freq() - check channel has dfs 1404 * attribute flag 1405 * @freq: channel center frequency. 1406 * 1407 * This API get chan initial dfs attribute from regdomain 1408 * 1409 * Return: true if chan is dfs, otherwise false 1410 */ 1411 bool 1412 wlan_reg_chan_has_dfs_attribute_for_freq(struct wlan_objmgr_pdev *pdev, 1413 qdf_freq_t freq); 1414 1415 /** 1416 * wlan_reg_get_channel_list_with_power_for_freq() - Provide the channel list 1417 * with power 1418 * @ch_list: pointer to the channel list. 1419 * 1420 * Return: QDF_STATUS 1421 */ 1422 QDF_STATUS 1423 wlan_reg_get_channel_list_with_power_for_freq(struct wlan_objmgr_pdev *pdev, 1424 struct channel_power *ch_list, 1425 uint8_t *num_chan); 1426 /** 1427 * wlan_reg_get_5g_bonded_channel_state_for_freq() - Get 5G bonded channel state 1428 * @pdev: The physical dev to program country code or regdomain 1429 * @freq: channel frequency. 1430 * @bw: channel band width 1431 * 1432 * Return: channel state 1433 */ 1434 enum channel_state 1435 wlan_reg_get_5g_bonded_channel_state_for_freq(struct wlan_objmgr_pdev *pdev, 1436 qdf_freq_t freq, 1437 enum phy_ch_width bw); 1438 1439 #ifdef CONFIG_REG_6G_PWRMODE 1440 /** 1441 * wlan_reg_get_5g_bonded_channel_state_for_pwrmode() - Get 5G bonded channel 1442 * state. 1443 * @pdev: The physical dev to program country code or regdomain 1444 * @freq: channel frequency. 1445 * @ch_params: channel parameters 1446 * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup. 1447 * 1448 * Return: channel state 1449 */ 1450 enum channel_state 1451 wlan_reg_get_5g_bonded_channel_state_for_pwrmode(struct wlan_objmgr_pdev *pdev, 1452 qdf_freq_t freq, 1453 struct ch_params *ch_params, 1454 enum supported_6g_pwr_types 1455 in_6g_pwr_type); 1456 #endif 1457 1458 /** 1459 * wlan_reg_get_2g_bonded_channel_state_for_freq() - Get 2G bonded channel state 1460 * @pdev: The physical dev to program country code or regdomain 1461 * @freq: channel center frequency. 1462 * @sec_ch_freq: Secondary channel center frequency. 1463 * @bw: channel band width 1464 * 1465 * Return: channel state 1466 */ 1467 enum channel_state 1468 wlan_reg_get_2g_bonded_channel_state_for_freq(struct wlan_objmgr_pdev *pdev, 1469 qdf_freq_t freq, 1470 qdf_freq_t sec_ch_freq, 1471 enum phy_ch_width bw); 1472 1473 /** 1474 * wlan_reg_get_channel_state_for_freq() - Get channel state from regulatory 1475 * @pdev: Pointer to pdev 1476 * @freq: channel center frequency. 1477 * 1478 * Return: channel state 1479 */ 1480 enum channel_state 1481 wlan_reg_get_channel_state_for_freq(struct wlan_objmgr_pdev *pdev, 1482 qdf_freq_t freq); 1483 1484 #ifdef CONFIG_REG_6G_PWRMODE 1485 /** 1486 * wlan_reg_get_channel_state_for_pwrmode() - Get channel state from regulatory 1487 * @pdev: Pointer to pdev 1488 * @freq: channel center frequency. 1489 * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup. 1490 * 1491 * Return: channel state 1492 */ 1493 enum channel_state 1494 wlan_reg_get_channel_state_for_pwrmode( 1495 struct wlan_objmgr_pdev *pdev, 1496 qdf_freq_t freq, 1497 enum supported_6g_pwr_types in_6g_pwr_type); 1498 #endif 1499 1500 #ifdef CONFIG_REG_CLIENT 1501 /** 1502 * wlan_reg_get_channel_state_from_secondary_list_for_freq() - Get channel state 1503 * from secondary regulatory current channel list 1504 * @pdev: Pointer to pdev 1505 * @freq: channel center frequency. 1506 * 1507 * Return: channel state 1508 */ 1509 enum channel_state wlan_reg_get_channel_state_from_secondary_list_for_freq( 1510 struct wlan_objmgr_pdev *pdev, 1511 qdf_freq_t freq); 1512 1513 /** 1514 * wlan_reg_get_channel_list_with_power() - Provide channel list with tx power 1515 * @ch_list: pointer to the channel list. 1516 * @num_chan: Number of channels which has been filed in ch_list 1517 * @in_6g_pwr_type: 6G power type corresponding to which 6G channels needs to 1518 * be provided 1519 * 1520 * Return: QDF_STATUS 1521 */ 1522 QDF_STATUS 1523 wlan_reg_get_channel_list_with_power( 1524 struct wlan_objmgr_pdev *pdev, 1525 struct channel_power *ch_list, 1526 uint8_t *num_chan, 1527 enum supported_6g_pwr_types in_6g_pwr_type); 1528 #endif 1529 1530 #ifdef WLAN_FEATURE_11BE 1531 /** 1532 * wlan_reg_fill_channel_list() - Fills the reg_channel_list (list of channels) 1533 * @pdev: Pointer to struct wlan_objmgr_pdev. 1534 * @freq: Center frequency of the primary channel in MHz 1535 * @sec_ch_2g_freq: Secondary channel center frequency. 1536 * @ch_width: Channel width of type 'enum phy_ch_width'. 1537 * @band_center_320: Center frequency of 320MHZ channel. 1538 * @chan_list: Pointer to struct reg_channel_list to be filled (Output param). 1539 * @treat_nol_chan_as_disabled: bool to treat nol channel as enabled or 1540 * disabled. If set to true, nol chan is considered as disabled in chan search. 1541 * 1542 * Return: None 1543 */ 1544 void wlan_reg_fill_channel_list(struct wlan_objmgr_pdev *pdev, 1545 qdf_freq_t freq, 1546 qdf_freq_t sec_ch_2g_freq, 1547 enum phy_ch_width ch_width, 1548 qdf_freq_t band_center_320, 1549 struct reg_channel_list *chan_list, 1550 bool treat_nol_chan_as_disabled); 1551 1552 /** 1553 * wlan_reg_is_punc_bitmap_valid() - is puncture bitmap valid or not 1554 * @bw: Input channel width. 1555 * @puncture_bitmap Input puncture bitmap. 1556 * 1557 * Return: true if given puncture bitmap is valid 1558 */ 1559 bool wlan_reg_is_punc_bitmap_valid(enum phy_ch_width bw, 1560 uint16_t puncture_bitmap); 1561 1562 #ifdef QCA_DFS_BW_PUNCTURE 1563 /** 1564 * wlan_reg_find_nearest_puncture_pattern() - is proposed bitmap valid or not 1565 * @bw: Input channel width. 1566 * @proposed_bitmap: Input puncture bitmap. 1567 * 1568 * Return: Radar bitmap if it is valid. 1569 */ 1570 uint16_t wlan_reg_find_nearest_puncture_pattern(enum phy_ch_width bw, 1571 uint16_t proposed_bitmap); 1572 #else 1573 static inline 1574 uint16_t wlan_reg_find_nearest_puncture_pattern(enum phy_ch_width bw, 1575 uint16_t proposed_bitmap) 1576 { 1577 return 0; 1578 } 1579 #endif /* QCA_DFS_BW_PUNCTURE */ 1580 1581 /** 1582 * wlan_reg_extract_puncture_by_bw() - generate new puncture bitmap from 1583 * original puncture bitmap and bandwidth 1584 * based on new bandwidth 1585 * @ori_bw: original bandwidth 1586 * @ori_puncture_bitmap: original puncture bitmap 1587 * @freq: frequency of primary channel 1588 * @cen320_freq: center frequency of 320 MHZ if channel width is 320 1589 * @new_bw new bandwidth 1590 * @new_puncture_bitmap: output of puncture bitmap 1591 * 1592 * Return: QDF_STATUS 1593 */ 1594 QDF_STATUS wlan_reg_extract_puncture_by_bw(enum phy_ch_width ori_bw, 1595 uint16_t ori_puncture_bitmap, 1596 qdf_freq_t freq, 1597 qdf_freq_t cen320_freq, 1598 enum phy_ch_width new_bw, 1599 uint16_t *new_puncture_bitmap); 1600 1601 /** 1602 * wlan_reg_set_create_punc_bitmap() - set is_create_punc_bitmap of ch_params 1603 * @ch_params: ch_params to set 1604 * @is_create_punc_bitmap: is create punc bitmap 1605 * 1606 * Return: NULL 1607 */ 1608 void wlan_reg_set_create_punc_bitmap(struct ch_params *ch_params, 1609 bool is_create_punc_bitmap); 1610 #ifdef CONFIG_REG_6G_PWRMODE 1611 /** 1612 * wlan_reg_fill_channel_list_for_pwrmode() - Fills the reg_channel_list 1613 * (list of channels) 1614 * @pdev: Pointer to struct wlan_objmgr_pdev. 1615 * @freq: Center frequency of the primary channel in MHz 1616 * @sec_ch_2g_freq: Secondary channel center frequency. 1617 * @ch_width: Channel width of type 'enum phy_ch_width'. 1618 * @band_center_320: Center frequency of 320MHZ channel. 1619 * @chan_list: Pointer to struct reg_channel_list to be filled (Output param). 1620 * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup. 1621 * @treat_nol_chan_as_disabled: bool to treat nol channel as enabled or 1622 * disabled. If set to true, nol chan is considered as disabled in chan search. 1623 * 1624 * Return: None 1625 */ 1626 void wlan_reg_fill_channel_list_for_pwrmode( 1627 struct wlan_objmgr_pdev *pdev, 1628 qdf_freq_t freq, 1629 qdf_freq_t sec_ch_2g_freq, 1630 enum phy_ch_width ch_width, 1631 qdf_freq_t band_center_320, 1632 struct reg_channel_list *chan_list, 1633 enum supported_6g_pwr_types in_6g_pwr_type, 1634 bool treat_nol_chan_as_disabled); 1635 #endif 1636 #else 1637 static inline 1638 QDF_STATUS wlan_reg_extract_puncture_by_bw(enum phy_ch_width ori_bw, 1639 uint16_t ori_puncture_bitmap, 1640 qdf_freq_t freq, 1641 enum phy_ch_width new_bw, 1642 uint16_t *new_puncture_bitmap) 1643 { 1644 return QDF_STATUS_SUCCESS; 1645 } 1646 1647 static inline void wlan_reg_set_create_punc_bitmap(struct ch_params *ch_params, 1648 bool is_create_punc_bitmap) 1649 { 1650 } 1651 1652 static inline 1653 uint16_t wlan_reg_find_nearest_puncture_pattern(enum phy_ch_width bw, 1654 uint16_t proposed_bitmap) 1655 { 1656 return 0; 1657 } 1658 #endif 1659 1660 /** 1661 * wlan_reg_set_channel_params_for_freq() - Sets channel parameteres for 1662 * given bandwidth 1663 * @pdev: The physical dev to program country code or regdomain 1664 * @freq: channel center frequency. 1665 * @sec_ch_2g_freq: Secondary channel center frequency. 1666 * @ch_params: pointer to the channel parameters. 1667 * 1668 * Return: None 1669 */ 1670 void wlan_reg_set_channel_params_for_freq(struct wlan_objmgr_pdev *pdev, 1671 qdf_freq_t freq, 1672 qdf_freq_t sec_ch_2g_freq, 1673 struct ch_params *ch_params); 1674 1675 #ifdef CONFIG_REG_6G_PWRMODE 1676 /** 1677 * wlan_reg_set_channel_params_for_pwrmode() - Sets channel parameteres for 1678 * given bandwidth 1679 * @pdev: The physical dev to program country code or regdomain 1680 * @freq: channel center frequency. 1681 * @sec_ch_2g_freq: Secondary channel center frequency. 1682 * @ch_params: pointer to the channel parameters. 1683 * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup. 1684 * 1685 * Return: None 1686 */ 1687 void wlan_reg_set_channel_params_for_pwrmode(struct wlan_objmgr_pdev *pdev, 1688 qdf_freq_t freq, 1689 qdf_freq_t sec_ch_2g_freq, 1690 struct ch_params *ch_params, 1691 enum supported_6g_pwr_types 1692 in_6g_pwr_mode); 1693 #endif 1694 1695 /** 1696 * wlan_reg_get_channel_cfreq_reg_power_for_freq() - Provide the channel 1697 * regulatory power 1698 * @freq: channel center frequency 1699 * 1700 * Return: int 1701 */ 1702 uint8_t wlan_reg_get_channel_reg_power_for_freq(struct wlan_objmgr_pdev *pdev, 1703 qdf_freq_t freq); 1704 1705 /** 1706 * wlan_reg_update_nol_ch_for_freq () - set nol channel 1707 * @pdev: pdev ptr 1708 * @chan_freq_list: channel list to be returned 1709 * @num_ch: number of channels 1710 * @nol_ch: nol flag 1711 * 1712 * Return: void 1713 */ 1714 void wlan_reg_update_nol_ch_for_freq(struct wlan_objmgr_pdev *pdev, 1715 uint16_t *chan_freq_list, 1716 uint8_t num_ch, 1717 bool nol_ch); 1718 1719 /** 1720 * wlan_reg_is_dfs_freq() - Checks the channel state for DFS 1721 * @freq: Channel center frequency 1722 * 1723 * Return: true or false 1724 */ 1725 bool wlan_reg_is_dfs_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); 1726 1727 /** 1728 * wlan_reg_is_dsrc_freq() - Checks if the channel is dsrc channel or not 1729 * @freq: Channel center frequency 1730 * 1731 * Return: true or false 1732 */ 1733 bool wlan_reg_is_dsrc_freq(qdf_freq_t freq); 1734 1735 /** 1736 * wlan_reg_is_passive_or_disable_for_freq() - Checks chan state for passive 1737 * and disabled 1738 * @pdev: pdev ptr 1739 * @freq: Channel center frequency 1740 * 1741 * Return: true or false 1742 */ 1743 bool wlan_reg_is_passive_or_disable_for_freq(struct wlan_objmgr_pdev *pdev, 1744 qdf_freq_t freq); 1745 1746 #ifdef CONFIG_REG_6G_PWRMODE 1747 /** 1748 * wlan_reg_is_disable_for_pwrmode() - Checks chan state for disabled 1749 * @pdev: pdev ptr 1750 * @freq: Channel center frequency 1751 * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup. 1752 * 1753 * Return: true or false 1754 */ 1755 bool wlan_reg_is_disable_for_pwrmode( 1756 struct wlan_objmgr_pdev *pdev, 1757 qdf_freq_t freq, 1758 enum supported_6g_pwr_types in_6g_pwr_mode); 1759 #endif 1760 1761 #ifdef CONFIG_REG_CLIENT 1762 /** 1763 * wlan_reg_is_disable_in_secondary_list_for_freq() - Checks in the secondary 1764 * channel list to see if chan state is disabled 1765 * @pdev: pdev ptr 1766 * @freq: Channel center frequency 1767 * 1768 * Return: true or false 1769 */ 1770 bool wlan_reg_is_disable_in_secondary_list_for_freq( 1771 struct wlan_objmgr_pdev *pdev, 1772 qdf_freq_t freq); 1773 1774 /** 1775 * wlan_reg_is_enable_in_secondary_list_for_freq() - Checks in the secondary 1776 * channel list to see if chan state is enabled 1777 * @pdev: pdev ptr 1778 * @freq: Channel center frequency 1779 * 1780 * Return: true or false 1781 */ 1782 bool wlan_reg_is_enable_in_secondary_list_for_freq( 1783 struct wlan_objmgr_pdev *pdev, 1784 qdf_freq_t freq); 1785 1786 /** 1787 * wlan_reg_is_dfs_in_secondary_list_for_freq() - hecks the channel state for 1788 * DFS from the secondary channel list 1789 * @pdev: pdev ptr 1790 * @freq: Channel center frequency 1791 * 1792 * Return: true or false 1793 */ 1794 bool wlan_reg_is_dfs_in_secondary_list_for_freq(struct wlan_objmgr_pdev *pdev, 1795 qdf_freq_t freq); 1796 #endif 1797 1798 /** 1799 * wlan_reg_is_passive_for_freq() - Check the channel flags to see if the 1800 * passive flag is set 1801 * @pdev: pdev ptr 1802 * @freq: Channel center frequency 1803 * 1804 * Return: true or false 1805 */ 1806 bool wlan_reg_is_passive_for_freq(struct wlan_objmgr_pdev *pdev, 1807 qdf_freq_t freq); 1808 1809 /** 1810 * wlan_reg_freq_to_band() - Get band from channel number 1811 * @freq:Channel frequency in MHz 1812 * 1813 * Return: wifi band 1814 */ 1815 enum reg_wifi_band wlan_reg_freq_to_band(qdf_freq_t freq); 1816 1817 /** 1818 * wlan_reg_min_chan_freq() - Minimum channel frequency supported 1819 * 1820 * Return: frequency 1821 */ 1822 qdf_freq_t wlan_reg_min_chan_freq(void); 1823 1824 /** 1825 * wlan_reg_max_chan_freq() - Return max. frequency 1826 * 1827 * Return: frequency 1828 */ 1829 qdf_freq_t wlan_reg_max_chan_freq(void); 1830 1831 /** 1832 * wlan_reg_freq_width_to_chan_op_class() -Get op class from freq 1833 * @pdev: pdev ptr 1834 * @freq: channel frequency 1835 * @chan_width: channel width 1836 * @global_tbl_lookup: whether to look up global table 1837 * @behav_limit: behavior limit 1838 * @op_class: operating class 1839 * @chan_num: channel number 1840 * 1841 * Return: void 1842 */ 1843 void wlan_reg_freq_width_to_chan_op_class(struct wlan_objmgr_pdev *pdev, 1844 qdf_freq_t freq, 1845 uint16_t chan_width, 1846 bool global_tbl_lookup, 1847 uint16_t behav_limit, 1848 uint8_t *op_class, 1849 uint8_t *chan_num); 1850 1851 /** 1852 * wlan_reg_freq_width_to_chan_op_class_auto() - convert frequency to 1853 * operating class,channel 1854 * @pdev: pdev pointer 1855 * @freq: channel frequency in mhz 1856 * @chan_width: channel width 1857 * @global_tbl_lookup: whether to lookup global op class tbl 1858 * @behav_limit: behavior limit 1859 * @op_class: operating class 1860 * @chan_num: channel number 1861 * 1862 * Return: Void. 1863 */ 1864 void wlan_reg_freq_width_to_chan_op_class_auto(struct wlan_objmgr_pdev *pdev, 1865 qdf_freq_t freq, 1866 uint16_t chan_width, 1867 bool global_tbl_lookup, 1868 uint16_t behav_limit, 1869 uint8_t *op_class, 1870 uint8_t *chan_num); 1871 1872 /** 1873 * wlan_reg_freq_to_chan_and_op_class() - Converts freq to oper class 1874 * @pdev: pdev ptr 1875 * @freq: channel frequency 1876 * @global_tbl_lookup: whether to look up global table 1877 * @behav_limit: behavior limit 1878 * @op_class: operating class 1879 * @chan_num: channel number 1880 * 1881 * Return: void 1882 */ 1883 void wlan_reg_freq_to_chan_op_class(struct wlan_objmgr_pdev *pdev, 1884 qdf_freq_t freq, 1885 bool global_tbl_lookup, 1886 uint16_t behav_limit, 1887 uint8_t *op_class, 1888 uint8_t *chan_num); 1889 1890 /** 1891 * wlan_reg_is_freq_in_country_opclass() - checks frequency in (ctry, op class) 1892 * pair 1893 * @pdev: pdev ptr 1894 * @country: country information 1895 * @op_class: operating class 1896 * @chan_freq: channel frequency 1897 * 1898 * Return: bool 1899 */ 1900 bool wlan_reg_is_freq_in_country_opclass(struct wlan_objmgr_pdev *pdev, 1901 const uint8_t country[3], 1902 uint8_t op_class, 1903 qdf_freq_t chan_freq); 1904 /** 1905 * wlan_reg_get_5g_bonded_channel_and_state_for_freq()- Return the channel 1906 * state for a 5G or 6G channel frequency based on the channel width and 1907 * bonded channel. 1908 * @pdev: Pointer to pdev. 1909 * @freq: Channel center frequency. 1910 * @bw Channel Width. 1911 * @bonded_chan_ptr_ptr: Pointer to bonded_channel_freq. 1912 * 1913 * Return: Channel State 1914 */ 1915 enum channel_state 1916 wlan_reg_get_5g_bonded_channel_and_state_for_freq(struct wlan_objmgr_pdev *pdev, 1917 uint16_t freq, 1918 enum phy_ch_width bw, 1919 const 1920 struct bonded_channel_freq 1921 **bonded_chan_ptr_ptr); 1922 1923 #ifdef CONFIG_REG_6G_PWRMODE 1924 /** 1925 * wlan_reg_get_5g_bonded_channel_and_state_for_pwrmode()- Return the channel 1926 * state for a 5G or 6G channel frequency based on the channel width and 1927 * bonded channel. 1928 * @pdev: Pointer to pdev. 1929 * @freq: Channel center frequency. 1930 * @bw Channel Width. 1931 * @bonded_chan_ptr_ptr: Pointer to bonded_channel_freq. 1932 * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup. 1933 * 1934 * Return: Channel State 1935 */ 1936 enum channel_state 1937 wlan_reg_get_5g_bonded_channel_and_state_for_pwrmode( 1938 struct wlan_objmgr_pdev *pdev, 1939 uint16_t freq, 1940 enum phy_ch_width bw, 1941 const 1942 struct bonded_channel_freq 1943 **bonded_chan_ptr_ptr, 1944 enum supported_6g_pwr_types 1945 in_6g_pwr_mode); 1946 #endif 1947 #endif /*CONFIG_CHAN_FREQ_API */ 1948 1949 /** 1950 * wlan_reg_get_op_class_width() - Get operating class chan width 1951 * @pdev: pdev ptr 1952 * @freq: channel frequency 1953 * @global_tbl_lookup: whether to look up global table 1954 * @op_class: operating class 1955 * @chan_num: channel number 1956 * 1957 * Return: channel width of op class 1958 */ 1959 uint16_t wlan_reg_get_op_class_width(struct wlan_objmgr_pdev *pdev, 1960 uint8_t op_class, 1961 bool global_tbl_lookup); 1962 1963 /** 1964 * wlan_reg_is_5ghz_op_class() - Check if the input opclass is a 5GHz opclass. 1965 * @country: Country code. 1966 * @op_class: Operating class. 1967 * 1968 * Return: Return true if input the opclass is a 5GHz opclass, 1969 * else return false. 1970 */ 1971 bool wlan_reg_is_5ghz_op_class(const uint8_t *country, uint8_t op_class); 1972 1973 /** 1974 * wlan_reg_is_2ghz_op_class() - Check if the input opclass is a 2.4GHz opclass. 1975 * @country: Country code. 1976 * @op_class: Operating class. 1977 * 1978 * Return: Return true if input the opclass is a 2.4GHz opclass, 1979 * else return false. 1980 */ 1981 bool wlan_reg_is_2ghz_op_class(const uint8_t *country, uint8_t op_class); 1982 1983 /** 1984 * wlan_reg_is_6ghz_op_class() - Whether 6ghz oper class 1985 * @pdev: pdev ptr 1986 * @op_class: operating class 1987 * 1988 * Return: bool 1989 */ 1990 bool wlan_reg_is_6ghz_op_class(struct wlan_objmgr_pdev *pdev, 1991 uint8_t op_class); 1992 1993 #ifdef CONFIG_REG_CLIENT 1994 /** 1995 * wlan_reg_is_6ghz_supported() - Whether 6ghz is supported 1996 * @psoc: psoc ptr 1997 * 1998 * Return: bool 1999 */ 2000 bool wlan_reg_is_6ghz_supported(struct wlan_objmgr_psoc *psoc); 2001 #endif 2002 2003 #ifdef HOST_OPCLASS_EXT 2004 /** 2005 * wlan_reg_country_chan_opclass_to_freq() - Convert channel number to 2006 * frequency based on country code and op class 2007 * @pdev: pdev object. 2008 * @country: country code. 2009 * @chan: IEEE Channel Number. 2010 * @op_class: Opclass. 2011 * @strict: flag to find channel from matched operating class code. 2012 * 2013 * Look up (channel, operating class) pair in country operating class tables 2014 * and return the channel frequency. 2015 * If not found and "strict" flag is false, try to get frequency (Mhz) by 2016 * channel number only. 2017 * 2018 * Return: Channel center frequency else return 0. 2019 */ 2020 qdf_freq_t 2021 wlan_reg_country_chan_opclass_to_freq(struct wlan_objmgr_pdev *pdev, 2022 const uint8_t country[3], 2023 uint8_t chan, uint8_t op_class, 2024 bool strict); 2025 #endif 2026 2027 /** 2028 * reg_chan_opclass_to_freq() - Convert channel number and opclass to frequency 2029 * @chan: IEEE Channel Number. 2030 * @op_class: Opclass. 2031 * @global_tbl_lookup: Global table lookup. 2032 * 2033 * Return: Channel center frequency else return 0. 2034 */ 2035 uint16_t wlan_reg_chan_opclass_to_freq(uint8_t chan, 2036 uint8_t op_class, 2037 bool global_tbl_lookup); 2038 2039 /** 2040 * wlan_reg_chan_opclass_to_freq_auto() - Convert channel number and opclass to 2041 * frequency 2042 * @chan: IEEE channel number 2043 * @op_class: Operating class of channel 2044 * @global_tbl_lookup: Flag to determine if global table has to be looked up 2045 * 2046 * Return: Channel center frequency if valid, else zero 2047 */ 2048 2049 qdf_freq_t wlan_reg_chan_opclass_to_freq_auto(uint8_t chan, uint8_t op_class, 2050 bool global_tbl_lookup); 2051 2052 #ifdef CHECK_REG_PHYMODE 2053 /** 2054 * wlan_reg_get_max_phymode() - Find the best possible phymode given a 2055 * phymode, a frequency, and per-country regulations 2056 * @pdev: pdev pointer 2057 * @phy_in: phymode that the user requested 2058 * @freq: current operating center frequency 2059 * 2060 * Return: maximum phymode allowed in current country that is <= phy_in 2061 */ 2062 enum reg_phymode wlan_reg_get_max_phymode(struct wlan_objmgr_pdev *pdev, 2063 enum reg_phymode phy_in, 2064 qdf_freq_t freq); 2065 #else 2066 static inline enum reg_phymode 2067 wlan_reg_get_max_phymode(struct wlan_objmgr_pdev *pdev, 2068 enum reg_phymode phy_in, 2069 qdf_freq_t freq) 2070 { 2071 return REG_PHYMODE_INVALID; 2072 } 2073 #endif /* CHECK_REG_PHYMODE */ 2074 2075 #ifdef CONFIG_REG_CLIENT 2076 /** 2077 * wlan_reg_band_bitmap_to_band_info() - Convert the band_bitmap to a 2078 * band_info enum 2079 * @band_bitmap: bitmap on top of reg_wifi_band of bands enabled 2080 * 2081 * Return: BAND_ALL if both 2G and 5G band is enabled 2082 * BAND_2G if 2G is enabled but 5G isn't 2083 * BAND_5G if 5G is enabled but 2G isn't 2084 */ 2085 enum band_info wlan_reg_band_bitmap_to_band_info(uint32_t band_bitmap); 2086 #endif 2087 2088 #if defined(CONFIG_BAND_6GHZ) 2089 /** 2090 * wlan_reg_get_cur_6g_ap_pwr_type() - Get the current 6G regulatory AP power 2091 * type. 2092 * @pdev: Pointer to PDEV object. 2093 * @reg_cur_6g_ap_pwr_type: The current regulatory 6G AP power type ie. 2094 * LPI/SP/VLP. 2095 * 2096 * Return: QDF_STATUS. 2097 */ 2098 QDF_STATUS 2099 wlan_reg_get_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev, 2100 enum reg_6g_ap_type *reg_cur_6g_ap_pwr_type); 2101 2102 /** 2103 * wlan_reg_get_cur_6g_client_type() - Get the current 6G regulatory client 2104 * type. 2105 * @pdev: Pointer to PDEV object. 2106 * @reg_cur_6g_client_mobility_type: The current regulatory 6G client type ie. 2107 * default/subordinate. 2108 * 2109 * Return: QDF_STATUS. 2110 */ 2111 QDF_STATUS 2112 wlan_reg_get_cur_6g_client_type(struct wlan_objmgr_pdev *pdev, 2113 enum reg_6g_client_type 2114 *reg_cur_6g_client_mobility_type); 2115 /** 2116 * wlan_reg_get_rnr_tpe_usable() - Tells if RNR IE is applicable for current 2117 * domain. 2118 * @pdev: Pointer to PDEV object. 2119 * @reg_rnr_tpe_usable: Pointer to hold the bool value, true if RNR IE is 2120 * applicable, else false. 2121 * 2122 * Return: QDF_STATUS. 2123 */ 2124 QDF_STATUS wlan_reg_get_rnr_tpe_usable(struct wlan_objmgr_pdev *pdev, 2125 bool *reg_rnr_tpe_usable); 2126 2127 /** 2128 * wlan_reg_get_unspecified_ap_usable() - Tells if AP type unspecified by 802.11 2129 * can be used or not. 2130 * @pdev: Pointer to PDEV object. 2131 * @reg_unspecified_ap_usable: Pointer to hold the bool value, true if 2132 * unspecified AP types can be used in the IE, else false. 2133 * 2134 * Return: QDF_STATUS. 2135 */ 2136 QDF_STATUS wlan_reg_get_unspecified_ap_usable(struct wlan_objmgr_pdev *pdev, 2137 bool *reg_unspecified_ap_usable); 2138 2139 /** 2140 * wlan_reg_is_6g_psd_power() - Checks if given freq is PSD power 2141 * 2142 * @pdev: pdev ptr 2143 * @freq: channel frequency 2144 * 2145 * Return: true if channel is PSD power or false otherwise 2146 */ 2147 bool wlan_reg_is_6g_psd_power(struct wlan_objmgr_pdev *pdev); 2148 2149 /** 2150 * wlan_reg_get_6g_chan_ap_power() - Finds the AP TX power for the given channel 2151 * frequency 2152 * 2153 * @pdev: pdev ptr 2154 * @chan_freq: channel frequency 2155 * @is_psd: is channel PSD or not 2156 * @tx_power: transmit power to fill for chan_freq 2157 * @eirp_psd_power: EIRP power, will only be filled if is_psd is true 2158 * 2159 * Return: QDF_STATUS 2160 */ 2161 QDF_STATUS wlan_reg_get_6g_chan_ap_power(struct wlan_objmgr_pdev *pdev, 2162 qdf_freq_t chan_freq, bool *is_psd, 2163 uint16_t *tx_power, 2164 uint16_t *eirp_psd_power); 2165 2166 /** 2167 * wlan_reg_get_client_power_for_connecting_ap() - Find the channel information 2168 * when device is operating as a client 2169 * 2170 * @pdev: pdev ptr 2171 * @ap_type: type of AP that device is connected to 2172 * @chan_freq: channel frequency 2173 * @is_psd: is channel PSD or not 2174 * @tx_power: transmit power to fill for chan_freq 2175 * @eirp_psd_power: EIRP power, will only be filled if is_psd is true 2176 * 2177 * This function is meant to be called to find the channel frequency power 2178 * information for a client when the device is operating as a client. It will 2179 * fill in the parameters tx_power and eirp_psd_power. eirp_psd_power will 2180 * only be filled if the channel is PSD. 2181 * 2182 * Return: QDF_STATUS 2183 */ 2184 QDF_STATUS 2185 wlan_reg_get_client_power_for_connecting_ap(struct wlan_objmgr_pdev *pdev, 2186 enum reg_6g_ap_type ap_type, 2187 qdf_freq_t chan_freq, 2188 bool is_psd, uint16_t *tx_power, 2189 uint16_t *eirp_psd_power); 2190 2191 /** 2192 * wlan_reg_get_client_power_for_6ghz_ap() - Find the channel information when 2193 * device is operating as a 6GHz AP 2194 * 2195 * @pdev: pdev ptr 2196 * @client_type: type of client that is connected to our AP 2197 * @chan_freq: channel frequency 2198 * @is_psd: is channel PSD or not 2199 * @tx_power: transmit power to fill for chan_freq 2200 * @eirp_psd_power: EIRP power, will only be filled if is_psd is true 2201 * 2202 * This function is meant to be called to find the channel frequency power 2203 * information for a client when the device is operating as an AP. It will fill 2204 * in the parameter is_psd, tx_power, and eirp_psd_power. eirp_psd_power will 2205 * only be filled if the channel is PSD. 2206 * 2207 * Return: QDF_STATUS 2208 */ 2209 QDF_STATUS 2210 wlan_reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev *pdev, 2211 enum reg_6g_client_type client_type, 2212 qdf_freq_t chan_freq, 2213 bool *is_psd, uint16_t *tx_power, 2214 uint16_t *eirp_psd_power); 2215 2216 /** 2217 * wlan_reg_decide_6g_ap_pwr_type() - Decide which power mode AP should operate 2218 * in 2219 * 2220 * @pdev: pdev ptr 2221 * 2222 * Return: AP power type 2223 */ 2224 enum reg_6g_ap_type 2225 wlan_reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev); 2226 2227 /** 2228 * wlan_reg_set_ap_pwr_and_update_chan_list() - Set the AP power mode and 2229 * recompute the current channel list 2230 * 2231 * @pdev: pdev ptr 2232 * @ap_pwr_type: the AP power type to update to 2233 * 2234 * Return: QDF_STATUS 2235 */ 2236 QDF_STATUS 2237 wlan_reg_set_ap_pwr_and_update_chan_list(struct wlan_objmgr_pdev *pdev, 2238 enum reg_6g_ap_type ap_pwr_type); 2239 2240 /** 2241 * wlan_reg_get_best_6g_pwr_type() - Returns the best 6g power type supported 2242 * for a given frequency. 2243 * @pdev: pdev pointer 2244 * @freq: input frequency. 2245 * 2246 * Return: supported_6g_pwr_types enum. 2247 */ 2248 enum supported_6g_pwr_types 2249 wlan_reg_get_best_6g_pwr_type(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); 2250 2251 /** 2252 * wlan_reg_conv_6g_ap_type_to_supported_6g_pwr_types() - Converts the 6G AP 2253 * power type to 6g supported power type enum. 2254 * @ap_pwr_type: input 6G AP power type. 2255 * 2256 * Return: supported_6g_pwr_types enum. 2257 */ 2258 enum supported_6g_pwr_types 2259 wlan_reg_conv_6g_ap_type_to_supported_6g_pwr_types(enum reg_6g_ap_type 2260 ap_pwr_type); 2261 2262 /** 2263 * wlan_reg_conv_supported_6g_pwr_type_to_ap_pwr_type() - The supported 6G power 2264 * type is a combination of AP and client power types. This API return the 6G AP 2265 * power type portion of the supported 6G power type. 2266 * @in_6g_pwr_type: input 6G supported power type. 2267 * 2268 * Return: 6G AP power type. 2269 */ 2270 enum reg_6g_ap_type 2271 wlan_reg_conv_supported_6g_pwr_type_to_ap_pwr_type(enum supported_6g_pwr_types 2272 in_6g_pwr_type); 2273 #else /* !CONFIG_BAND_6GHZ */ 2274 static inline QDF_STATUS 2275 wlan_reg_get_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev, 2276 enum reg_6g_ap_type *reg_cur_6g_ap_pwr_type) 2277 { 2278 *reg_cur_6g_ap_pwr_type = REG_CURRENT_MAX_AP_TYPE; 2279 return QDF_STATUS_E_NOSUPPORT; 2280 } 2281 2282 static inline QDF_STATUS 2283 wlan_reg_get_cur_6g_client_type(struct wlan_objmgr_pdev *pdev, 2284 enum reg_6g_client_type 2285 *reg_cur_6g_client_mobility_type) 2286 { 2287 *reg_cur_6g_client_mobility_type = REG_SUBORDINATE_CLIENT; 2288 return QDF_STATUS_E_NOSUPPORT; 2289 } 2290 2291 static inline 2292 QDF_STATUS wlan_reg_get_rnr_tpe_usable(struct wlan_objmgr_pdev *pdev, 2293 bool *reg_rnr_tpe_usable) 2294 { 2295 *reg_rnr_tpe_usable = false; 2296 return QDF_STATUS_E_NOSUPPORT; 2297 } 2298 2299 static inline 2300 QDF_STATUS wlan_reg_get_unspecified_ap_usable(struct wlan_objmgr_pdev *pdev, 2301 bool *reg_unspecified_ap_usable) 2302 { 2303 *reg_unspecified_ap_usable = false; 2304 return QDF_STATUS_E_NOSUPPORT; 2305 } 2306 2307 static inline 2308 bool wlan_reg_is_6g_psd_power(struct wlan_objmgr_pdev *pdev) 2309 { 2310 return false; 2311 } 2312 2313 static inline 2314 QDF_STATUS wlan_reg_get_6g_chan_ap_power(struct wlan_objmgr_pdev *pdev, 2315 qdf_freq_t chan_freq, bool *is_psd, 2316 uint16_t *tx_power, 2317 uint16_t *eirp_psd_power) 2318 { 2319 *is_psd = false; 2320 *tx_power = 0; 2321 *eirp_psd_power = 0; 2322 return QDF_STATUS_E_NOSUPPORT; 2323 } 2324 2325 static inline QDF_STATUS 2326 wlan_reg_get_client_power_for_connecting_ap(struct wlan_objmgr_pdev *pdev, 2327 enum reg_6g_ap_type ap_type, 2328 qdf_freq_t chan_freq, 2329 bool is_psd, uint16_t *tx_power, 2330 uint16_t *eirp_psd_power) 2331 { 2332 *tx_power = 0; 2333 *eirp_psd_power = 0; 2334 return QDF_STATUS_E_NOSUPPORT; 2335 } 2336 2337 static inline QDF_STATUS 2338 wlan_reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev *pdev, 2339 enum reg_6g_client_type client_type, 2340 qdf_freq_t chan_freq, 2341 bool *is_psd, uint16_t *tx_power, 2342 uint16_t *eirp_psd_power) 2343 { 2344 *is_psd = false; 2345 *tx_power = 0; 2346 *eirp_psd_power = 0; 2347 return QDF_STATUS_E_NOSUPPORT; 2348 } 2349 2350 static inline enum reg_6g_ap_type 2351 wlan_reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev) 2352 { 2353 return REG_INDOOR_AP; 2354 } 2355 2356 static inline QDF_STATUS 2357 wlan_reg_set_ap_pwr_and_update_chan_list(struct wlan_objmgr_pdev *pdev, 2358 enum reg_6g_ap_type ap_pwr_type) 2359 { 2360 return QDF_STATUS_E_NOSUPPORT; 2361 } 2362 2363 static inline enum supported_6g_pwr_types 2364 wlan_reg_get_best_6g_pwr_type(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) 2365 { 2366 return REG_INVALID_PWR_MODE; 2367 } 2368 2369 static inline enum supported_6g_pwr_types 2370 wlan_reg_conv_6g_ap_type_to_supported_6g_pwr_types(enum reg_6g_ap_type 2371 ap_pwr_type) 2372 { 2373 return REG_INVALID_PWR_MODE; 2374 } 2375 2376 static inline enum reg_6g_ap_type 2377 wlan_reg_conv_supported_6g_pwr_type_to_ap_pwr_type(enum supported_6g_pwr_types 2378 in_6g_pwr_type) 2379 { 2380 return REG_MAX_AP_TYPE; 2381 } 2382 #endif /* CONFIG_BAND_6GHZ */ 2383 2384 /** 2385 * wlan_reg_is_ext_tpc_supported() - Checks if FW supports new WMI cmd for TPC 2386 * 2387 * @psoc: psoc ptr 2388 * 2389 * Return: true if FW supports new command or false otherwise 2390 */ 2391 bool wlan_reg_is_ext_tpc_supported(struct wlan_objmgr_psoc *psoc); 2392 2393 /** 2394 * wlan_reg_is_chwidth_supported() - Check if given channel width is supported 2395 * on a given pdev 2396 * @pdev: pdev pointer 2397 * @ch_width: channel width. 2398 * @is_supported: whether the channel width is supported 2399 * 2400 * Return QDF_STATUS_SUCCESS of operation 2401 */ 2402 QDF_STATUS wlan_reg_is_chwidth_supported(struct wlan_objmgr_pdev *pdev, 2403 enum phy_ch_width ch_width, 2404 bool *is_supported); 2405 2406 #ifdef CONFIG_BAND_6GHZ 2407 /** 2408 * wlan_reg_get_thresh_priority_freq() - Get the prioritized frequency value 2409 * @pdev: pdev pointer 2410 */ 2411 qdf_freq_t wlan_reg_get_thresh_priority_freq(struct wlan_objmgr_pdev *pdev); 2412 2413 /** 2414 * wlan_reg_psd_2_eirp() - Calculate EIRP from PSD and bandwidth 2415 * channel list 2416 * @pdev: pdev pointer 2417 * @psd: Power Spectral Density in dBm/MHz 2418 * @ch_bw: Bandwidth of a channel in MHz (20/40/80/160/320 etc) 2419 * @eirp: EIRP power in dBm 2420 * 2421 * Return: QDF_STATUS 2422 */ 2423 QDF_STATUS wlan_reg_psd_2_eirp(struct wlan_objmgr_pdev *pdev, 2424 int16_t psd, 2425 uint16_t ch_bw, 2426 int16_t *eirp); 2427 2428 /** 2429 * wlan_reg_eirp_2_psd() - Calculate PSD poewr from EIRP and bandwidth 2430 * @pdev: pdev pointer 2431 * @ch_bw: Bandwidth of a channel in MHz (20/40/80/160/320 etc) 2432 * @eirp: EIRP power in dBm 2433 * @psd: Power Spectral Density in dBm/MHz 2434 * 2435 * Return: QDF_STATUS 2436 */ 2437 QDF_STATUS wlan_reg_eirp_2_psd(struct wlan_objmgr_pdev *pdev, 2438 uint16_t ch_bw, 2439 int16_t eirp, 2440 int16_t *psd); 2441 2442 /** 2443 * wlan_reg_get_best_pwr_mode() - Get the best power mode based on input freq 2444 * and bandwidth. The mode that provides the best EIRP is the best power mode. 2445 * @pdev: Pointer to pdev 2446 * @freq: Frequency in MHz 2447 * @cen320: 320 MHz band center frequency. For other BW, this param is 2448 * ignored while processing 2449 * @bw: Bandwidth in MHz 2450 * 2451 * Return: Best power mode 2452 */ 2453 enum reg_6g_ap_type 2454 wlan_reg_get_best_pwr_mode(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq, 2455 qdf_freq_t cen320, uint16_t bw); 2456 2457 /** 2458 * wlan_reg_get_eirp_pwr() - Get eirp power based on the AP power mode 2459 * @pdev: Pointer to pdev 2460 * @freq: Frequency in MHz 2461 * @cen320: 320 MHz Band center frequency 2462 * @bw: Bandwidth in MHz 2463 * @ap_pwr_type: AP power type 2464 * 2465 * Return: EIRP power 2466 */ 2467 uint8_t wlan_reg_get_eirp_pwr(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq, 2468 qdf_freq_t cen320, uint16_t bw, 2469 enum reg_6g_ap_type ap_pwr_type); 2470 #else 2471 static inline 2472 qdf_freq_t wlan_reg_get_thresh_priority_freq(struct wlan_objmgr_pdev *pdev) 2473 { 2474 return 0; 2475 } 2476 2477 static inline enum reg_6g_ap_type 2478 wlan_reg_get_best_pwr_mode(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq, 2479 qdf_freq_t cen320, 2480 uint16_t bw) 2481 { 2482 return REG_MAX_AP_TYPE; 2483 } 2484 2485 static inline QDF_STATUS wlan_reg_psd_2_eirp(struct wlan_objmgr_pdev *pdev, 2486 int16_t psd, 2487 uint16_t ch_bw, 2488 int16_t *eirp) 2489 { 2490 return QDF_STATUS_E_FAILURE; 2491 } 2492 2493 static inline QDF_STATUS wlan_reg_eirp_2_psd(struct wlan_objmgr_pdev *pdev, 2494 uint16_t ch_bw, 2495 int16_t eirp, 2496 int16_t *psd) 2497 { 2498 return QDF_STATUS_E_FAILURE; 2499 } 2500 2501 static inline uint8_t wlan_reg_get_eirp_pwr(struct wlan_objmgr_pdev *pdev, 2502 qdf_freq_t freq, 2503 qdf_freq_t cen320, uint16_t bw, 2504 enum reg_6g_ap_type ap_pwr_type) 2505 { 2506 return 0; 2507 } 2508 #endif /* CONFIG_BAND_6GHZ */ 2509 /** 2510 * wlan_reg_find_chwidth_from_bw () - Gets channel width for given 2511 * bandwidth 2512 * @bw: Bandwidth 2513 * 2514 * Return: phy_ch_width 2515 */ 2516 enum phy_ch_width wlan_reg_find_chwidth_from_bw(uint16_t bw); 2517 2518 /** 2519 * wlan_reg_get_chan_state_for_320() - Get the channel state of a 320 MHz 2520 * bonded channel. 2521 * @pdev: Pointer to wlan_objmgr_pdev 2522 * @freq: Primary frequency 2523 * @center_320: Band center of 320 MHz 2524 * @ch_width: Channel width 2525 * @bonded_chan_ptr_ptr: Pointer to bonded channel pointer 2526 * @treat_nol_chan_as_disabled: Bool to treat nol chan as enabled/disabled 2527 * @in_pwr_type: Input 6g power type 2528 * 2529 * Return: Channel state 2530 */ 2531 #ifdef WLAN_FEATURE_11BE 2532 enum channel_state 2533 wlan_reg_get_chan_state_for_320(struct wlan_objmgr_pdev *pdev, 2534 uint16_t freq, 2535 qdf_freq_t center_320, 2536 enum phy_ch_width ch_width, 2537 const struct bonded_channel_freq 2538 **bonded_chan_ptr_ptr, 2539 enum supported_6g_pwr_types in_6g_pwr_type, 2540 bool treat_nol_chan_as_disabled); 2541 #else 2542 static inline enum channel_state 2543 wlan_reg_get_chan_state_for_320(struct wlan_objmgr_pdev *pdev, 2544 uint16_t freq, 2545 qdf_freq_t center_320, 2546 enum phy_ch_width ch_width, 2547 const struct bonded_channel_freq 2548 **bonded_chan_ptr_ptr, 2549 enum supported_6g_pwr_types in_6g_pwr_type, 2550 bool treat_nol_chan_as_disabled) 2551 { 2552 return CHANNEL_STATE_INVALID; 2553 } 2554 #endif 2555 2556 /** 2557 * wlan_is_sup_chan_entry_afc_done() - Checks if the super chan entry of given 2558 * channel idx and power mode has REGULATORY_CHAN_AFC_NOT_DONE flag cleared. 2559 * 2560 * @pdev: pdev pointer 2561 * @freq: input channel idx 2562 * @in_6g_pwr_mode: input power mode 2563 * 2564 * Return: True if REGULATORY_CHAN_AFC_NOT_DONE flag is clear for the super 2565 * chan entry. 2566 */ 2567 #ifdef CONFIG_BAND_6GHZ 2568 bool 2569 wlan_is_sup_chan_entry_afc_done(struct wlan_objmgr_pdev *pdev, 2570 enum channel_enum chan_idx, 2571 enum supported_6g_pwr_types in_6g_pwr_mode); 2572 2573 /** 2574 * wlan_reg_display_super_chan_list() - Display super channel list for all modes 2575 * @pdev: Pointer to pdev 2576 * 2577 * Return: QDF_STATUS 2578 */ 2579 QDF_STATUS 2580 wlan_reg_display_super_chan_list(struct wlan_objmgr_pdev *pdev); 2581 #else 2582 static inline bool 2583 wlan_is_sup_chan_entry_afc_done(struct wlan_objmgr_pdev *pdev, 2584 enum channel_enum chan_idx, 2585 enum supported_6g_pwr_types in_6g_pwr_mode) 2586 { 2587 return false; 2588 } 2589 2590 static inline QDF_STATUS 2591 wlan_reg_display_super_chan_list(struct wlan_objmgr_pdev *pdev) 2592 { 2593 return QDF_STATUS_E_NOSUPPORT; 2594 } 2595 #endif 2596 #endif 2597