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 840 /** 841 * wlan_reg_is_6ghz_freq_txable() - Check if the given frequency is tx-able. 842 * @pdev: Pointer to pdev 843 * @freq: Frequency in MHz 844 * @in_6ghz_pwr_type: Input AP power type 845 * 846 * An SP channel is tx-able if the channel is present in the AFC response. 847 * In case of non-OUTDOOR mode a channel is always tx-able (Assuming it is 848 * enabled by regulatory). 849 * 850 * Return: True if the frequency is tx-able, else false. 851 */ 852 bool 853 wlan_reg_is_6ghz_freq_txable(struct wlan_objmgr_pdev *pdev, 854 qdf_freq_t freq, 855 enum supported_6g_pwr_types in_6ghz_pwr_mode); 856 #else 857 static inline bool 858 wlan_reg_is_afc_power_event_received(struct wlan_objmgr_pdev *pdev) 859 { 860 return false; 861 } 862 863 static inline bool 864 wlan_reg_is_afc_done(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) 865 { 866 return true; 867 } 868 869 static inline QDF_STATUS 870 wlan_reg_get_6g_afc_chan_list(struct wlan_objmgr_pdev *pdev, 871 struct regulatory_channel *chan_list) 872 { 873 return QDF_STATUS_E_NOSUPPORT; 874 } 875 876 static inline bool 877 wlan_reg_is_sta_connect_allowed(struct wlan_objmgr_pdev *pdev, 878 enum reg_6g_ap_type root_ap_pwr_mode) 879 { 880 return true; 881 } 882 883 static inline bool 884 wlan_reg_is_6ghz_freq_txable(struct wlan_objmgr_pdev *pdev, 885 qdf_freq_t freq, 886 enum supported_6g_pwr_types in_6ghz_pwr_mode) 887 { 888 return false; 889 } 890 #endif 891 892 /** 893 * wlan_reg_get_bonded_channel_state_for_freq() - Get bonded channel freq state 894 * @freq: channel frequency 895 * @bw: channel band width 896 * @sec_freq: secondary frequency 897 * 898 * Return: channel state 899 */ 900 enum channel_state 901 wlan_reg_get_bonded_channel_state_for_freq(struct wlan_objmgr_pdev *pdev, 902 qdf_freq_t freq, 903 enum phy_ch_width bw, 904 qdf_freq_t sec_freq); 905 906 #ifdef CONFIG_REG_6G_PWRMODE 907 /** 908 * wlan_reg_get_bonded_channel_state_for_pwrmode() - Get bonded channel freq 909 * state 910 * @freq: channel frequency 911 * @bw: channel band width 912 * @sec_freq: secondary frequency 913 * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup. 914 * @input_puncture_bitmap: input puncture bitmap 915 * 916 * Return: channel state 917 */ 918 enum channel_state 919 wlan_reg_get_bonded_channel_state_for_pwrmode(struct wlan_objmgr_pdev *pdev, 920 qdf_freq_t freq, 921 enum phy_ch_width bw, 922 qdf_freq_t sec_freq, 923 enum supported_6g_pwr_types 924 in_6g_pwr_mode, 925 uint16_t input_puncture_bitmap); 926 #endif 927 928 /** 929 * wlan_reg_set_dfs_region() - set the dfs region 930 * @pdev: pdev ptr 931 * @dfs_reg: dfs region 932 * 933 * Return: void 934 */ 935 void wlan_reg_set_dfs_region(struct wlan_objmgr_pdev *pdev, 936 enum dfs_reg dfs_reg); 937 938 /** 939 * wlan_reg_get_bw_value() - provide the channel center freq 940 * @chan_num: chennal number 941 * 942 * Return: int 943 */ 944 uint16_t wlan_reg_get_bw_value(enum phy_ch_width bw); 945 946 /** 947 * wlan_reg_get_domain_from_country_code() - provide the channel center freq 948 * @reg_domain_ptr: regulatory domain ptr 949 * @country_alpha2: country alpha2 950 * @source: alpha2 source 951 * 952 * Return: int 953 */ 954 QDF_STATUS wlan_reg_get_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr, 955 const uint8_t *country_alpha2, 956 enum country_src source); 957 958 /** 959 * wlan_reg_dmn_get_opclass_from_channel() - provide the channel center freq 960 * @country: country alpha2 961 * @channel: channel number 962 * @offset: offset 963 * 964 * Return: int 965 */ 966 uint16_t wlan_reg_dmn_get_opclass_from_channel(uint8_t *country, 967 uint8_t channel, 968 uint8_t offset); 969 970 /** 971 * wlan_reg_get_opclass_from_freq_width() - Get operating class from frequency 972 * @country: Country code. 973 * @freq: Channel center frequency. 974 * @ch_width: Channel width. 975 * @behav_limit: Behaviour limit. 976 * 977 * Return: Error code. 978 */ 979 uint8_t wlan_reg_get_opclass_from_freq_width(uint8_t *country, 980 qdf_freq_t freq, 981 uint16_t ch_width, 982 uint16_t behav_limit); 983 984 /** 985 * wlan_reg_get_band_cap_from_op_class() - Return band capability bitmap 986 * @country: Pointer to Country code. 987 * @num_of_opclass: Number of Operating class. 988 * @opclass: Pointer to opclass. 989 * 990 * Return supported band bitmap based on the input operating class list 991 * provided. 992 * 993 * Return: Return supported band capability 994 */ 995 uint8_t wlan_reg_get_band_cap_from_op_class(const uint8_t *country, 996 uint8_t num_of_opclass, 997 const uint8_t *opclass); 998 999 /** 1000 * wlan_reg_dmn_print_channels_in_opclass() - Print channels in op-class 1001 * @country: country alpha2 1002 * @opclass: oplcass 1003 * 1004 * Return: void 1005 */ 1006 void wlan_reg_dmn_print_channels_in_opclass(uint8_t *country, 1007 uint8_t opclass); 1008 1009 1010 /** 1011 * wlan_reg_dmn_get_chanwidth_from_opclass() - get channel width from 1012 * operating class 1013 * @country: country alpha2 1014 * @channel: channel number 1015 * @opclass: operating class 1016 * 1017 * Return: int 1018 */ 1019 uint16_t wlan_reg_dmn_get_chanwidth_from_opclass(uint8_t *country, 1020 uint8_t channel, 1021 uint8_t opclass); 1022 1023 /** 1024 * wlan_reg_dmn_get_chanwidth_from_opclass_auto() - get channel width from 1025 * operating class. If opclass not found then search in global opclass. 1026 * @country: country alpha2 1027 * @channel: channel number 1028 * @opclass: operating class 1029 * 1030 * Return: int 1031 */ 1032 uint16_t wlan_reg_dmn_get_chanwidth_from_opclass_auto(uint8_t *country, 1033 uint8_t channel, 1034 uint8_t opclass); 1035 1036 /** 1037 * wlan_reg_dmn_set_curr_opclasses() - set operating class 1038 * @num_classes: number of classes 1039 * @class: operating class 1040 * 1041 * Return: int 1042 */ 1043 uint16_t wlan_reg_dmn_set_curr_opclasses(uint8_t num_classes, 1044 uint8_t *class); 1045 1046 /** 1047 * wlan_reg_dmn_get_curr_opclasses() - get current oper classes 1048 * @num_classes: number of classes 1049 * @class: operating class 1050 * 1051 * Return: int 1052 */ 1053 uint16_t wlan_reg_dmn_get_curr_opclasses(uint8_t *num_classes, 1054 uint8_t *class); 1055 1056 1057 /** 1058 * wlan_reg_get_opclass_details() - Get details about the current opclass table. 1059 * @pdev: Pointer to pdev. 1060 * @reg_ap_cap: Pointer to reg_ap_cap. 1061 * @n_opclasses: Pointer to number of opclasses. 1062 * @max_supp_op_class: Maximum number of operating classes supported. 1063 * @global_tbl_lookup: Whether to lookup global op class tbl. 1064 * 1065 * Return: QDF_STATUS_SUCCESS if success, else return QDF_STATUS_FAILURE. 1066 */ 1067 QDF_STATUS 1068 wlan_reg_get_opclass_details(struct wlan_objmgr_pdev *pdev, 1069 struct regdmn_ap_cap_opclass_t *reg_ap_cap, 1070 uint8_t *n_opclasses, 1071 uint8_t max_supp_op_class, 1072 bool global_tbl_lookup); 1073 1074 /** 1075 * wlan_reg_get_opclass_for_cur_hwmode() - Get details about the 1076 * opclass table for the current hwmode. 1077 * @pdev: Pointer to pdev. 1078 * @reg_ap_cap: Pointer to reg_ap_cap. 1079 * @n_opclasses: Pointer to number of opclasses. 1080 * @max_supp_op_class: Maximum number of operating classes supported. 1081 * @global_tbl_lookup: Whether to lookup global op class tbl. 1082 * @max_chwidth: Maximum channel width supported by cur hwmode 1083 * @is_80p80_supp: Bool to indicate if 80p80 is supported. 1084 * 1085 * Return: QDF_STATUS_SUCCESS if success, else return QDF_STATUS_FAILURE. 1086 */ 1087 QDF_STATUS 1088 wlan_reg_get_opclass_for_cur_hwmode(struct wlan_objmgr_pdev *pdev, 1089 struct regdmn_ap_cap_opclass_t *reg_ap_cap, 1090 uint8_t *n_opclasses, 1091 uint8_t max_supp_op_class, 1092 bool global_tbl_lookup, 1093 enum phy_ch_width max_chwidth, 1094 bool is_80p80_supp); 1095 /** 1096 * wlan_reg_get_cc_and_src () - get country code and src 1097 * @psoc: psoc ptr 1098 * @alpha2: country code alpha2 1099 * 1100 * Return: country_src 1101 */ 1102 enum country_src wlan_reg_get_cc_and_src(struct wlan_objmgr_psoc *psoc, 1103 uint8_t *alpha); 1104 1105 /** 1106 * wlan_regulatory_init() - init regulatory component 1107 * 1108 * Return: Success or Failure 1109 */ 1110 QDF_STATUS wlan_regulatory_init(void); 1111 1112 /** 1113 * wlan_regulatory_deinit() - deinit regulatory component 1114 * 1115 * Return: Success or Failure 1116 */ 1117 QDF_STATUS wlan_regulatory_deinit(void); 1118 1119 /** 1120 * regulatory_psoc_open() - open regulatory component 1121 * 1122 * Return: Success or Failure 1123 */ 1124 QDF_STATUS regulatory_psoc_open(struct wlan_objmgr_psoc *psoc); 1125 1126 1127 /** 1128 * regulatory_psoc_close() - close regulatory component 1129 * 1130 * Return: Success or Failure 1131 */ 1132 QDF_STATUS regulatory_psoc_close(struct wlan_objmgr_psoc *psoc); 1133 1134 /** 1135 * regulatory_pdev_open() - Open regulatory component 1136 * @pdev: Pointer to pdev structure 1137 * 1138 * Return: Success or Failure 1139 */ 1140 QDF_STATUS regulatory_pdev_open(struct wlan_objmgr_pdev *pdev); 1141 1142 /** 1143 * regulatory_pdev_close() - Close regulatory component 1144 * @pdev: Pointer to pdev structure. 1145 * 1146 * Return: Success or Failure 1147 */ 1148 QDF_STATUS regulatory_pdev_close(struct wlan_objmgr_pdev *pdev); 1149 1150 /** 1151 * wlan_reg_freq_to_chan () - convert channel freq to channel number 1152 * @pdev: The physical dev to set current country for 1153 * @freq: frequency 1154 * 1155 * Return: true or false 1156 */ 1157 uint8_t wlan_reg_freq_to_chan(struct wlan_objmgr_pdev *pdev, 1158 qdf_freq_t freq); 1159 1160 /** 1161 * wlan_reg_legacy_chan_to_freq () - convert chan to freq, for 2G and 5G 1162 * @chan: channel number 1163 * 1164 * Return: frequency 1165 */ 1166 qdf_freq_t wlan_reg_legacy_chan_to_freq(struct wlan_objmgr_pdev *pdev, 1167 uint8_t chan); 1168 1169 /** 1170 * wlan_reg_is_us() - reg is us country 1171 * @country: The country information 1172 * 1173 * Return: true or false 1174 */ 1175 bool wlan_reg_is_us(uint8_t *country); 1176 1177 /** 1178 * wlan_reg_is_etsi() - reg is a country in EU 1179 * @country: The country information 1180 * 1181 * Return: true or false 1182 */ 1183 bool wlan_reg_is_etsi(uint8_t *country); 1184 1185 1186 /** 1187 * wlan_reg_ctry_support_vlp() - Country supports VLP or not 1188 * @country: The country information 1189 * 1190 * Return: true or false 1191 */ 1192 bool wlan_reg_ctry_support_vlp(uint8_t *country); 1193 1194 /** 1195 * wlan_reg_set_country() - Set the current regulatory country 1196 * @pdev: The physical dev to set current country for 1197 * @country: The country information to configure 1198 * 1199 * Return: QDF_STATUS 1200 */ 1201 QDF_STATUS wlan_reg_set_country(struct wlan_objmgr_pdev *pdev, 1202 uint8_t *country); 1203 1204 /** 1205 * wlan_reg_set_11d_country() - Set the 11d regulatory country 1206 * @pdev: The physical dev to set current country for 1207 * @country: The country information to configure 1208 * 1209 * Return: QDF_STATUS 1210 */ 1211 QDF_STATUS wlan_reg_set_11d_country(struct wlan_objmgr_pdev *pdev, 1212 uint8_t *country); 1213 1214 /** 1215 * wlan_reg_register_chan_change_callback () - add chan change cbk 1216 * @psoc: psoc ptr 1217 * @cbk: callback 1218 * @arg: argument 1219 * 1220 * Return: true or false 1221 */ 1222 void wlan_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc, 1223 void *cbk, void *arg); 1224 1225 /** 1226 * wlan_reg_unregister_chan_change_callback () - remove chan change cbk 1227 * @psoc: psoc ptr 1228 * @cbk:callback 1229 * 1230 * Return: true or false 1231 */ 1232 void wlan_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc, 1233 void *cbk); 1234 1235 /** 1236 * wlan_reg_register_ctry_change_callback () - add country change cbk 1237 * @psoc: psoc ptr 1238 * @cbk: callback 1239 * 1240 * Return: None 1241 */ 1242 void wlan_reg_register_ctry_change_callback(struct wlan_objmgr_psoc *psoc, 1243 void *cbk); 1244 1245 /** 1246 * wlan_reg_unregister_ctry_change_callback () - remove country change cbk 1247 * @psoc: psoc ptr 1248 * @cbk:callback 1249 * 1250 * Return: None 1251 */ 1252 void wlan_reg_unregister_ctry_change_callback(struct wlan_objmgr_psoc *psoc, 1253 void *cbk); 1254 1255 /** 1256 * wlan_reg_is_11d_offloaded() - 11d offloaded supported 1257 * @psoc: psoc ptr 1258 * 1259 * Return: bool 1260 */ 1261 bool wlan_reg_is_11d_offloaded(struct wlan_objmgr_psoc *psoc); 1262 1263 /** 1264 * wlan_reg_11d_enabled_on_host() - 11d enabled don host 1265 * @psoc: psoc ptr 1266 * 1267 * Return: bool 1268 */ 1269 bool wlan_reg_11d_enabled_on_host(struct wlan_objmgr_psoc *psoc); 1270 1271 /** 1272 * wlan_reg_get_chip_mode() - get supported chip mode 1273 * @pdev: pdev pointer 1274 * @chip_mode: chip mode 1275 * 1276 * Return: QDF STATUS 1277 */ 1278 QDF_STATUS wlan_reg_get_chip_mode(struct wlan_objmgr_pdev *pdev, 1279 uint64_t *chip_mode); 1280 1281 /** 1282 * wlan_reg_is_11d_scan_inprogress() - checks 11d scan status 1283 * @psoc: psoc ptr 1284 * 1285 * Return: bool 1286 */ 1287 bool wlan_reg_is_11d_scan_inprogress(struct wlan_objmgr_psoc *psoc); 1288 /** 1289 * wlan_reg_get_freq_range() - Get 2GHz and 5GHz frequency range 1290 * @pdev: pdev pointer 1291 * @low_2g: low 2GHz frequency range 1292 * @high_2g: high 2GHz frequency range 1293 * @low_5g: low 5GHz frequency range 1294 * @high_5g: high 5GHz frequency range 1295 * 1296 * Return: QDF status 1297 */ 1298 QDF_STATUS wlan_reg_get_freq_range(struct wlan_objmgr_pdev *pdev, 1299 qdf_freq_t *low_2g, 1300 qdf_freq_t *high_2g, 1301 qdf_freq_t *low_5g, 1302 qdf_freq_t *high_5g); 1303 /** 1304 * wlan_reg_get_tx_ops () - get regulatory tx ops 1305 * @psoc: psoc ptr 1306 * 1307 */ 1308 struct wlan_lmac_if_reg_tx_ops * 1309 wlan_reg_get_tx_ops(struct wlan_objmgr_psoc *psoc); 1310 1311 /** 1312 * wlan_reg_get_curr_regdomain() - Get current regdomain in use 1313 * @pdev: pdev pointer 1314 * @cur_regdmn: Current regdomain info 1315 * 1316 * Return: QDF status 1317 */ 1318 QDF_STATUS wlan_reg_get_curr_regdomain(struct wlan_objmgr_pdev *pdev, 1319 struct cur_regdmn_info *cur_regdmn); 1320 1321 #ifdef WLAN_REG_PARTIAL_OFFLOAD 1322 /** 1323 * wlan_reg_is_regdmn_en302502_applicable() - Find if ETSI EN302_502 radar 1324 * pattern is applicable in the current regulatory domain. 1325 * @pdev: Pdev ptr. 1326 * 1327 * Return: Boolean. 1328 * True: If EN302_502 is applicable. 1329 * False: otherwise. 1330 */ 1331 bool wlan_reg_is_regdmn_en302502_applicable(struct wlan_objmgr_pdev *pdev); 1332 #endif 1333 1334 /** 1335 * wlan_reg_modify_pdev_chan_range() - Compute current channel list for the 1336 * modified channel range in the regcap. 1337 * @pdev: pointer to wlan_objmgr_pdev. 1338 * 1339 * Return : QDF_STATUS 1340 */ 1341 QDF_STATUS wlan_reg_modify_pdev_chan_range(struct wlan_objmgr_pdev *pdev); 1342 1343 /** 1344 * wlan_reg_get_phybitmap() - Get phybitmap from regulatory pdev_priv_obj 1345 * @pdev: pdev pointer 1346 * @phybitmap: pointer to phybitmap 1347 * 1348 * Return: QDF STATUS 1349 */ 1350 QDF_STATUS wlan_reg_get_phybitmap(struct wlan_objmgr_pdev *pdev, 1351 uint16_t *phybitmap); 1352 1353 /** 1354 * wlan_reg_update_pdev_wireless_modes() - Update the wireless_modes in the 1355 * pdev_priv_obj with the input wireless_modes 1356 * @pdev: pointer to wlan_objmgr_pdev. 1357 * @wireless_modes: Wireless modes. 1358 * 1359 * Return : QDF_STATUS 1360 */ 1361 QDF_STATUS wlan_reg_update_pdev_wireless_modes(struct wlan_objmgr_pdev *pdev, 1362 uint64_t wireless_modes); 1363 /** 1364 * wlan_reg_disable_chan_coex() - Disable Coexisting channels based on the input 1365 * bitmask 1366 * @pdev: pointer to wlan_objmgr_pdev. 1367 * unii_5g_bitmap: UNII 5G bitmap. 1368 * 1369 * Return : QDF_STATUS 1370 */ 1371 #ifdef DISABLE_UNII_SHARED_BANDS 1372 QDF_STATUS wlan_reg_disable_chan_coex(struct wlan_objmgr_pdev *pdev, 1373 uint8_t unii_5g_bitmap); 1374 #else 1375 static inline QDF_STATUS 1376 wlan_reg_disable_chan_coex(struct wlan_objmgr_pdev *pdev, 1377 uint8_t unii_5g_bitmap) 1378 { 1379 return QDF_STATUS_SUCCESS; 1380 } 1381 #endif 1382 1383 #ifdef WLAN_FEATURE_GET_USABLE_CHAN_LIST 1384 /** 1385 * wlan_reg_get_usable_channel() - Get usable channels 1386 * @pdev: Pointer to pdev 1387 * @req_msg: Request msg 1388 * @res_msg: Response msg 1389 * @count: no of usable channels 1390 * 1391 * Return: qdf status 1392 */ 1393 QDF_STATUS 1394 wlan_reg_get_usable_channel(struct wlan_objmgr_pdev *pdev, 1395 struct get_usable_chan_req_params req_msg, 1396 struct get_usable_chan_res_params *res_msg, 1397 uint32_t *count); 1398 #endif 1399 1400 #ifdef CONFIG_CHAN_FREQ_API 1401 /** 1402 * wlan_reg_is_same_band_freqs() - Check if two channel frequencies 1403 * have same band 1404 * @freq1: Frequency 1 1405 * @freq2: Frequency 2 1406 * 1407 * Return: true if both the channel frequency has the same band. 1408 */ 1409 #define WLAN_REG_IS_SAME_BAND_FREQS(freq1, freq2) \ 1410 wlan_reg_is_same_band_freqs(freq1, freq2) 1411 bool wlan_reg_is_same_band_freqs(qdf_freq_t freq1, qdf_freq_t freq2); 1412 1413 /** 1414 * wlan_reg_get_chan_enum_for_freq() - Get channel enum for given channel center 1415 * frequency 1416 * @freq: Channel center frequency 1417 * 1418 * Return: Channel enum 1419 */ 1420 enum channel_enum wlan_reg_get_chan_enum_for_freq(qdf_freq_t freq); 1421 1422 /** 1423 * wlan_reg_is_freq_present_in_cur_chan_list() - Check if channel is present 1424 * in the current channel list 1425 * @pdev: pdev pointer 1426 * @freq: Channel center frequency 1427 * 1428 * Return: true if channel is present in current channel list 1429 */ 1430 bool wlan_reg_is_freq_present_in_cur_chan_list(struct wlan_objmgr_pdev *pdev, 1431 qdf_freq_t freq); 1432 1433 /** 1434 * wlan_reg_update_nol_history_ch_for_freq() - Set nol-history flag for the 1435 * channels in the list. 1436 * 1437 * @pdev: Pdev ptr 1438 * @ch_list: Input channel list. 1439 * @num_ch: Number of channels. 1440 * @nol_history_ch: Nol history value. 1441 * 1442 * Return: void 1443 */ 1444 void wlan_reg_update_nol_history_ch_for_freq(struct wlan_objmgr_pdev *pdev, 1445 uint16_t *ch_list, 1446 uint8_t num_ch, 1447 bool nol_history_ch); 1448 1449 /** 1450 * wlan_reg_chan_has_dfs_attribute_for_freq() - check channel has dfs 1451 * attribute flag 1452 * @freq: channel center frequency. 1453 * 1454 * This API get chan initial dfs attribute from regdomain 1455 * 1456 * Return: true if chan is dfs, otherwise false 1457 */ 1458 bool 1459 wlan_reg_chan_has_dfs_attribute_for_freq(struct wlan_objmgr_pdev *pdev, 1460 qdf_freq_t freq); 1461 1462 /** 1463 * wlan_reg_get_channel_list_with_power_for_freq() - Provide the channel list 1464 * with power 1465 * @ch_list: pointer to the channel list. 1466 * 1467 * Return: QDF_STATUS 1468 */ 1469 QDF_STATUS 1470 wlan_reg_get_channel_list_with_power_for_freq(struct wlan_objmgr_pdev *pdev, 1471 struct channel_power *ch_list, 1472 uint8_t *num_chan); 1473 /** 1474 * wlan_reg_get_5g_bonded_channel_state_for_freq() - Get 5G bonded channel state 1475 * @pdev: The physical dev to program country code or regdomain 1476 * @freq: channel frequency. 1477 * @bw: channel band width 1478 * 1479 * Return: channel state 1480 */ 1481 enum channel_state 1482 wlan_reg_get_5g_bonded_channel_state_for_freq(struct wlan_objmgr_pdev *pdev, 1483 qdf_freq_t freq, 1484 enum phy_ch_width bw); 1485 1486 #ifdef CONFIG_REG_6G_PWRMODE 1487 /** 1488 * wlan_reg_get_5g_bonded_channel_state_for_pwrmode() - Get 5G bonded channel 1489 * state. 1490 * @pdev: The physical dev to program country code or regdomain 1491 * @freq: channel frequency. 1492 * @ch_params: channel parameters 1493 * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup. 1494 * 1495 * Return: channel state 1496 */ 1497 enum channel_state 1498 wlan_reg_get_5g_bonded_channel_state_for_pwrmode(struct wlan_objmgr_pdev *pdev, 1499 qdf_freq_t freq, 1500 struct ch_params *ch_params, 1501 enum supported_6g_pwr_types 1502 in_6g_pwr_type); 1503 #endif 1504 1505 /** 1506 * wlan_reg_get_2g_bonded_channel_state_for_freq() - Get 2G bonded channel state 1507 * @pdev: The physical dev to program country code or regdomain 1508 * @freq: channel center frequency. 1509 * @sec_ch_freq: Secondary channel center frequency. 1510 * @bw: channel band width 1511 * 1512 * Return: channel state 1513 */ 1514 enum channel_state 1515 wlan_reg_get_2g_bonded_channel_state_for_freq(struct wlan_objmgr_pdev *pdev, 1516 qdf_freq_t freq, 1517 qdf_freq_t sec_ch_freq, 1518 enum phy_ch_width bw); 1519 1520 #ifdef CONFIG_REG_6G_PWRMODE 1521 /** 1522 * wlan_reg_get_channel_state_for_pwrmode() - Get channel state from regulatory 1523 * @pdev: Pointer to pdev 1524 * @freq: channel center frequency. 1525 * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup. 1526 * 1527 * Return: channel state 1528 */ 1529 enum channel_state 1530 wlan_reg_get_channel_state_for_pwrmode( 1531 struct wlan_objmgr_pdev *pdev, 1532 qdf_freq_t freq, 1533 enum supported_6g_pwr_types in_6g_pwr_type); 1534 #endif 1535 1536 #ifdef CONFIG_REG_CLIENT 1537 /** 1538 * wlan_reg_get_channel_state_from_secondary_list_for_freq() - Get channel state 1539 * from secondary regulatory current channel list 1540 * @pdev: Pointer to pdev 1541 * @freq: channel center frequency. 1542 * 1543 * Return: channel state 1544 */ 1545 enum channel_state wlan_reg_get_channel_state_from_secondary_list_for_freq( 1546 struct wlan_objmgr_pdev *pdev, 1547 qdf_freq_t freq); 1548 1549 /** 1550 * wlan_reg_get_channel_list_with_power() - Provide channel list with tx power 1551 * @ch_list: pointer to the channel list. 1552 * @num_chan: Number of channels which has been filed in ch_list 1553 * @in_6g_pwr_type: 6G power type corresponding to which 6G channels needs to 1554 * be provided 1555 * 1556 * Return: QDF_STATUS 1557 */ 1558 QDF_STATUS 1559 wlan_reg_get_channel_list_with_power( 1560 struct wlan_objmgr_pdev *pdev, 1561 struct channel_power *ch_list, 1562 uint8_t *num_chan, 1563 enum supported_6g_pwr_types in_6g_pwr_type); 1564 #endif 1565 1566 #ifdef WLAN_FEATURE_11BE 1567 /** 1568 * wlan_reg_fill_channel_list() - Fills the reg_channel_list (list of channels) 1569 * @pdev: Pointer to struct wlan_objmgr_pdev. 1570 * @freq: Center frequency of the primary channel in MHz 1571 * @sec_ch_2g_freq: Secondary channel center frequency. 1572 * @ch_width: Channel width of type 'enum phy_ch_width'. 1573 * @band_center_320: Center frequency of 320MHZ channel. 1574 * @chan_list: Pointer to struct reg_channel_list to be filled (Output param). 1575 * @treat_nol_chan_as_disabled: bool to treat nol channel as enabled or 1576 * disabled. If set to true, nol chan is considered as disabled in chan search. 1577 * 1578 * Return: None 1579 */ 1580 void wlan_reg_fill_channel_list(struct wlan_objmgr_pdev *pdev, 1581 qdf_freq_t freq, 1582 qdf_freq_t sec_ch_2g_freq, 1583 enum phy_ch_width ch_width, 1584 qdf_freq_t band_center_320, 1585 struct reg_channel_list *chan_list, 1586 bool treat_nol_chan_as_disabled); 1587 1588 /** 1589 * wlan_reg_is_punc_bitmap_valid() - is puncture bitmap valid or not 1590 * @bw: Input channel width. 1591 * @puncture_bitmap Input puncture bitmap. 1592 * 1593 * Return: true if given puncture bitmap is valid 1594 */ 1595 bool wlan_reg_is_punc_bitmap_valid(enum phy_ch_width bw, 1596 uint16_t puncture_bitmap); 1597 1598 #ifdef QCA_DFS_BW_PUNCTURE 1599 /** 1600 * wlan_reg_find_nearest_puncture_pattern() - is proposed bitmap valid or not 1601 * @bw: Input channel width. 1602 * @proposed_bitmap: Input puncture bitmap. 1603 * 1604 * Return: Radar bitmap if it is valid. 1605 */ 1606 uint16_t wlan_reg_find_nearest_puncture_pattern(enum phy_ch_width bw, 1607 uint16_t proposed_bitmap); 1608 #else 1609 static inline 1610 uint16_t wlan_reg_find_nearest_puncture_pattern(enum phy_ch_width bw, 1611 uint16_t proposed_bitmap) 1612 { 1613 return 0; 1614 } 1615 #endif /* QCA_DFS_BW_PUNCTURE */ 1616 1617 /** 1618 * wlan_reg_extract_puncture_by_bw() - generate new puncture bitmap from 1619 * original puncture bitmap and bandwidth 1620 * based on new bandwidth 1621 * @ori_bw: original bandwidth 1622 * @ori_puncture_bitmap: original puncture bitmap 1623 * @freq: frequency of primary channel 1624 * @cen320_freq: center frequency of 320 MHZ if channel width is 320 1625 * @new_bw new bandwidth 1626 * @new_puncture_bitmap: output of puncture bitmap 1627 * 1628 * Return: QDF_STATUS 1629 */ 1630 QDF_STATUS wlan_reg_extract_puncture_by_bw(enum phy_ch_width ori_bw, 1631 uint16_t ori_puncture_bitmap, 1632 qdf_freq_t freq, 1633 qdf_freq_t cen320_freq, 1634 enum phy_ch_width new_bw, 1635 uint16_t *new_puncture_bitmap); 1636 1637 /** 1638 * wlan_reg_set_create_punc_bitmap() - set is_create_punc_bitmap of ch_params 1639 * @ch_params: ch_params to set 1640 * @is_create_punc_bitmap: is create punc bitmap 1641 * 1642 * Return: NULL 1643 */ 1644 void wlan_reg_set_create_punc_bitmap(struct ch_params *ch_params, 1645 bool is_create_punc_bitmap); 1646 #ifdef CONFIG_REG_6G_PWRMODE 1647 /** 1648 * wlan_reg_fill_channel_list_for_pwrmode() - Fills the reg_channel_list 1649 * (list of channels) 1650 * @pdev: Pointer to struct wlan_objmgr_pdev. 1651 * @freq: Center frequency of the primary channel in MHz 1652 * @sec_ch_2g_freq: Secondary channel center frequency. 1653 * @ch_width: Channel width of type 'enum phy_ch_width'. 1654 * @band_center_320: Center frequency of 320MHZ channel. 1655 * @chan_list: Pointer to struct reg_channel_list to be filled (Output param). 1656 * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup. 1657 * @treat_nol_chan_as_disabled: bool to treat nol channel as enabled or 1658 * disabled. If set to true, nol chan is considered as disabled in chan search. 1659 * 1660 * Return: None 1661 */ 1662 void wlan_reg_fill_channel_list_for_pwrmode( 1663 struct wlan_objmgr_pdev *pdev, 1664 qdf_freq_t freq, 1665 qdf_freq_t sec_ch_2g_freq, 1666 enum phy_ch_width ch_width, 1667 qdf_freq_t band_center_320, 1668 struct reg_channel_list *chan_list, 1669 enum supported_6g_pwr_types in_6g_pwr_type, 1670 bool treat_nol_chan_as_disabled); 1671 #endif 1672 #else 1673 static inline 1674 QDF_STATUS wlan_reg_extract_puncture_by_bw(enum phy_ch_width ori_bw, 1675 uint16_t ori_puncture_bitmap, 1676 qdf_freq_t freq, 1677 enum phy_ch_width new_bw, 1678 uint16_t *new_puncture_bitmap) 1679 { 1680 return QDF_STATUS_SUCCESS; 1681 } 1682 1683 static inline void wlan_reg_set_create_punc_bitmap(struct ch_params *ch_params, 1684 bool is_create_punc_bitmap) 1685 { 1686 } 1687 1688 static inline 1689 uint16_t wlan_reg_find_nearest_puncture_pattern(enum phy_ch_width bw, 1690 uint16_t proposed_bitmap) 1691 { 1692 return 0; 1693 } 1694 #endif 1695 1696 #ifdef CONFIG_REG_6G_PWRMODE 1697 /** 1698 * wlan_reg_set_channel_params_for_pwrmode() - Sets channel parameteres for 1699 * given bandwidth 1700 * @pdev: The physical dev to program country code or regdomain 1701 * @freq: channel center frequency. 1702 * @sec_ch_2g_freq: Secondary channel center frequency. 1703 * @ch_params: pointer to the channel parameters. 1704 * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup. 1705 * 1706 * Return: None 1707 */ 1708 void wlan_reg_set_channel_params_for_pwrmode(struct wlan_objmgr_pdev *pdev, 1709 qdf_freq_t freq, 1710 qdf_freq_t sec_ch_2g_freq, 1711 struct ch_params *ch_params, 1712 enum supported_6g_pwr_types 1713 in_6g_pwr_mode); 1714 #endif 1715 1716 /** 1717 * wlan_reg_get_channel_cfreq_reg_power_for_freq() - Provide the channel 1718 * regulatory power 1719 * @freq: channel center frequency 1720 * 1721 * Return: int 1722 */ 1723 uint8_t wlan_reg_get_channel_reg_power_for_freq(struct wlan_objmgr_pdev *pdev, 1724 qdf_freq_t freq); 1725 1726 /** 1727 * wlan_reg_get_bonded_chan_entry() - Fetch the bonded channel pointer given a 1728 * frequency and channel width. 1729 * @freq: Input frequency in MHz. 1730 * @chwidth: Input channel width of enum phy_ch_width. 1731 * @cen320_freq: 320 MHz center frequency in MHz. In 6GHz band 320 MHz channel 1732 * are overlapping. The exact band should be therefore identified 1733 * by the center frequency of the 320 Mhz channel. 1734 * 1735 * Return: A valid bonded channel pointer if found, else NULL. 1736 */ 1737 const struct bonded_channel_freq * 1738 wlan_reg_get_bonded_chan_entry(qdf_freq_t freq, enum phy_ch_width chwidth, 1739 qdf_freq_t cen320_freq); 1740 1741 /** 1742 * wlan_reg_update_nol_ch_for_freq () - set nol channel 1743 * @pdev: pdev ptr 1744 * @chan_freq_list: channel list to be returned 1745 * @num_ch: number of channels 1746 * @nol_ch: nol flag 1747 * 1748 * Return: void 1749 */ 1750 void wlan_reg_update_nol_ch_for_freq(struct wlan_objmgr_pdev *pdev, 1751 uint16_t *chan_freq_list, 1752 uint8_t num_ch, 1753 bool nol_ch); 1754 1755 /** 1756 * wlan_reg_is_dfs_freq() - Checks the channel state for DFS 1757 * @freq: Channel center frequency 1758 * 1759 * Return: true or false 1760 */ 1761 bool wlan_reg_is_dfs_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); 1762 1763 /** 1764 * wlan_reg_is_dsrc_freq() - Checks if the channel is dsrc channel or not 1765 * @freq: Channel center frequency 1766 * 1767 * Return: true or false 1768 */ 1769 bool wlan_reg_is_dsrc_freq(qdf_freq_t freq); 1770 1771 /** 1772 * wlan_reg_is_passive_or_disable_for_pwrmode() - Checks chan state for passive 1773 * and disabled 1774 * @pdev: pdev ptr 1775 * @freq: Channel center frequency 1776 * @in_6g_pwr_mode: Input 6GHz power mode 1777 * 1778 * Return: true or false 1779 */ 1780 bool wlan_reg_is_passive_or_disable_for_pwrmode( 1781 struct wlan_objmgr_pdev *pdev, 1782 qdf_freq_t freq, 1783 enum supported_6g_pwr_types in_6g_pwr_mode); 1784 1785 #ifdef CONFIG_REG_6G_PWRMODE 1786 /** 1787 * wlan_reg_is_disable_for_pwrmode() - Checks chan state for disabled 1788 * @pdev: pdev ptr 1789 * @freq: Channel center frequency 1790 * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup. 1791 * 1792 * Return: true or false 1793 */ 1794 bool wlan_reg_is_disable_for_pwrmode( 1795 struct wlan_objmgr_pdev *pdev, 1796 qdf_freq_t freq, 1797 enum supported_6g_pwr_types in_6g_pwr_mode); 1798 #endif 1799 1800 #ifdef CONFIG_REG_CLIENT 1801 /** 1802 * wlan_reg_is_disable_in_secondary_list_for_freq() - Checks in the secondary 1803 * channel list to see if chan state is disabled 1804 * @pdev: pdev ptr 1805 * @freq: Channel center frequency 1806 * 1807 * Return: true or false 1808 */ 1809 bool wlan_reg_is_disable_in_secondary_list_for_freq( 1810 struct wlan_objmgr_pdev *pdev, 1811 qdf_freq_t freq); 1812 1813 /** 1814 * wlan_reg_is_enable_in_secondary_list_for_freq() - Checks in the secondary 1815 * channel list to see if chan state is enabled 1816 * @pdev: pdev ptr 1817 * @freq: Channel center frequency 1818 * 1819 * Return: true or false 1820 */ 1821 bool wlan_reg_is_enable_in_secondary_list_for_freq( 1822 struct wlan_objmgr_pdev *pdev, 1823 qdf_freq_t freq); 1824 1825 /** 1826 * wlan_reg_is_dfs_in_secondary_list_for_freq() - hecks the channel state for 1827 * DFS from the secondary channel list 1828 * @pdev: pdev ptr 1829 * @freq: Channel center frequency 1830 * 1831 * Return: true or false 1832 */ 1833 bool wlan_reg_is_dfs_in_secondary_list_for_freq(struct wlan_objmgr_pdev *pdev, 1834 qdf_freq_t freq); 1835 1836 /** 1837 * wlan_reg_get_chan_pwr_attr_from_secondary_list_for_freq() - get channel 1838 * power attributions from secondary channel list 1839 * @pdev: pdev ptr 1840 * @freq: channel center frequency 1841 * @is_psd: pointer to retrieve value whether channel power is psd 1842 * @tx_power: pointer to retrieve value of channel eirp tx power 1843 * @psd_eirp: pointer to retrieve value of channel psd eirp power 1844 * @flags: pointer to retrieve value of channel flags 1845 * 1846 * Return: QDF STATUS 1847 */ 1848 QDF_STATUS 1849 wlan_reg_get_chan_pwr_attr_from_secondary_list_for_freq( 1850 struct wlan_objmgr_pdev *pdev, qdf_freq_t freq, 1851 bool *is_psd, uint16_t *tx_power, 1852 uint16_t *psd_eirp, uint32_t *flags); 1853 1854 /** 1855 * wlan_reg_decide_6ghz_power_within_bw_for_freq() - decide minimum tx power in 1856 * bandwidth and 6 GHz power type 1857 * @pdev: pdev ptr 1858 * @freq: channel center frequency 1859 * @bw: channel bandwidth 1860 * @is_psd: pointer to retrieve value whether channel power is psd 1861 * @min_tx_power: pointer to retrieve minimum tx power in bandwidth 1862 * @min_psd_eirp: pointer to retrieve minimum psd eirp in bandwidth 1863 * @power_type: pointer to retrieve 6 GHz power type 1864 * 1865 * Return: QDF STATUS 1866 */ 1867 QDF_STATUS 1868 wlan_reg_decide_6ghz_power_within_bw_for_freq(struct wlan_objmgr_pdev *pdev, 1869 qdf_freq_t freq, 1870 enum phy_ch_width bw, 1871 bool *is_psd, 1872 uint16_t *min_tx_power, 1873 int16_t *min_psd_eirp, 1874 enum reg_6g_ap_type *power_type); 1875 #endif 1876 1877 /** 1878 * wlan_reg_is_passive_for_freq() - Check the channel flags to see if the 1879 * passive flag is set 1880 * @pdev: pdev ptr 1881 * @freq: Channel center frequency 1882 * 1883 * Return: true or false 1884 */ 1885 bool wlan_reg_is_passive_for_freq(struct wlan_objmgr_pdev *pdev, 1886 qdf_freq_t freq); 1887 1888 /** 1889 * wlan_reg_freq_to_band() - Get band from channel number 1890 * @freq:Channel frequency in MHz 1891 * 1892 * Return: wifi band 1893 */ 1894 enum reg_wifi_band wlan_reg_freq_to_band(qdf_freq_t freq); 1895 1896 /** 1897 * wlan_reg_min_chan_freq() - Minimum channel frequency supported 1898 * 1899 * Return: frequency 1900 */ 1901 qdf_freq_t wlan_reg_min_chan_freq(void); 1902 1903 /** 1904 * wlan_reg_max_chan_freq() - Return max. frequency 1905 * 1906 * Return: frequency 1907 */ 1908 qdf_freq_t wlan_reg_max_chan_freq(void); 1909 1910 /** 1911 * wlan_reg_freq_width_to_chan_op_class() -Get op class from freq 1912 * @pdev: pdev ptr 1913 * @freq: channel frequency 1914 * @chan_width: channel width 1915 * @global_tbl_lookup: whether to look up global table 1916 * @behav_limit: behavior limit 1917 * @op_class: operating class 1918 * @chan_num: channel number 1919 * 1920 * Return: void 1921 */ 1922 void wlan_reg_freq_width_to_chan_op_class(struct wlan_objmgr_pdev *pdev, 1923 qdf_freq_t freq, 1924 uint16_t chan_width, 1925 bool global_tbl_lookup, 1926 uint16_t behav_limit, 1927 uint8_t *op_class, 1928 uint8_t *chan_num); 1929 1930 /** 1931 * wlan_reg_freq_width_to_chan_op_class_auto() - convert frequency to 1932 * operating class,channel 1933 * @pdev: pdev pointer 1934 * @freq: channel frequency in mhz 1935 * @chan_width: channel width 1936 * @global_tbl_lookup: whether to lookup global op class tbl 1937 * @behav_limit: behavior limit 1938 * @op_class: operating class 1939 * @chan_num: channel number 1940 * 1941 * Return: Void. 1942 */ 1943 void wlan_reg_freq_width_to_chan_op_class_auto(struct wlan_objmgr_pdev *pdev, 1944 qdf_freq_t freq, 1945 uint16_t chan_width, 1946 bool global_tbl_lookup, 1947 uint16_t behav_limit, 1948 uint8_t *op_class, 1949 uint8_t *chan_num); 1950 1951 /** 1952 * wlan_reg_freq_to_chan_and_op_class() - Converts freq to oper class 1953 * @pdev: pdev ptr 1954 * @freq: channel frequency 1955 * @global_tbl_lookup: whether to look up global table 1956 * @behav_limit: behavior limit 1957 * @op_class: operating class 1958 * @chan_num: channel number 1959 * 1960 * Return: void 1961 */ 1962 void wlan_reg_freq_to_chan_op_class(struct wlan_objmgr_pdev *pdev, 1963 qdf_freq_t freq, 1964 bool global_tbl_lookup, 1965 uint16_t behav_limit, 1966 uint8_t *op_class, 1967 uint8_t *chan_num); 1968 1969 /** 1970 * wlan_reg_is_freq_in_country_opclass() - checks frequency in (ctry, op class) 1971 * pair 1972 * @pdev: pdev ptr 1973 * @country: country information 1974 * @op_class: operating class 1975 * @chan_freq: channel frequency 1976 * 1977 * Return: bool 1978 */ 1979 bool wlan_reg_is_freq_in_country_opclass(struct wlan_objmgr_pdev *pdev, 1980 const uint8_t country[3], 1981 uint8_t op_class, 1982 qdf_freq_t chan_freq); 1983 /** 1984 * wlan_reg_get_5g_bonded_channel_and_state_for_freq()- Return the channel 1985 * state for a 5G or 6G channel frequency based on the channel width and 1986 * bonded channel. 1987 * @pdev: Pointer to pdev. 1988 * @freq: Channel center frequency. 1989 * @bw Channel Width. 1990 * @bonded_chan_ptr_ptr: Pointer to bonded_channel_freq. 1991 * 1992 * Return: Channel State 1993 */ 1994 enum channel_state 1995 wlan_reg_get_5g_bonded_channel_and_state_for_freq(struct wlan_objmgr_pdev *pdev, 1996 uint16_t freq, 1997 enum phy_ch_width bw, 1998 const 1999 struct bonded_channel_freq 2000 **bonded_chan_ptr_ptr); 2001 2002 #ifdef CONFIG_REG_6G_PWRMODE 2003 /** 2004 * wlan_reg_get_5g_bonded_channel_and_state_for_pwrmode()- Return the channel 2005 * state for a 5G or 6G channel frequency based on the channel width and 2006 * bonded channel. 2007 * @pdev: Pointer to pdev. 2008 * @freq: Channel center frequency. 2009 * @bw Channel Width. 2010 * @bonded_chan_ptr_ptr: Pointer to bonded_channel_freq. 2011 * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup. 2012 * @input_puncture_bitmap: Input puncture bitmap 2013 * 2014 * Return: Channel State 2015 */ 2016 enum channel_state 2017 wlan_reg_get_5g_bonded_channel_and_state_for_pwrmode( 2018 struct wlan_objmgr_pdev *pdev, 2019 uint16_t freq, 2020 enum phy_ch_width bw, 2021 const 2022 struct bonded_channel_freq 2023 **bonded_chan_ptr_ptr, 2024 enum supported_6g_pwr_types 2025 in_6g_pwr_mode, 2026 uint16_t input_puncture_bitmap); 2027 #endif 2028 #endif /*CONFIG_CHAN_FREQ_API */ 2029 2030 /** 2031 * wlan_reg_get_op_class_width() - Get operating class chan width 2032 * @pdev: pdev ptr 2033 * @freq: channel frequency 2034 * @global_tbl_lookup: whether to look up global table 2035 * @op_class: operating class 2036 * @chan_num: channel number 2037 * 2038 * Return: channel width of op class 2039 */ 2040 uint16_t wlan_reg_get_op_class_width(struct wlan_objmgr_pdev *pdev, 2041 uint8_t op_class, 2042 bool global_tbl_lookup); 2043 2044 /** 2045 * wlan_reg_is_5ghz_op_class() - Check if the input opclass is a 5GHz opclass. 2046 * @country: Country code. 2047 * @op_class: Operating class. 2048 * 2049 * Return: Return true if input the opclass is a 5GHz opclass, 2050 * else return false. 2051 */ 2052 bool wlan_reg_is_5ghz_op_class(const uint8_t *country, uint8_t op_class); 2053 2054 /** 2055 * wlan_reg_is_2ghz_op_class() - Check if the input opclass is a 2.4GHz opclass. 2056 * @country: Country code. 2057 * @op_class: Operating class. 2058 * 2059 * Return: Return true if input the opclass is a 2.4GHz opclass, 2060 * else return false. 2061 */ 2062 bool wlan_reg_is_2ghz_op_class(const uint8_t *country, uint8_t op_class); 2063 2064 /** 2065 * wlan_reg_is_6ghz_op_class() - Whether 6ghz oper class 2066 * @pdev: pdev ptr 2067 * @op_class: operating class 2068 * 2069 * Return: bool 2070 */ 2071 bool wlan_reg_is_6ghz_op_class(struct wlan_objmgr_pdev *pdev, 2072 uint8_t op_class); 2073 2074 #ifdef CONFIG_REG_CLIENT 2075 /** 2076 * wlan_reg_is_6ghz_supported() - Whether 6ghz is supported 2077 * @psoc: psoc ptr 2078 * 2079 * Return: bool 2080 */ 2081 bool wlan_reg_is_6ghz_supported(struct wlan_objmgr_psoc *psoc); 2082 #endif 2083 2084 #ifdef HOST_OPCLASS_EXT 2085 /** 2086 * wlan_reg_country_chan_opclass_to_freq() - Convert channel number to 2087 * frequency based on country code and op class 2088 * @pdev: pdev object. 2089 * @country: country code. 2090 * @chan: IEEE Channel Number. 2091 * @op_class: Opclass. 2092 * @strict: flag to find channel from matched operating class code. 2093 * 2094 * Look up (channel, operating class) pair in country operating class tables 2095 * and return the channel frequency. 2096 * If not found and "strict" flag is false, try to get frequency (Mhz) by 2097 * channel number only. 2098 * 2099 * Return: Channel center frequency else return 0. 2100 */ 2101 qdf_freq_t 2102 wlan_reg_country_chan_opclass_to_freq(struct wlan_objmgr_pdev *pdev, 2103 const uint8_t country[3], 2104 uint8_t chan, uint8_t op_class, 2105 bool strict); 2106 #endif 2107 2108 /** 2109 * reg_chan_opclass_to_freq() - Convert channel number and opclass to frequency 2110 * @chan: IEEE Channel Number. 2111 * @op_class: Opclass. 2112 * @global_tbl_lookup: Global table lookup. 2113 * 2114 * Return: Channel center frequency else return 0. 2115 */ 2116 uint16_t wlan_reg_chan_opclass_to_freq(uint8_t chan, 2117 uint8_t op_class, 2118 bool global_tbl_lookup); 2119 2120 /** 2121 * wlan_reg_chan_opclass_to_freq_auto() - Convert channel number and opclass to 2122 * frequency 2123 * @chan: IEEE channel number 2124 * @op_class: Operating class of channel 2125 * @global_tbl_lookup: Flag to determine if global table has to be looked up 2126 * 2127 * Return: Channel center frequency if valid, else zero 2128 */ 2129 2130 qdf_freq_t wlan_reg_chan_opclass_to_freq_auto(uint8_t chan, uint8_t op_class, 2131 bool global_tbl_lookup); 2132 2133 #ifdef CHECK_REG_PHYMODE 2134 /** 2135 * wlan_reg_get_max_phymode() - Find the best possible phymode given a 2136 * phymode, a frequency, and per-country regulations 2137 * @pdev: pdev pointer 2138 * @phy_in: phymode that the user requested 2139 * @freq: current operating center frequency 2140 * 2141 * Return: maximum phymode allowed in current country that is <= phy_in 2142 */ 2143 enum reg_phymode wlan_reg_get_max_phymode(struct wlan_objmgr_pdev *pdev, 2144 enum reg_phymode phy_in, 2145 qdf_freq_t freq); 2146 #else 2147 static inline enum reg_phymode 2148 wlan_reg_get_max_phymode(struct wlan_objmgr_pdev *pdev, 2149 enum reg_phymode phy_in, 2150 qdf_freq_t freq) 2151 { 2152 return REG_PHYMODE_INVALID; 2153 } 2154 #endif /* CHECK_REG_PHYMODE */ 2155 2156 #ifdef CONFIG_REG_CLIENT 2157 /** 2158 * wlan_reg_band_bitmap_to_band_info() - Convert the band_bitmap to a 2159 * band_info enum 2160 * @band_bitmap: bitmap on top of reg_wifi_band of bands enabled 2161 * 2162 * Return: BAND_ALL if both 2G and 5G band is enabled 2163 * BAND_2G if 2G is enabled but 5G isn't 2164 * BAND_5G if 5G is enabled but 2G isn't 2165 */ 2166 enum band_info wlan_reg_band_bitmap_to_band_info(uint32_t band_bitmap); 2167 2168 /** 2169 * wlan_reg_update_tx_power_on_ctry_change() - Update tx power during 2170 * country code change (without channel change) OR if fcc constraint is set 2171 * @pdev: Pointer to pdev 2172 * @vdev_id: vdev ID 2173 * 2174 * Return: QDF_STATUS 2175 */ 2176 QDF_STATUS 2177 wlan_reg_update_tx_power_on_ctry_change(struct wlan_objmgr_pdev *pdev, 2178 uint8_t vdev_id); 2179 #endif 2180 2181 #if defined(CONFIG_BAND_6GHZ) 2182 /** 2183 * wlan_reg_get_cur_6g_ap_pwr_type() - Get the current 6G regulatory AP power 2184 * type. 2185 * @pdev: Pointer to PDEV object. 2186 * @reg_cur_6g_ap_pwr_type: The current regulatory 6G AP power type ie. 2187 * LPI/SP/VLP. 2188 * 2189 * Return: QDF_STATUS. 2190 */ 2191 QDF_STATUS 2192 wlan_reg_get_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev, 2193 enum reg_6g_ap_type *reg_cur_6g_ap_pwr_type); 2194 2195 /** 2196 * wlan_reg_get_cur_6g_client_type() - Get the current 6G regulatory client 2197 * type. 2198 * @pdev: Pointer to PDEV object. 2199 * @reg_cur_6g_client_mobility_type: The current regulatory 6G client type ie. 2200 * default/subordinate. 2201 * 2202 * Return: QDF_STATUS. 2203 */ 2204 QDF_STATUS 2205 wlan_reg_get_cur_6g_client_type(struct wlan_objmgr_pdev *pdev, 2206 enum reg_6g_client_type 2207 *reg_cur_6g_client_mobility_type); 2208 /** 2209 * wlan_reg_get_rnr_tpe_usable() - Tells if RNR IE is applicable for current 2210 * domain. 2211 * @pdev: Pointer to PDEV object. 2212 * @reg_rnr_tpe_usable: Pointer to hold the bool value, true if RNR IE is 2213 * applicable, else false. 2214 * 2215 * Return: QDF_STATUS. 2216 */ 2217 QDF_STATUS wlan_reg_get_rnr_tpe_usable(struct wlan_objmgr_pdev *pdev, 2218 bool *reg_rnr_tpe_usable); 2219 2220 /** 2221 * wlan_reg_get_unspecified_ap_usable() - Tells if AP type unspecified by 802.11 2222 * can be used or not. 2223 * @pdev: Pointer to PDEV object. 2224 * @reg_unspecified_ap_usable: Pointer to hold the bool value, true if 2225 * unspecified AP types can be used in the IE, else false. 2226 * 2227 * Return: QDF_STATUS. 2228 */ 2229 QDF_STATUS wlan_reg_get_unspecified_ap_usable(struct wlan_objmgr_pdev *pdev, 2230 bool *reg_unspecified_ap_usable); 2231 2232 /** 2233 * wlan_reg_is_6g_psd_power() - Checks if given freq is PSD power 2234 * 2235 * @pdev: pdev ptr 2236 * @freq: channel frequency 2237 * 2238 * Return: true if channel is PSD power or false otherwise 2239 */ 2240 bool wlan_reg_is_6g_psd_power(struct wlan_objmgr_pdev *pdev); 2241 2242 /** 2243 * wlan_reg_get_6g_chan_ap_power() - Finds the AP TX power for the given channel 2244 * frequency 2245 * 2246 * @pdev: pdev ptr 2247 * @chan_freq: channel frequency 2248 * @is_psd: is channel PSD or not 2249 * @tx_power: transmit power to fill for chan_freq 2250 * @eirp_psd_power: EIRP power, will only be filled if is_psd is true 2251 * 2252 * Return: QDF_STATUS 2253 */ 2254 QDF_STATUS wlan_reg_get_6g_chan_ap_power(struct wlan_objmgr_pdev *pdev, 2255 qdf_freq_t chan_freq, bool *is_psd, 2256 uint16_t *tx_power, 2257 uint16_t *eirp_psd_power); 2258 2259 /** 2260 * wlan_reg_get_client_power_for_connecting_ap() - Find the channel information 2261 * when device is operating as a client 2262 * 2263 * @pdev: pdev ptr 2264 * @ap_type: type of AP that device is connected to 2265 * @chan_freq: channel frequency 2266 * @is_psd: is channel PSD or not 2267 * @tx_power: transmit power to fill for chan_freq 2268 * @eirp_psd_power: EIRP power, will only be filled if is_psd is true 2269 * 2270 * This function is meant to be called to find the channel frequency power 2271 * information for a client when the device is operating as a client. It will 2272 * fill in the parameters tx_power and eirp_psd_power. eirp_psd_power will 2273 * only be filled if the channel is PSD. 2274 * 2275 * Return: QDF_STATUS 2276 */ 2277 QDF_STATUS 2278 wlan_reg_get_client_power_for_connecting_ap(struct wlan_objmgr_pdev *pdev, 2279 enum reg_6g_ap_type ap_type, 2280 qdf_freq_t chan_freq, 2281 bool is_psd, uint16_t *tx_power, 2282 uint16_t *eirp_psd_power); 2283 2284 /** 2285 * wlan_reg_get_client_power_for_6ghz_ap() - Find the channel information when 2286 * device is operating as a 6GHz AP 2287 * 2288 * @pdev: pdev ptr 2289 * @client_type: type of client that is connected to our AP 2290 * @chan_freq: channel frequency 2291 * @is_psd: is channel PSD or not 2292 * @tx_power: transmit power to fill for chan_freq 2293 * @eirp_psd_power: EIRP power, will only be filled if is_psd is true 2294 * 2295 * This function is meant to be called to find the channel frequency power 2296 * information for a client when the device is operating as an AP. It will fill 2297 * in the parameter is_psd, tx_power, and eirp_psd_power. eirp_psd_power will 2298 * only be filled if the channel is PSD. 2299 * 2300 * Return: QDF_STATUS 2301 */ 2302 QDF_STATUS 2303 wlan_reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev *pdev, 2304 enum reg_6g_client_type client_type, 2305 qdf_freq_t chan_freq, 2306 bool *is_psd, uint16_t *tx_power, 2307 uint16_t *eirp_psd_power); 2308 2309 /** 2310 * wlan_reg_decide_6g_ap_pwr_type() - Decide which power mode AP should operate 2311 * in 2312 * 2313 * @pdev: pdev ptr 2314 * 2315 * Return: AP power type 2316 */ 2317 enum reg_6g_ap_type 2318 wlan_reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev); 2319 2320 /** 2321 * wlan_reg_set_ap_pwr_and_update_chan_list() - Set the AP power mode and 2322 * recompute the current channel list 2323 * 2324 * @pdev: pdev ptr 2325 * @ap_pwr_type: the AP power type to update to 2326 * 2327 * Return: QDF_STATUS 2328 */ 2329 QDF_STATUS 2330 wlan_reg_set_ap_pwr_and_update_chan_list(struct wlan_objmgr_pdev *pdev, 2331 enum reg_6g_ap_type ap_pwr_type); 2332 2333 /** 2334 * wlan_reg_get_best_6g_pwr_type() - Returns the best 6g power type supported 2335 * for a given frequency. 2336 * @pdev: pdev pointer 2337 * @freq: input frequency. 2338 * 2339 * Return: supported_6g_pwr_types enum. 2340 */ 2341 enum supported_6g_pwr_types 2342 wlan_reg_get_best_6g_pwr_type(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); 2343 2344 /** 2345 * wlan_reg_conv_6g_ap_type_to_supported_6g_pwr_types() - Converts the 6G AP 2346 * power type to 6g supported power type enum. 2347 * @ap_pwr_type: input 6G AP power type. 2348 * 2349 * Return: supported_6g_pwr_types enum. 2350 */ 2351 enum supported_6g_pwr_types 2352 wlan_reg_conv_6g_ap_type_to_supported_6g_pwr_types(enum reg_6g_ap_type 2353 ap_pwr_type); 2354 2355 /** 2356 * wlan_reg_conv_supported_6g_pwr_type_to_ap_pwr_type() - The supported 6G power 2357 * type is a combination of AP and client power types. This API return the 6G AP 2358 * power type portion of the supported 6G power type. 2359 * @in_6g_pwr_type: input 6G supported power type. 2360 * 2361 * Return: 6G AP power type. 2362 */ 2363 enum reg_6g_ap_type 2364 wlan_reg_conv_supported_6g_pwr_type_to_ap_pwr_type(enum supported_6g_pwr_types 2365 in_6g_pwr_type); 2366 #else /* !CONFIG_BAND_6GHZ */ 2367 static inline QDF_STATUS 2368 wlan_reg_get_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev, 2369 enum reg_6g_ap_type *reg_cur_6g_ap_pwr_type) 2370 { 2371 *reg_cur_6g_ap_pwr_type = REG_CURRENT_MAX_AP_TYPE; 2372 return QDF_STATUS_E_NOSUPPORT; 2373 } 2374 2375 static inline QDF_STATUS 2376 wlan_reg_get_cur_6g_client_type(struct wlan_objmgr_pdev *pdev, 2377 enum reg_6g_client_type 2378 *reg_cur_6g_client_mobility_type) 2379 { 2380 *reg_cur_6g_client_mobility_type = REG_SUBORDINATE_CLIENT; 2381 return QDF_STATUS_E_NOSUPPORT; 2382 } 2383 2384 static inline 2385 QDF_STATUS wlan_reg_get_rnr_tpe_usable(struct wlan_objmgr_pdev *pdev, 2386 bool *reg_rnr_tpe_usable) 2387 { 2388 *reg_rnr_tpe_usable = false; 2389 return QDF_STATUS_E_NOSUPPORT; 2390 } 2391 2392 static inline 2393 QDF_STATUS wlan_reg_get_unspecified_ap_usable(struct wlan_objmgr_pdev *pdev, 2394 bool *reg_unspecified_ap_usable) 2395 { 2396 *reg_unspecified_ap_usable = false; 2397 return QDF_STATUS_E_NOSUPPORT; 2398 } 2399 2400 static inline 2401 bool wlan_reg_is_6g_psd_power(struct wlan_objmgr_pdev *pdev) 2402 { 2403 return false; 2404 } 2405 2406 static inline 2407 QDF_STATUS wlan_reg_get_6g_chan_ap_power(struct wlan_objmgr_pdev *pdev, 2408 qdf_freq_t chan_freq, bool *is_psd, 2409 uint16_t *tx_power, 2410 uint16_t *eirp_psd_power) 2411 { 2412 *is_psd = false; 2413 *tx_power = 0; 2414 *eirp_psd_power = 0; 2415 return QDF_STATUS_E_NOSUPPORT; 2416 } 2417 2418 static inline QDF_STATUS 2419 wlan_reg_get_client_power_for_connecting_ap(struct wlan_objmgr_pdev *pdev, 2420 enum reg_6g_ap_type ap_type, 2421 qdf_freq_t chan_freq, 2422 bool is_psd, uint16_t *tx_power, 2423 uint16_t *eirp_psd_power) 2424 { 2425 *tx_power = 0; 2426 *eirp_psd_power = 0; 2427 return QDF_STATUS_E_NOSUPPORT; 2428 } 2429 2430 static inline QDF_STATUS 2431 wlan_reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev *pdev, 2432 enum reg_6g_client_type client_type, 2433 qdf_freq_t chan_freq, 2434 bool *is_psd, uint16_t *tx_power, 2435 uint16_t *eirp_psd_power) 2436 { 2437 *is_psd = false; 2438 *tx_power = 0; 2439 *eirp_psd_power = 0; 2440 return QDF_STATUS_E_NOSUPPORT; 2441 } 2442 2443 static inline enum reg_6g_ap_type 2444 wlan_reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev) 2445 { 2446 return REG_INDOOR_AP; 2447 } 2448 2449 static inline QDF_STATUS 2450 wlan_reg_set_ap_pwr_and_update_chan_list(struct wlan_objmgr_pdev *pdev, 2451 enum reg_6g_ap_type ap_pwr_type) 2452 { 2453 return QDF_STATUS_E_NOSUPPORT; 2454 } 2455 2456 static inline enum supported_6g_pwr_types 2457 wlan_reg_get_best_6g_pwr_type(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) 2458 { 2459 return REG_INVALID_PWR_MODE; 2460 } 2461 2462 static inline enum supported_6g_pwr_types 2463 wlan_reg_conv_6g_ap_type_to_supported_6g_pwr_types(enum reg_6g_ap_type 2464 ap_pwr_type) 2465 { 2466 return REG_INVALID_PWR_MODE; 2467 } 2468 2469 static inline enum reg_6g_ap_type 2470 wlan_reg_conv_supported_6g_pwr_type_to_ap_pwr_type(enum supported_6g_pwr_types 2471 in_6g_pwr_type) 2472 { 2473 return REG_MAX_AP_TYPE; 2474 } 2475 #endif /* CONFIG_BAND_6GHZ */ 2476 2477 /** 2478 * wlan_reg_is_ext_tpc_supported() - Checks if FW supports new WMI cmd for TPC 2479 * 2480 * @psoc: psoc ptr 2481 * 2482 * Return: true if FW supports new command or false otherwise 2483 */ 2484 bool wlan_reg_is_ext_tpc_supported(struct wlan_objmgr_psoc *psoc); 2485 2486 /** 2487 * wlan_reg_is_chwidth_supported() - Check if given channel width is supported 2488 * on a given pdev 2489 * @pdev: pdev pointer 2490 * @ch_width: channel width. 2491 * @is_supported: whether the channel width is supported 2492 * 2493 * Return QDF_STATUS_SUCCESS of operation 2494 */ 2495 QDF_STATUS wlan_reg_is_chwidth_supported(struct wlan_objmgr_pdev *pdev, 2496 enum phy_ch_width ch_width, 2497 bool *is_supported); 2498 2499 #ifdef CONFIG_BAND_6GHZ 2500 /** 2501 * wlan_reg_get_thresh_priority_freq() - Get the prioritized frequency value 2502 * @pdev: pdev pointer 2503 */ 2504 qdf_freq_t wlan_reg_get_thresh_priority_freq(struct wlan_objmgr_pdev *pdev); 2505 2506 /** 2507 * wlan_reg_psd_2_eirp() - Calculate EIRP from PSD and bandwidth 2508 * channel list 2509 * @pdev: pdev pointer 2510 * @psd: Power Spectral Density in dBm/MHz 2511 * @ch_bw: Bandwidth of a channel in MHz (20/40/80/160/320 etc) 2512 * @eirp: EIRP power in dBm 2513 * 2514 * Return: QDF_STATUS 2515 */ 2516 QDF_STATUS wlan_reg_psd_2_eirp(struct wlan_objmgr_pdev *pdev, 2517 int16_t psd, 2518 uint16_t ch_bw, 2519 int16_t *eirp); 2520 2521 /** 2522 * wlan_reg_eirp_2_psd() - Calculate PSD poewr from EIRP and bandwidth 2523 * @pdev: pdev pointer 2524 * @ch_bw: Bandwidth of a channel in MHz (20/40/80/160/320 etc) 2525 * @eirp: EIRP power in dBm 2526 * @psd: Power Spectral Density in dBm/MHz 2527 * 2528 * Return: QDF_STATUS 2529 */ 2530 QDF_STATUS wlan_reg_eirp_2_psd(struct wlan_objmgr_pdev *pdev, 2531 uint16_t ch_bw, 2532 int16_t eirp, 2533 int16_t *psd); 2534 2535 /** 2536 * wlan_reg_get_best_pwr_mode() - Get the best power mode based on input freq 2537 * and bandwidth. The mode that provides the best EIRP is the best power mode. 2538 * @pdev: Pointer to pdev 2539 * @freq: Frequency in MHz 2540 * @cen320: 320 MHz band center frequency. For other BW, this param is 2541 * ignored while processing 2542 * @bw: Bandwidth in MHz 2543 * @in_punc_pattern: input puncture pattern 2544 * 2545 * Return: Best power mode 2546 */ 2547 enum reg_6g_ap_type 2548 wlan_reg_get_best_pwr_mode(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq, 2549 qdf_freq_t cen320, uint16_t bw, 2550 uint16_t in_punc_pattern); 2551 2552 /** 2553 * wlan_reg_get_eirp_pwr() - Get eirp power based on the AP power mode 2554 * @pdev: Pointer to pdev 2555 * @freq: Frequency in MHz 2556 * @cen320: 320 MHz Band center frequency 2557 * @bw: Bandwidth in MHz 2558 * @ap_pwr_type: AP power type 2559 * @in_punc_pattern: Input puncture pattern 2560 * @is_client_list_lookup_needed: Boolean to indicate if client list lookup is 2561 * needed 2562 * @client_type: Client power type 2563 * 2564 * Return: EIRP power 2565 */ 2566 uint8_t wlan_reg_get_eirp_pwr(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq, 2567 qdf_freq_t cen320, uint16_t bw, 2568 enum reg_6g_ap_type ap_pwr_type, 2569 uint16_t in_punc_pattern, 2570 bool is_client_list_lookup_needed, 2571 enum reg_6g_client_type client_type); 2572 #else 2573 static inline 2574 qdf_freq_t wlan_reg_get_thresh_priority_freq(struct wlan_objmgr_pdev *pdev) 2575 { 2576 return 0; 2577 } 2578 2579 static inline enum reg_6g_ap_type 2580 wlan_reg_get_best_pwr_mode(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq, 2581 qdf_freq_t cen320, 2582 uint16_t bw, 2583 uint16_t in_punc_pattern) 2584 { 2585 return REG_MAX_AP_TYPE; 2586 } 2587 2588 static inline QDF_STATUS wlan_reg_psd_2_eirp(struct wlan_objmgr_pdev *pdev, 2589 int16_t psd, 2590 uint16_t ch_bw, 2591 int16_t *eirp) 2592 { 2593 return QDF_STATUS_E_FAILURE; 2594 } 2595 2596 static inline QDF_STATUS wlan_reg_eirp_2_psd(struct wlan_objmgr_pdev *pdev, 2597 uint16_t ch_bw, 2598 int16_t eirp, 2599 int16_t *psd) 2600 { 2601 return QDF_STATUS_E_FAILURE; 2602 } 2603 2604 static inline uint8_t 2605 wlan_reg_get_eirp_pwr(struct wlan_objmgr_pdev *pdev, 2606 qdf_freq_t freq, 2607 qdf_freq_t cen320, uint16_t bw, 2608 enum reg_6g_ap_type ap_pwr_type, 2609 uint16_t in_punc_pattern, 2610 bool is_client_list_lookup_needed, 2611 enum reg_6g_client_type client_type) 2612 { 2613 return 0; 2614 } 2615 #endif /* CONFIG_BAND_6GHZ */ 2616 /** 2617 * wlan_reg_find_chwidth_from_bw () - Gets channel width for given 2618 * bandwidth 2619 * @bw: Bandwidth 2620 * 2621 * Return: phy_ch_width 2622 */ 2623 enum phy_ch_width wlan_reg_find_chwidth_from_bw(uint16_t bw); 2624 2625 /** 2626 * wlan_reg_get_chan_state_for_320() - Get the channel state of a 320 MHz 2627 * bonded channel. 2628 * @pdev: Pointer to wlan_objmgr_pdev 2629 * @freq: Primary frequency 2630 * @center_320: Band center of 320 MHz 2631 * @ch_width: Channel width 2632 * @bonded_chan_ptr_ptr: Pointer to bonded channel pointer 2633 * @treat_nol_chan_as_disabled: Bool to treat nol chan as enabled/disabled 2634 * @in_pwr_type: Input 6g power type 2635 * @input_puncture_bitmap: Input puncture bitmap 2636 * 2637 * Return: Channel state 2638 */ 2639 #ifdef WLAN_FEATURE_11BE 2640 enum channel_state 2641 wlan_reg_get_chan_state_for_320(struct wlan_objmgr_pdev *pdev, 2642 uint16_t freq, 2643 qdf_freq_t center_320, 2644 enum phy_ch_width ch_width, 2645 const struct bonded_channel_freq 2646 **bonded_chan_ptr_ptr, 2647 enum supported_6g_pwr_types in_6g_pwr_type, 2648 bool treat_nol_chan_as_disabled, 2649 uint16_t input_puncture_bitmap); 2650 #else 2651 static inline enum channel_state 2652 wlan_reg_get_chan_state_for_320(struct wlan_objmgr_pdev *pdev, 2653 uint16_t freq, 2654 qdf_freq_t center_320, 2655 enum phy_ch_width ch_width, 2656 const struct bonded_channel_freq 2657 **bonded_chan_ptr_ptr, 2658 enum supported_6g_pwr_types in_6g_pwr_type, 2659 bool treat_nol_chan_as_disabled, 2660 uint16_t input_puncture_bitmap) 2661 { 2662 return CHANNEL_STATE_INVALID; 2663 } 2664 #endif 2665 2666 #ifdef CONFIG_BAND_6GHZ 2667 /** 2668 * wlan_is_sup_chan_entry_afc_done() - Checks if the super chan entry of given 2669 * channel idx and power mode has REGULATORY_CHAN_AFC_NOT_DONE flag cleared. 2670 * 2671 * @pdev: pdev pointer 2672 * @freq: input channel idx 2673 * @in_6g_pwr_mode: input power mode 2674 * 2675 * Return: True if REGULATORY_CHAN_AFC_NOT_DONE flag is clear for the super 2676 * chan entry. 2677 */ 2678 bool 2679 wlan_is_sup_chan_entry_afc_done(struct wlan_objmgr_pdev *pdev, 2680 enum channel_enum chan_idx, 2681 enum supported_6g_pwr_types in_6g_pwr_mode); 2682 2683 /** 2684 * wlan_reg_display_super_chan_list() - Display super channel list for all modes 2685 * @pdev: Pointer to pdev 2686 * 2687 * Return: QDF_STATUS 2688 */ 2689 QDF_STATUS 2690 wlan_reg_display_super_chan_list(struct wlan_objmgr_pdev *pdev); 2691 2692 #if defined(CONFIG_AFC_SUPPORT) && defined(CONFIG_BAND_6GHZ) 2693 /** 2694 * wlan_reg_get_afc_freq_range_and_psd_limits() - Get freq range and psd 2695 * limits from afc server response. 2696 * 2697 * @pdev: Pointer to pdev 2698 * @num_freq_obj: Number of frequency objects 2699 * @afc_obj: Pointer to struct afc_freq_obj 2700 * 2701 * Return: QDF_STATUS 2702 */ 2703 2704 QDF_STATUS 2705 wlan_reg_get_afc_freq_range_and_psd_limits(struct wlan_objmgr_pdev *pdev, 2706 uint8_t num_freq_obj, 2707 struct afc_freq_obj *afc_obj); 2708 2709 /** 2710 * wlan_reg_get_num_afc_freq_obj() - Get number of afc frequency objects 2711 * 2712 * @pdev: Pointer to pdev 2713 * @num_freq_obj: Number of frequency objects 2714 * 2715 * Return: QDF_STATUS 2716 */ 2717 QDF_STATUS 2718 wlan_reg_get_num_afc_freq_obj(struct wlan_objmgr_pdev *pdev, 2719 uint8_t *num_freq_obj); 2720 #endif 2721 2722 #else 2723 static inline bool 2724 wlan_is_sup_chan_entry_afc_done(struct wlan_objmgr_pdev *pdev, 2725 enum channel_enum chan_idx, 2726 enum supported_6g_pwr_types in_6g_pwr_mode) 2727 { 2728 return false; 2729 } 2730 2731 static inline QDF_STATUS 2732 wlan_reg_display_super_chan_list(struct wlan_objmgr_pdev *pdev) 2733 { 2734 return QDF_STATUS_E_NOSUPPORT; 2735 } 2736 2737 #endif 2738 2739 #endif 2740