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 * 6 * Permission to use, copy, modify, and/or distribute this software for 7 * any purpose with or without fee is hereby granted, provided that the 8 * above copyright notice and this permission notice appear in all 9 * copies. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 12 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 13 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 14 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 15 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 16 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 17 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 18 * PERFORMANCE OF THIS SOFTWARE. 19 */ 20 21 /** 22 * DOC: reg_services.h 23 * This file provides prototypes of the regulatory component 24 * service functions 25 */ 26 27 #ifndef __REG_SERVICES_COMMON_H_ 28 #define __REG_SERVICES_COMMON_H_ 29 30 #ifdef CONFIG_AFC_SUPPORT 31 #include <wlan_reg_afc.h> 32 #endif 33 34 #define IS_VALID_PSOC_REG_OBJ(psoc_priv_obj) (psoc_priv_obj) 35 #define IS_VALID_PDEV_REG_OBJ(pdev_priv_obj) (pdev_priv_obj) 36 #define FREQ_TO_CHAN_SCALE 5 37 /* The distance between the 80Mhz center and the nearest 20Mhz channel */ 38 #define NEAREST_20MHZ_CHAN_FREQ_OFFSET 10 39 #define NUM_20_MHZ_CHAN_IN_40_MHZ_CHAN 2 40 #define NUM_20_MHZ_CHAN_IN_80_MHZ_CHAN 4 41 #define NUM_20_MHZ_CHAN_IN_160_MHZ_CHAN 8 42 #define NUM_20_MHZ_CHAN_IN_320_MHZ_CHAN 16 43 44 #define REG_MAX_5GHZ_CH_NUM channel_map[MAX_5GHZ_CHANNEL].chan_num 45 46 #define REG_MIN_24GHZ_CH_FREQ channel_map[MIN_24GHZ_CHANNEL].center_freq 47 #define REG_MAX_24GHZ_CH_FREQ channel_map[MAX_24GHZ_CHANNEL].center_freq 48 49 #define REG_IS_24GHZ_CH_FREQ(freq) \ 50 (((freq) >= REG_MIN_24GHZ_CH_FREQ) && \ 51 ((freq) <= REG_MAX_24GHZ_CH_FREQ)) 52 53 #ifdef CONFIG_CHAN_FREQ_API 54 #define REG_MIN_5GHZ_CH_FREQ channel_map[MIN_5GHZ_CHANNEL].center_freq 55 #define REG_MAX_5GHZ_CH_FREQ channel_map[MAX_5GHZ_CHANNEL].center_freq 56 #endif /* CONFIG_CHAN_FREQ_API */ 57 58 #ifdef CONFIG_49GHZ_CHAN 59 #define REG_MIN_49GHZ_CH_FREQ channel_map[MIN_49GHZ_CHANNEL].center_freq 60 #define REG_MAX_49GHZ_CH_FREQ channel_map[MAX_49GHZ_CHANNEL].center_freq 61 #else 62 #define REG_MIN_49GHZ_CH_FREQ 0 63 #define REG_MAX_49GHZ_CH_FREQ 0 64 #endif /* CONFIG_49GHZ_CHAN */ 65 66 #define REG_IS_49GHZ_FREQ(freq) \ 67 (((freq) >= REG_MIN_49GHZ_CH_FREQ) && \ 68 ((freq) <= REG_MAX_49GHZ_CH_FREQ)) 69 70 71 #define REG_IS_5GHZ_FREQ(freq) \ 72 (((freq) >= channel_map[MIN_5GHZ_CHANNEL].center_freq) && \ 73 ((freq) <= channel_map[MAX_5GHZ_CHANNEL].center_freq)) 74 75 /* 76 * It should be 2.5 MHz actually but since we are using integer use 2 77 * instead, which does not create any problem in the start edge calculation. 78 */ 79 #define HALF_5MHZ_BW 2 80 #define HALF_20MHZ_BW 10 81 #define HALF_40MHZ_BW 20 82 #define HALF_80MHZ_BW 40 83 #define HALF_160MHZ_BW 80 84 85 #define TWO_GIG_STARTING_EDGE_FREQ (channel_map_global[MIN_24GHZ_CHANNEL]. \ 86 center_freq - HALF_20MHZ_BW) 87 #define TWO_GIG_ENDING_EDGE_FREQ (channel_map_global[MAX_24GHZ_CHANNEL]. \ 88 center_freq + HALF_20MHZ_BW) 89 #ifdef CONFIG_49GHZ_CHAN 90 #define FIVE_GIG_STARTING_EDGE_FREQ (channel_map_global[MIN_49GHZ_CHANNEL]. \ 91 center_freq - HALF_5MHZ_BW) 92 #else 93 #define FIVE_GIG_STARTING_EDGE_FREQ (channel_map_global[MIN_5GHZ_CHANNEL]. \ 94 center_freq - HALF_20MHZ_BW) 95 #endif /* CONFIG_49GHZ_CHAN */ 96 #define FIVE_GIG_ENDING_EDGE_FREQ (channel_map_global[MAX_5GHZ_CHANNEL]. \ 97 center_freq + HALF_20MHZ_BW) 98 99 #ifdef CONFIG_BAND_6GHZ 100 #define SIX_GIG_STARTING_EDGE_FREQ (channel_map_global[MIN_6GHZ_CHANNEL]. \ 101 center_freq - HALF_20MHZ_BW) 102 #define SIX_GIG_ENDING_EDGE_FREQ (channel_map_global[MAX_6GHZ_CHANNEL]. \ 103 center_freq + HALF_20MHZ_BW) 104 #define SIXG_START_FREQ 5950 105 #define FREQ_LEFT_SHIFT 55 106 #define SIX_GHZ_NON_ORPHAN_START_FREQ \ 107 (channel_map_global[MIN_6GHZ_NON_ORPHAN_CHANNEL].center_freq - 5) 108 #define CHAN_FREQ_5935 5935 109 #define NUM_80MHZ_BAND_IN_6G 16 110 #define NUM_PSC_FREQ 15 111 #define PSC_BAND_MHZ (FREQ_TO_CHAN_SCALE * NUM_80MHZ_BAND_IN_6G) 112 #define REG_MIN_6GHZ_CHAN_FREQ channel_map[MIN_6GHZ_CHANNEL].center_freq 113 #define REG_MAX_6GHZ_CHAN_FREQ channel_map[MAX_6GHZ_CHANNEL].center_freq 114 #else 115 #define FREQ_LEFT_SHIFT 0 116 #define SIX_GHZ_NON_ORPHAN_START_FREQ 0 117 #define CHAN_FREQ_5935 0 118 #define NUM_80MHZ_BAND_IN_6G 0 119 #define NUM_PSC_FREQ 0 120 #define PSC_BAND_MHZ (FREQ_TO_CHAN_SCALE * NUM_80MHZ_BAND_IN_6G) 121 #define REG_MIN_6GHZ_CHAN_FREQ 0 122 #define REG_MAX_6GHZ_CHAN_FREQ 0 123 #endif /*CONFIG_BAND_6GHZ*/ 124 125 #define REG_CH_NUM(ch_enum) channel_map[ch_enum].chan_num 126 #define REG_CH_TO_FREQ(ch_enum) channel_map[ch_enum].center_freq 127 128 /* EEPROM setting is a country code */ 129 #define COUNTRY_ERD_FLAG 0x8000 130 #define MIN_6GHZ_OPER_CLASS 131 131 #define MAX_6GHZ_OPER_CLASS 137 132 133 #ifdef CONFIG_AFC_SUPPORT 134 #define DEFAULT_REQ_ID 11235813 135 /* default minimum power in dBm units */ 136 #define DEFAULT_MIN_POWER (-10) 137 #define DEFAULT_NUM_FREQS 1 138 139 /* Have the entire 6Ghz band as single range */ 140 #define DEFAULT_LOW_6GFREQ 5925 141 #define DEFAULT_HIGH_6GFREQ 7125 142 #endif 143 144 #define SIXG_CHAN_2 2 145 #ifdef CONFIG_BAND_6GHZ 146 #define CHAN_ENUM_SIXG_2 CHAN_ENUM_5935 147 #else 148 #define CHAN_ENUM_SIXG_2 INVALID_CHANNEL 149 #endif 150 151 /* The eirp power values are in 0.01dBm units */ 152 #define EIRP_PWR_SCALE 100 153 154 extern const struct chan_map *channel_map; 155 extern const struct chan_map channel_map_us[]; 156 extern const struct chan_map channel_map_eu[]; 157 extern const struct chan_map channel_map_jp[]; 158 extern const struct chan_map channel_map_china[]; 159 extern const struct chan_map channel_map_global[]; 160 161 #ifdef WLAN_FEATURE_11BE 162 /* binary 1:- Punctured 0:- Not-Punctured */ 163 #define ALL_SCHANS_PUNC 0xFFFF /* all subchannels punctured */ 164 #endif 165 166 #define CHAN_FREQ_5660 5660 167 #define CHAN_FREQ_5720 5720 168 169 #define PRIM_SEG_IEEE_CENTER_240MHZ_5G_CHAN 146 170 #define PRIM_SEG_FREQ_CENTER_240MHZ_5G_CHAN 5730 171 172 #ifdef CONFIG_AFC_SUPPORT 173 /** 174 * struct afc_cb_handler - defines structure for afc request received event 175 * handler call back function and argument 176 * @func: handler function pointer 177 * @arg: argument to handler function 178 */ 179 struct afc_cb_handler { 180 afc_req_rx_evt_handler func; 181 void *arg; 182 }; 183 184 /** 185 * struct afc_pow_evt_cb_handler - defines structure for afc power received 186 * event handler call back function and argument 187 * @func: handler function pointer 188 * @arg: argument to handler function 189 */ 190 struct afc_pow_evt_cb_handler { 191 afc_power_tx_evt_handler func; 192 void *arg; 193 }; 194 195 /** 196 * reg_init_freq_range() - Initialize a freq_range object 197 * @left: The left frequency range 198 * @right: The right frequency range 199 * 200 * Return: The initialized freq_range object 201 */ 202 struct freq_range 203 reg_init_freq_range(qdf_freq_t left, qdf_freq_t right); 204 #endif 205 /** 206 * get_next_lower_bandwidth() - Get next lower bandwidth 207 * @ch_width: Channel width 208 * 209 * Return: Channel width 210 */ 211 enum phy_ch_width get_next_lower_bandwidth(enum phy_ch_width ch_width); 212 213 /** 214 * reg_read_default_country() - Get the default regulatory country 215 * @psoc: The physical SoC to get default country from 216 * @country_code: the buffer to populate the country code into 217 * 218 * Return: QDF_STATUS 219 */ 220 QDF_STATUS reg_read_default_country(struct wlan_objmgr_psoc *psoc, 221 uint8_t *country_code); 222 223 /** 224 * reg_get_ctry_idx_max_bw_from_country_code() - Get the max 5G bandwidth 225 * from country code 226 * @pdev: Pointer to pdev 227 * @cc: Country Code 228 * @max_bw_5g: Max 5G bandwidth supported by the country 229 * 230 * Return: QDF_STATUS 231 */ 232 233 QDF_STATUS reg_get_max_5g_bw_from_country_code(struct wlan_objmgr_pdev *pdev, 234 uint16_t cc, 235 uint16_t *max_bw_5g); 236 237 /** 238 * reg_get_max_5g_bw_from_regdomain() - Get the max 5G bandwidth 239 * supported by the regdomain 240 * @pdev: Pointer to pdev 241 * @orig_regdmn: Regdomain pair value 242 * @max_bw_5g: Max 5G bandwidth supported by the country 243 * 244 * Return: QDF_STATUS 245 */ 246 247 QDF_STATUS reg_get_max_5g_bw_from_regdomain(struct wlan_objmgr_pdev *pdev, 248 uint16_t regdmn, 249 uint16_t *max_bw_5g); 250 251 /** 252 * reg_get_current_dfs_region () - Get the current dfs region 253 * @pdev: Pointer to pdev 254 * @dfs_reg: pointer to dfs region 255 * 256 * Return: None 257 */ 258 void reg_get_current_dfs_region(struct wlan_objmgr_pdev *pdev, 259 enum dfs_reg *dfs_reg); 260 261 /** 262 * reg_get_bw_value() - give bandwidth value 263 * bw: bandwidth enum 264 * 265 * Return: uint16_t 266 */ 267 uint16_t reg_get_bw_value(enum phy_ch_width bw); 268 269 /** 270 * reg_set_dfs_region () - Set the current dfs region 271 * @pdev: Pointer to pdev 272 * @dfs_reg: pointer to dfs region 273 * 274 * Return: None 275 */ 276 void reg_set_dfs_region(struct wlan_objmgr_pdev *pdev, 277 enum dfs_reg dfs_reg); 278 279 /** 280 * reg_program_chan_list() - Set user country code and populate the channel list 281 * @pdev: Pointer to pdev 282 * @rd: Pointer to cc_regdmn_s structure 283 * 284 * Return: QDF_STATUS 285 */ 286 QDF_STATUS reg_program_chan_list(struct wlan_objmgr_pdev *pdev, 287 struct cc_regdmn_s *rd); 288 289 /** 290 * reg_freq_to_chan() - Get channel number from frequency. 291 * @pdev: Pointer to pdev 292 * @freq: Channel frequency 293 * 294 * Return: Channel number if success, otherwise 0 295 */ 296 uint8_t reg_freq_to_chan(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); 297 298 /** 299 * reg_legacy_chan_to_freq() - Get freq from chan noumber, for 2G and 5G 300 * @pdev: Pointer to pdev 301 * @chan_num: Channel number 302 * 303 * Return: Channel frequency if success, otherwise 0 304 */ 305 uint16_t reg_legacy_chan_to_freq(struct wlan_objmgr_pdev *pdev, 306 uint8_t chan_num); 307 308 /** 309 * reg_get_current_cc() - Get current country code 310 * @pdev: Pdev pointer 311 * @regdmn: Pointer to get current country values 312 * 313 * Return: QDF_STATUS 314 */ 315 QDF_STATUS reg_get_current_cc(struct wlan_objmgr_pdev *pdev, 316 struct cc_regdmn_s *rd); 317 318 /** 319 * reg_set_regdb_offloaded() - set/clear regulatory offloaded flag 320 * 321 * @psoc: psoc pointer 322 * Return: Success or Failure 323 */ 324 QDF_STATUS reg_set_regdb_offloaded(struct wlan_objmgr_psoc *psoc, bool val); 325 326 /** 327 * reg_get_curr_regdomain() - Get current regdomain in use 328 * @pdev: pdev pointer 329 * @cur_regdmn: Current regdomain info 330 * 331 * Return: QDF status 332 */ 333 QDF_STATUS reg_get_curr_regdomain(struct wlan_objmgr_pdev *pdev, 334 struct cur_regdmn_info *cur_regdmn); 335 336 /** 337 * reg_modify_chan_144() - Enable/Disable channel 144 338 * @pdev: pdev pointer 339 * @en_chan_144: flag to disable/enable channel 144 340 * 341 * Return: Success or Failure 342 */ 343 QDF_STATUS reg_modify_chan_144(struct wlan_objmgr_pdev *pdev, bool en_chan_144); 344 345 /** 346 * reg_get_en_chan_144() - get en_chan_144 flag value 347 * @pdev: pdev pointer 348 * 349 * Return: en_chan_144 flag value 350 */ 351 bool reg_get_en_chan_144(struct wlan_objmgr_pdev *pdev); 352 353 /** 354 * reg_get_hal_reg_cap() - Get HAL REG capabilities 355 * @psoc: psoc for country information 356 * 357 * Return: hal reg cap pointer 358 */ 359 struct wlan_psoc_host_hal_reg_capabilities_ext *reg_get_hal_reg_cap( 360 struct wlan_objmgr_psoc *psoc); 361 362 /** 363 * reg_set_hal_reg_cap() - Set HAL REG capabilities 364 * @psoc: psoc for country information 365 * @reg_cap: Regulatory caps pointer 366 * @phy_cnt: number of phy 367 * 368 * Return: hal reg cap pointer 369 */ 370 QDF_STATUS reg_set_hal_reg_cap( 371 struct wlan_objmgr_psoc *psoc, 372 struct wlan_psoc_host_hal_reg_capabilities_ext *reg_cap, 373 uint16_t phy_cnt); 374 375 /** 376 * reg_update_hal_reg_cap() - Update HAL REG capabilities 377 * @psoc: psoc pointer 378 * @wireless_modes: 11AX wireless modes 379 * @phy_id: phy id 380 * 381 * Return: QDF_STATUS 382 */ 383 QDF_STATUS reg_update_hal_reg_cap(struct wlan_objmgr_psoc *psoc, 384 uint64_t wireless_modes, uint8_t phy_id); 385 386 /** 387 * reg_chan_in_range() - Check if the given channel is in pdev's channel range 388 * @chan_list: Pointer to regulatory channel list. 389 * @low_freq_2g: Low frequency 2G. 390 * @high_freq_2g: High frequency 2G. 391 * @low_freq_5g: Low frequency 5G. 392 * @high_freq_5g: High frequency 5G. 393 * @ch_enum: Channel enum. 394 * 395 * Return: true if ch_enum is with in pdev's channel range, else false. 396 */ 397 bool reg_chan_in_range(struct regulatory_channel *chan_list, 398 qdf_freq_t low_freq_2g, qdf_freq_t high_freq_2g, 399 qdf_freq_t low_freq_5g, qdf_freq_t high_freq_5g, 400 enum channel_enum ch_enum); 401 402 /** 403 * reg_init_channel_map() - Initialize the channel list based on the dfs region. 404 * @dfs_region: Dfs region 405 */ 406 void reg_init_channel_map(enum dfs_reg dfs_region); 407 408 /** 409 * reg_get_psoc_tx_ops() - Get regdb tx ops 410 * @psoc: Pointer to psoc structure 411 */ 412 struct wlan_lmac_if_reg_tx_ops *reg_get_psoc_tx_ops( 413 struct wlan_objmgr_psoc *psoc); 414 415 /** 416 * reg_is_24ghz_ch_freq() - Check if the given channel frequency is 2.4GHz 417 * @freq: Channel frequency 418 * 419 * Return: true if channel frequency is 2.4GHz, else false 420 */ 421 bool reg_is_24ghz_ch_freq(uint32_t freq); 422 423 /** 424 * reg_is_5ghz_ch_freq() - Check if the given channel frequency is 5GHz 425 * @freq: Channel frequency 426 * 427 * Return: true if channel frequency is 5GHz, else false 428 */ 429 bool reg_is_5ghz_ch_freq(uint32_t freq); 430 431 /** 432 * reg_is_range_overlap_2g() - Check if the given low_freq and high_freq 433 * is in the 2G range. 434 * 435 * @low_freq - Low frequency. 436 * @high_freq - High frequency. 437 * 438 * Return: Return true if given low_freq and high_freq overlaps 2G range, 439 * else false. 440 */ 441 bool reg_is_range_overlap_2g(qdf_freq_t low_freq, qdf_freq_t high_freq); 442 443 /** 444 * reg_is_range_overlap_5g() - Check if the given low_freq and high_freq 445 * is in the 5G range. 446 * 447 * @low_freq - Low frequency. 448 * @high_freq - High frequency. 449 * 450 * Return: Return true if given low_freq and high_freq overlaps 5G range, 451 * else false. 452 */ 453 bool reg_is_range_overlap_5g(qdf_freq_t low_freq, qdf_freq_t high_freq); 454 455 /** 456 * reg_is_freq_indoor() - Check if the input frequency is an indoor frequency. 457 * @pdev: Pointer to pdev. 458 * @freq: Channel frequency. 459 * 460 * Return: Return true if the input frequency is indoor, else false. 461 */ 462 bool reg_is_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); 463 464 /** 465 * reg_get_min_chwidth() - Return min chanwidth supported by freq. 466 * @pdev: Pointer to pdev. 467 * @freq: Channel frequency. 468 * 469 * Return: Min chwidth supported by freq as per regulatory DB. 470 */ 471 uint16_t reg_get_min_chwidth(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); 472 473 /** 474 * reg_get_max_chwidth() - Return max chanwidth supported by freq. 475 * @pdev: Pointer to pdev. 476 * @freq: Channel frequency. 477 * 478 * Return: Max chwidth supported by freq as per regulatory DB. 479 */ 480 uint16_t reg_get_max_chwidth(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); 481 482 #ifdef CONFIG_REG_CLIENT 483 /** 484 * reg_is_freq_indoor_in_secondary_list() - Check if the input frequency is 485 * an indoor frequency in the secondary channel list 486 * @pdev: Pointer to pdev. 487 * @freq: Channel frequency. 488 * 489 * Return: Return true if the input frequency is indoor, else false. 490 */ 491 bool reg_is_freq_indoor_in_secondary_list(struct wlan_objmgr_pdev *pdev, 492 qdf_freq_t freq); 493 #endif 494 495 #ifdef CONFIG_BAND_6GHZ 496 /** 497 * reg_is_6ghz_chan_freq() - Check if the given channel frequency is 6GHz 498 * @freq: Channel frequency 499 * 500 * Return: true if channel frequency is 6GHz, else false 501 */ 502 bool reg_is_6ghz_chan_freq(uint16_t freq); 503 504 #ifdef CONFIG_6G_FREQ_OVERLAP 505 /** 506 * reg_is_range_only6g() - Check if the given low_freq and high_freq is only in 507 * the 6G range. 508 * 509 * @low_freq - Low frequency. 510 * @high_freq - High frequency. 511 * 512 * Return: Return true if given low_freq and high_freq overlaps only the 6G 513 * range, else false. 514 */ 515 bool reg_is_range_only6g(qdf_freq_t low_freq, qdf_freq_t high_freq); 516 517 /** 518 * reg_is_range_overlap_6g() - Check if the given low_freq and high_freq 519 * is in the 6G range. 520 * 521 * @low_freq - Low frequency. 522 * @high_freq - High frequency. 523 * 524 * Return: Return true if given low_freq and high_freq overlaps 6G range, 525 * else false. 526 */ 527 bool reg_is_range_overlap_6g(qdf_freq_t low_freq, qdf_freq_t high_freq); 528 #endif 529 530 /** 531 * REG_IS_6GHZ_FREQ() - Check if the given channel frequency is 6GHz 532 * @freq: Channel frequency 533 * 534 * Return: true if channel frequency is 6GHz, else false 535 */ 536 static inline bool REG_IS_6GHZ_FREQ(uint16_t freq) 537 { 538 return ((freq >= REG_MIN_6GHZ_CHAN_FREQ) && 539 (freq <= REG_MAX_6GHZ_CHAN_FREQ)); 540 } 541 542 /** 543 * reg_is_6ghz_psc_chan_freq() - Check if the given 6GHz channel frequency is 544 * preferred scanning channel frequency. 545 * @freq: Channel frequency 546 * 547 * Return: true if given 6GHz channel frequency is preferred scanning channel 548 * frequency, else false 549 */ 550 bool reg_is_6ghz_psc_chan_freq(uint16_t freq); 551 552 /** 553 * reg_is_6g_freq_indoor() - Check if a 6GHz frequency is indoor. 554 * @pdev: Pointer to pdev. 555 * @freq: Channel frequency. 556 * 557 * Return: Return true if a 6GHz frequency is indoor, else false. 558 */ 559 bool reg_is_6g_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); 560 561 /** 562 * reg_get_max_txpower_for_6g_tpe() - Get max txpower for 6G TPE IE. 563 * @pdev: Pointer to pdev. 564 * @freq: Channel frequency. 565 * @bw: Channel bandwidth. 566 * @reg_ap: Regulatory 6G AP type. 567 * @reg_client: Regulatory 6G client type. 568 * @is_psd: True if txpower is needed in PSD format, and false if needed in EIRP 569 * format. 570 * @tx_power: Pointer to tx-power. 571 * 572 * Return: Return QDF_STATUS_SUCCESS, if tx_power is filled for 6G TPE IE 573 * else return QDF_STATUS_E_FAILURE. 574 */ 575 QDF_STATUS reg_get_max_txpower_for_6g_tpe(struct wlan_objmgr_pdev *pdev, 576 qdf_freq_t freq, uint8_t bw, 577 enum reg_6g_ap_type reg_ap, 578 enum reg_6g_client_type reg_client, 579 bool is_psd, 580 uint8_t *tx_power); 581 582 /** 583 * reg_min_6ghz_chan_freq() - Get minimum 6GHz channel center frequency 584 * 585 * Return: Minimum 6GHz channel center frequency 586 */ 587 uint16_t reg_min_6ghz_chan_freq(void); 588 589 /** 590 * reg_max_6ghz_chan_freq() - Get maximum 6GHz channel center frequency 591 * 592 * Return: Maximum 6GHz channel center frequency 593 */ 594 uint16_t reg_max_6ghz_chan_freq(void); 595 #else 596 static inline bool reg_is_6ghz_chan_freq(uint16_t freq) 597 { 598 return false; 599 } 600 601 static inline bool 602 reg_is_6g_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) 603 { 604 return false; 605 } 606 607 static inline QDF_STATUS 608 reg_get_max_txpower_for_6g_tpe(struct wlan_objmgr_pdev *pdev, 609 qdf_freq_t freq, uint8_t bw, 610 enum reg_6g_ap_type reg_ap, 611 enum reg_6g_client_type reg_client, 612 bool is_psd, 613 uint8_t *tx_power) 614 { 615 return QDF_STATUS_E_FAILURE; 616 } 617 618 #ifdef CONFIG_6G_FREQ_OVERLAP 619 static inline bool reg_is_range_overlap_6g(qdf_freq_t low_freq, 620 qdf_freq_t high_freq) 621 { 622 return false; 623 } 624 625 static inline bool reg_is_range_only6g(qdf_freq_t low_freq, 626 qdf_freq_t high_freq) 627 { 628 return false; 629 } 630 #endif 631 632 static inline bool REG_IS_6GHZ_FREQ(uint16_t freq) 633 { 634 return false; 635 } 636 637 static inline bool reg_is_6ghz_psc_chan_freq(uint16_t freq) 638 { 639 return false; 640 } 641 642 static inline uint16_t reg_min_6ghz_chan_freq(void) 643 { 644 return 0; 645 } 646 647 static inline uint16_t reg_max_6ghz_chan_freq(void) 648 { 649 return 0; 650 } 651 #endif /* CONFIG_BAND_6GHZ */ 652 653 /** 654 * reg_get_band_channel_list() - Caller function to 655 * reg_get_band_from_cur_chan_list with primary current channel list 656 * @pdev: pdev ptr 657 * @band_mask: Input bitmap with band set 658 * @channel_list: Pointer to Channel List 659 * 660 * Caller function to reg_get_band_from_cur_chan_listto get the primary channel 661 * list and number of channels (for non-beaconing entities). 662 * 663 * Return: Number of channels, else 0 to indicate error 664 */ 665 uint16_t reg_get_band_channel_list(struct wlan_objmgr_pdev *pdev, 666 uint8_t band_mask, 667 struct regulatory_channel *channel_list); 668 669 #ifdef CONFIG_REG_6G_PWRMODE 670 /** 671 * reg_get_band_channel_list() - Caller function to 672 * reg_get_band_from_cur_chan_list with primary current channel list 673 * @pdev: pdev ptr 674 * @band_mask: Input bitmap with band set 675 * @channel_list: Pointer to Channel List 676 * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup. 677 * 678 * Caller function to reg_get_band_from_cur_chan_listto get the primary channel 679 * list and number of channels (for non-beaconing entities). 680 * 681 * Return: Number of channels, else 0 to indicate error 682 */ 683 uint16_t reg_get_band_channel_list_for_pwrmode(struct wlan_objmgr_pdev *pdev, 684 uint8_t band_mask, 685 struct regulatory_channel 686 *channel_list, 687 enum supported_6g_pwr_types 688 in_6g_pwr_type); 689 #endif 690 691 #ifdef CONFIG_REG_CLIENT 692 /** 693 * reg_get_secondary_band_channel_list() - Caller function to 694 * reg_get_band_from_cur_chan_list with secondary current channel list 695 * @pdev: pdev ptr 696 * @band_mask: Input bitmap with band set 697 * @channel_list: Pointer to Channel List 698 * 699 * Caller function to reg_get_band_from_cur_chan_list to get the secondary 700 * channel list and number of channels (for beaconing entities). 701 * 702 * Return: Number of channels, else 0 to indicate error 703 */ 704 uint16_t reg_get_secondary_band_channel_list(struct wlan_objmgr_pdev *pdev, 705 uint8_t band_mask, 706 struct regulatory_channel 707 *channel_list); 708 #endif 709 710 /** 711 * reg_chan_band_to_freq - Return channel frequency based on the channel number 712 * and band. 713 * @pdev: pdev ptr 714 * @chan: Channel Number 715 * @band_mask: Bitmap for bands 716 * 717 * Return: Return channel frequency or return 0, if the channel is disabled or 718 * if the input channel number or band_mask is invalid. Composite bands are 719 * supported only for 2.4Ghz and 5Ghz bands. For other bands the following 720 * priority is given: 1) 6Ghz 2) 5Ghz 3) 2.4Ghz. 721 */ 722 qdf_freq_t reg_chan_band_to_freq(struct wlan_objmgr_pdev *pdev, 723 uint8_t chan, 724 uint8_t band_mask); 725 726 /** 727 * reg_is_49ghz_freq() - Check if the given channel frequency is 4.9GHz 728 * @freq: Channel frequency 729 * 730 * Return: true if channel frequency is 4.9GHz, else false 731 */ 732 bool reg_is_49ghz_freq(qdf_freq_t freq); 733 734 /** 735 * reg_ch_num() - Get channel number from channel enum 736 * @ch_enum: Channel enum 737 * 738 * Return: channel number 739 */ 740 qdf_freq_t reg_ch_num(uint32_t ch_enum); 741 742 /** 743 * reg_ch_to_freq() - Get channel frequency from channel enum 744 * @ch_enum: Channel enum 745 * 746 * Return: channel frequency 747 */ 748 qdf_freq_t reg_ch_to_freq(uint32_t ch_enum); 749 750 /** 751 * reg_max_5ghz_ch_num() - Get maximum 5GHz channel number 752 * 753 * Return: Maximum 5GHz channel number 754 */ 755 uint8_t reg_max_5ghz_ch_num(void); 756 757 #ifdef CONFIG_CHAN_FREQ_API 758 /** 759 * reg_min_24ghz_chan_freq() - Get minimum 2.4GHz channel frequency 760 * 761 * Return: Minimum 2.4GHz channel frequency 762 */ 763 qdf_freq_t reg_min_24ghz_chan_freq(void); 764 765 /** 766 * reg_max_24ghz_chan_freq() - Get maximum 2.4GHz channel frequency 767 * 768 * Return: Maximum 2.4GHz channel frequency 769 */ 770 qdf_freq_t reg_max_24ghz_chan_freq(void); 771 772 /** 773 * reg_min_5ghz_chan_freq() - Get minimum 5GHz channel frequency 774 * 775 * Return: Minimum 5GHz channel frequency 776 */ 777 qdf_freq_t reg_min_5ghz_chan_freq(void); 778 779 /** 780 * reg_max_5ghz_chan_freq() - Get maximum 5GHz channel frequency 781 * 782 * Return: Maximum 5GHz channel frequency 783 */ 784 qdf_freq_t reg_max_5ghz_chan_freq(void); 785 #endif /* CONFIG_CHAN_FREQ_API */ 786 787 /** 788 * reg_enable_dfs_channels() - Enable the use of DFS channels 789 * @pdev: The physical dev to enable/disable DFS channels for 790 * 791 * Return: QDF_STATUS 792 */ 793 QDF_STATUS reg_enable_dfs_channels(struct wlan_objmgr_pdev *pdev, bool enable); 794 795 #ifdef WLAN_REG_PARTIAL_OFFLOAD 796 /** 797 * reg_program_default_cc() - Program default country code 798 * @pdev: Pdev pointer 799 * @regdmn: Regdomain value 800 * 801 * Return: QDF_STATUS 802 */ 803 QDF_STATUS reg_program_default_cc(struct wlan_objmgr_pdev *pdev, 804 uint16_t regdmn); 805 806 /** 807 * reg_is_regdmn_en302502_applicable() - Find if ETSI EN302_502 radar pattern 808 * is applicable in current regulatory domain. 809 * @pdev: Pdev object pointer. 810 * 811 * Return: True if en302_502 is applicable, else false. 812 */ 813 bool reg_is_regdmn_en302502_applicable(struct wlan_objmgr_pdev *pdev); 814 #endif 815 816 /** 817 * reg_update_channel_ranges() - Update the channel ranges with the new 818 * phy capabilities. 819 * @pdev: The physical dev for which channel ranges are to be updated. 820 * 821 * Return: QDF_STATUS. 822 */ 823 QDF_STATUS reg_update_channel_ranges(struct wlan_objmgr_pdev *pdev); 824 825 /** 826 * reg_modify_pdev_chan_range() - Compute current channel list 827 * in accordance with the modified reg caps. 828 * @pdev: The physical dev for which channel list must be built. 829 * 830 * Return: QDF_STATUS 831 */ 832 QDF_STATUS reg_modify_pdev_chan_range(struct wlan_objmgr_pdev *pdev); 833 834 /** 835 * reg_update_pdev_wireless_modes() - Update the wireless_modes in the 836 * pdev_priv_obj with the input wireless_modes 837 * @pdev: pointer to wlan_objmgr_pdev. 838 * @wireless_modes: Wireless modes. 839 * 840 * Return : QDF_STATUS 841 */ 842 QDF_STATUS reg_update_pdev_wireless_modes(struct wlan_objmgr_pdev *pdev, 843 uint64_t wireless_modes); 844 845 /** 846 * reg_get_phybitmap() - Get phybitmap from regulatory pdev_priv_obj 847 * @pdev: pdev pointer 848 * @phybitmap: pointer to phybitmap 849 * 850 * Return: QDF STATUS 851 */ 852 QDF_STATUS reg_get_phybitmap(struct wlan_objmgr_pdev *pdev, 853 uint16_t *phybitmap); 854 #ifdef DISABLE_UNII_SHARED_BANDS 855 /** 856 * reg_disable_chan_coex() - Disable Coexisting channels based on the input 857 * bitmask. 858 * @pdev: pointer to wlan_objmgr_pdev. 859 * unii_5g_bitmap: UNII 5G bitmap. 860 * 861 * Return : QDF_STATUS 862 */ 863 QDF_STATUS reg_disable_chan_coex(struct wlan_objmgr_pdev *pdev, 864 uint8_t unii_5g_bitmap); 865 #endif 866 867 #ifdef CONFIG_CHAN_FREQ_API 868 /** 869 * reg_is_freq_present_in_cur_chan_list() - Check the input frequency 870 * @pdev: Pointer to pdev 871 * @freq: Channel center frequency in MHz 872 * 873 * Check if the input channel center frequency is present in the current 874 * channel list 875 * 876 * Return: Return true if channel center frequency is present in the current 877 * channel list, else return false. 878 */ 879 bool 880 reg_is_freq_present_in_cur_chan_list(struct wlan_objmgr_pdev *pdev, 881 qdf_freq_t freq); 882 883 /** 884 * reg_get_chan_enum_for_freq() - Get channel enum for given channel frequency 885 * @freq: Channel Frequency 886 * 887 * Return: Channel enum 888 */ 889 enum channel_enum reg_get_chan_enum_for_freq(qdf_freq_t freq); 890 891 /** 892 * reg_get_channel_list_with_power_for_freq() - Provides the channel list with 893 * power 894 * @pdev: Pointer to pdev 895 * @ch_list: Pointer to the channel list. 896 * @num_chan: Pointer to save number of channels 897 * 898 * Return: QDF_STATUS 899 */ 900 QDF_STATUS 901 reg_get_channel_list_with_power_for_freq(struct wlan_objmgr_pdev *pdev, 902 struct channel_power *ch_list, 903 uint8_t *num_chan); 904 905 #ifdef CONFIG_REG_6G_PWRMODE 906 /** 907 * reg_get_channel_state_for_pwrmode() - Get channel state from regulatory 908 * @pdev: Pointer to pdev 909 * @freq: channel center frequency. 910 * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup. 911 * 912 * Return: channel state 913 */ 914 enum channel_state 915 reg_get_channel_state_for_pwrmode(struct wlan_objmgr_pdev *pdev, 916 qdf_freq_t freq, 917 enum supported_6g_pwr_types in_6g_pwr_type); 918 #endif 919 920 #ifdef CONFIG_REG_CLIENT 921 /** 922 * reg_get_channel_state_from_secondary_list_for_freq() - Get channel state 923 * from secondary regulatory current channel list 924 * @pdev: Pointer to pdev 925 * @freq: channel center frequency. 926 * 927 * Return: channel state 928 */ 929 enum channel_state reg_get_channel_state_from_secondary_list_for_freq( 930 struct wlan_objmgr_pdev *pdev, 931 qdf_freq_t freq); 932 933 /** 934 * reg_get_channel_list_with_power() - Provides the channel list with power 935 * @pdev: Pointer to pdev 936 * @ch_list: Pointer to the channel list. 937 * @num_chan: Pointer to save number of channels 938 * @in_6g_pwr_type: 6G power type corresponding to which 6G channel list is 939 * required 940 * 941 * Return: QDF_STATUS 942 */ 943 QDF_STATUS reg_get_channel_list_with_power( 944 struct wlan_objmgr_pdev *pdev, 945 struct channel_power *ch_list, 946 uint8_t *num_chan, 947 enum supported_6g_pwr_types in_6g_pwr_type); 948 #endif 949 950 /** 951 * reg_get_5g_bonded_channel_state_for_freq() - Get channel state for 952 * 5G bonded channel using the channel frequency 953 * @pdev: Pointer to pdev 954 * @freq: channel center frequency. 955 * @ch_params: channel parameters 956 * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup. 957 * 958 * Return: channel state 959 */ 960 enum channel_state 961 reg_get_5g_bonded_channel_state_for_freq(struct wlan_objmgr_pdev *pdev, 962 qdf_freq_t freq, 963 struct ch_params *ch_params); 964 965 #ifdef CONFIG_REG_6G_PWRMODE 966 enum channel_state 967 reg_get_5g_bonded_channel_state_for_pwrmode(struct wlan_objmgr_pdev *pdev, 968 qdf_freq_t freq, 969 struct ch_params *ch_params, 970 enum supported_6g_pwr_types 971 in_6g_pwr_mode); 972 #endif 973 974 /** 975 * reg_get_2g_bonded_channel_state_for_freq() - Get channel state for 2G 976 * bonded channel 977 * @freq: channel center frequency. 978 * @pdev: Pointer to pdev 979 * @oper_ch_freq: Primary channel center frequency 980 * @sec_ch_freq: Secondary channel center frequency 981 * @bw: channel band width 982 * 983 * Return: channel state 984 */ 985 enum channel_state 986 reg_get_2g_bonded_channel_state_for_freq(struct wlan_objmgr_pdev *pdev, 987 qdf_freq_t oper_ch_freq, 988 qdf_freq_t sec_ch_freq, 989 enum phy_ch_width bw); 990 991 /** 992 * reg_set_channel_params_for_freq () - Sets channel parameteres for given 993 * bandwidth 994 * @pdev: Pointer to pdev 995 * @freq: Channel center frequency. 996 * @sec_ch_2g_freq: Secondary 2G channel frequency 997 * @ch_params: pointer to the channel parameters. 998 * @treat_nol_chan_as_disabled: bool to treat nol channel as enabled or 999 * disabled. If set to true, nol chan is considered as disabled in chan search. 1000 * 1001 * Return: None 1002 */ 1003 void reg_set_channel_params_for_freq(struct wlan_objmgr_pdev *pdev, 1004 qdf_freq_t freq, 1005 qdf_freq_t sec_ch_2g_freq, 1006 struct ch_params *ch_params, 1007 bool treat_nol_chan_as_disabled); 1008 1009 #ifdef CONFIG_REG_6G_PWRMODE 1010 /** 1011 * reg_set_channel_params_for_pwrmode () - Sets channel parameteres for given 1012 * bandwidth 1013 * @pdev: Pointer to pdev 1014 * @freq: Channel center frequency. 1015 * @sec_ch_2g_freq: Secondary 2G channel frequency 1016 * @ch_params: pointer to the channel parameters. 1017 * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup. 1018 * @treat_nol_chan_as_disabled: bool to treat nol channel as enabled or 1019 * disabled. If set to true, nol chan is considered as disabled in chan search. 1020 * 1021 * Return: None 1022 */ 1023 void reg_set_channel_params_for_pwrmode(struct wlan_objmgr_pdev *pdev, 1024 qdf_freq_t freq, 1025 qdf_freq_t sec_ch_2g_freq, 1026 struct ch_params *ch_params, 1027 enum supported_6g_pwr_types 1028 in_6g_pwr_mode, 1029 bool treat_nol_chan_as_disabled); 1030 #endif 1031 1032 #ifdef WLAN_FEATURE_11BE 1033 /** 1034 * reg_fill_channel_list() - Fills an array of ch_params (list of 1035 * channels) for the given channel width and primary freq. 1036 * If 320 band_center is given, ch_params corresponding to the 1037 * given band_center is filled. 1038 * 1039 * @pdev: Pointer to pdev 1040 * @freq: Center frequency of the primary channel in MHz 1041 * @sec_ch_2g_freq: Secondary 2G channel frequency in MHZ 1042 * @ch_width: Input channel width. 1043 * @band_center: Center frequency of the 320MHZ channel. 1044 * @chan_list: Pointer to struct reg_channel_list to be filled (Output). 1045 * The caller is supposed to provide enough storage for the elements 1046 * in the list. 1047 * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup. 1048 * @treat_nol_chan_as_disabled: bool to treat nol channel as enabled or 1049 * disabled. If set to true, nol chan is considered as disabled in chan search. 1050 * 1051 * Return: None 1052 */ 1053 void 1054 reg_fill_channel_list(struct wlan_objmgr_pdev *pdev, 1055 qdf_freq_t freq, 1056 qdf_freq_t sec_ch_2g_freq, 1057 enum phy_ch_width ch_width, 1058 qdf_freq_t band_center_320, 1059 struct reg_channel_list *chan_list, 1060 bool treat_nol_chan_as_disabled); 1061 1062 #ifdef CONFIG_REG_6G_PWRMODE 1063 /** 1064 * reg_fill_channel_list_for_pwrmode() - Fills an array of ch_params (list of 1065 * channels) for the given channel width and primary freq. 1066 * If 320 band_center is given, ch_params corresponding to the 1067 * given band_center is filled. 1068 * 1069 * @pdev: Pointer to pdev 1070 * @freq: Center frequency of the primary channel in MHz 1071 * @sec_ch_2g_freq: Secondary 2G channel frequency in MHZ 1072 * @ch_width: Input channel width. 1073 * @band_center: Center frequency of the 320MHZ channel. 1074 * @chan_list: Pointer to struct reg_channel_list to be filled (Output). 1075 * The caller is supposed to provide enough storage for the elements 1076 * in the list. 1077 * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup. 1078 * @treat_nol_chan_as_disabled: bool to treat nol channel as enabled or 1079 * disabled. If set to true, nol chan is considered as disabled in chan search. 1080 * 1081 * Return: None 1082 */ 1083 void 1084 reg_fill_channel_list_for_pwrmode(struct wlan_objmgr_pdev *pdev, 1085 qdf_freq_t freq, 1086 qdf_freq_t sec_ch_2g_freq, 1087 enum phy_ch_width ch_width, 1088 qdf_freq_t band_center_320, 1089 struct reg_channel_list *chan_list, 1090 enum supported_6g_pwr_types in_6g_pwr_mode, 1091 bool treat_nol_chan_as_disabled); 1092 #endif 1093 1094 /** 1095 * reg_is_punc_bitmap_valid() - is puncture bitmap valid or not 1096 * @bw: Input channel width. 1097 * @puncture_bitmap Input puncture bitmap. 1098 * 1099 * Return: true if given puncture bitmap is valid 1100 */ 1101 bool reg_is_punc_bitmap_valid(enum phy_ch_width bw, uint16_t puncture_bitmap); 1102 1103 #ifdef QCA_DFS_BW_PUNCTURE 1104 /** 1105 * reg_find_nearest_puncture_pattern() - is generated bitmap is valid or not 1106 * @bw: Input channel width. 1107 * @proposed_bitmap: Input puncture bitmap. 1108 * 1109 * Return: Radar bitmap if it is valid. 1110 */ 1111 uint16_t reg_find_nearest_puncture_pattern(enum phy_ch_width bw, 1112 uint16_t proposed_bitmap); 1113 #else 1114 static inline 1115 uint16_t reg_find_nearest_puncture_pattern(enum phy_ch_width bw, 1116 uint16_t proposed_bitmap) 1117 { 1118 return 0; 1119 } 1120 #endif /* QCA_DFS_BW_PUNCTURE */ 1121 1122 /** 1123 * reg_extract_puncture_by_bw() - generate new puncture bitmap from original 1124 * puncture bitmap and bandwidth based on new 1125 * bandwidth 1126 * @ori_bw: original bandwidth 1127 * @ori_puncture_bitmap: original puncture bitmap 1128 * @freq: frequency of primary channel 1129 * @cen320_freq: center frequency of 320 MHZ if channel width is 320 1130 * @new_bw new bandwidth. It should be smaller than original bandwidth 1131 * @new_puncture_bitmap: output of puncture bitmap 1132 * 1133 * Example 1: ori_bw = CH_WIDTH_320MHZ (center 320 = 6105{IEEE31}) 1134 * freq = 6075 ( Primary chan location: 0000_000P_0000_0000) 1135 * ori_puncture_bitmap = B1111 0000 0011 0000(binary) 1136 * If new_bw = CH_WIDTH_160MHZ, then new_puncture_bitmap = B0011 0000(binary) 1137 * If new_bw = CH_WIDTH_80MHZ, then new_puncture_bitmap = B0011(binary) 1138 * 1139 * Example 2: ori_bw = CH_WIDTH_320MHZ (center 320 = 6105{IEEE31}) 1140 * freq = 6135 ( Primary chan location: 0000_0000_0P00_0000) 1141 * ori_puncture_bitmap = B1111 0000 0011 0000(binary) 1142 * If new_bw = CH_WIDTH_160MHZ, then new_puncture_bitmap = B1111 0000(binary) 1143 * If new_bw = CH_WIDTH_80MHZ, then new_puncture_bitmap = B0000(binary) 1144 * 1145 * Return: QDF_STATUS 1146 */ 1147 QDF_STATUS reg_extract_puncture_by_bw(enum phy_ch_width ori_bw, 1148 uint16_t ori_puncture_bitmap, 1149 qdf_freq_t freq, 1150 qdf_freq_t cen320_freq, 1151 enum phy_ch_width new_bw, 1152 uint16_t *new_puncture_bitmap); 1153 1154 /** 1155 * reg_set_create_punc_bitmap() - set is_create_punc_bitmap of ch_params 1156 * @ch_params: ch_params to set 1157 * @is_create_punc_bitmap: is create punc bitmap 1158 * 1159 * Return: NULL 1160 */ 1161 void reg_set_create_punc_bitmap(struct ch_params *ch_params, 1162 bool is_create_punc_bitmap); 1163 #else 1164 static inline 1165 QDF_STATUS reg_extract_puncture_by_bw(enum phy_ch_width ori_bw, 1166 uint16_t ori_puncture_bitmap, 1167 qdf_freq_t freq, 1168 qdf_freq_t cen320_freq, 1169 enum phy_ch_width new_bw, 1170 uint16_t *new_puncture_bitmap) 1171 { 1172 return QDF_STATUS_SUCCESS; 1173 } 1174 1175 static inline void reg_set_create_punc_bitmap(struct ch_params *ch_params, 1176 bool is_create_punc_bitmap) 1177 { 1178 } 1179 #endif 1180 /** 1181 * reg_get_channel_reg_power_for_freq() - Get the txpower for the given channel 1182 * @pdev: Pointer to pdev 1183 * @freq: Channel frequency 1184 * 1185 * Return: txpower 1186 */ 1187 uint8_t reg_get_channel_reg_power_for_freq(struct wlan_objmgr_pdev *pdev, 1188 qdf_freq_t freq); 1189 1190 /** 1191 * reg_update_nol_ch_for_freq () - Updates NOL channels in current channel list 1192 * @pdev: pointer to pdev object 1193 * @chan_freq_list: pointer to NOL channel list 1194 * @num_ch: No.of channels in list 1195 * @update_nol: set/reset the NOL status 1196 * 1197 * Return: None 1198 */ 1199 void reg_update_nol_ch_for_freq(struct wlan_objmgr_pdev *pdev, 1200 uint16_t *chan_freq_list, 1201 uint8_t num_chan, 1202 bool nol_chan); 1203 /** 1204 * reg_is_dfs_for_freq () - Checks the channel state for DFS 1205 * @pdev: pdev ptr 1206 * @freq: Channel center frequency 1207 * 1208 * Return: true or false 1209 */ 1210 bool reg_is_dfs_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); 1211 1212 #ifdef CONFIG_REG_CLIENT 1213 /** 1214 * reg_is_dfs_in_secondary_list_for_freq() - Checks the channel state for DFS 1215 * from the secondary channel list 1216 * @pdev: pdev ptr 1217 * @freq: Channel center frequency 1218 * 1219 * Return: true or false 1220 */ 1221 bool reg_is_dfs_in_secondary_list_for_freq(struct wlan_objmgr_pdev *pdev, 1222 qdf_freq_t freq); 1223 #endif 1224 1225 /** 1226 * reg_chan_freq_is_49ghz() - Check if the input channel center frequency is 1227 * 4.9GHz 1228 * @pdev: Pdev pointer 1229 * @chan_num: Input channel center frequency 1230 * 1231 * Return: true if the frequency is 4.9GHz else false. 1232 */ 1233 bool reg_chan_freq_is_49ghz(qdf_freq_t freq); 1234 1235 /** 1236 * reg_update_nol_history_ch_for_freq() - Set nol-history flag for the channels 1237 * in the list. 1238 * @pdev: Pdev ptr. 1239 * @chan_list: Input channel frequency list. 1240 * @num_ch: Number of channels. 1241 * @nol_history_ch: NOL-History flag. 1242 * 1243 * Return: void 1244 */ 1245 void reg_update_nol_history_ch_for_freq(struct wlan_objmgr_pdev *pdev, 1246 uint16_t *chan_list, 1247 uint8_t num_chan, 1248 bool nol_history_chan); 1249 1250 /** 1251 * reg_is_same_5g_band_freqs() - Check if given channel center 1252 * frequencies have same band 1253 * @freq1: Channel Center Frequency 1 1254 * @freq2: Channel Center Frequency 2 1255 * 1256 * Return: true if both the frequencies has the same band. 1257 */ 1258 bool reg_is_same_band_freqs(qdf_freq_t freq1, qdf_freq_t freq2); 1259 1260 /** 1261 * reg_freq_to_band() - Get band from channel frequency 1262 * @chan_num: channel frequency 1263 * 1264 * Return: wifi band 1265 */ 1266 enum reg_wifi_band reg_freq_to_band(qdf_freq_t freq); 1267 1268 /** 1269 * reg_min_chan_freq() - minimum channel frequency supported 1270 * 1271 * Return: channel frequency 1272 */ 1273 qdf_freq_t reg_min_chan_freq(void); 1274 1275 /** 1276 * reg_max_chan_freq() - maximum channel frequency supported 1277 * 1278 * Return: channel frequency 1279 */ 1280 qdf_freq_t reg_max_chan_freq(void); 1281 1282 /** 1283 * reg_get_5g_bonded_channel_for_freq()- Return the channel state for a 1284 * 5G or 6G channel frequency based on the channel width and bonded channel 1285 * @pdev: Pointer to pdev. 1286 * @freq: Channel center frequency. 1287 * @ch_width: Channel Width. 1288 * @bonded_chan_ptr_ptr: Pointer to bonded_channel_freq. 1289 * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup. 1290 * 1291 * Return: Channel State 1292 */ 1293 enum channel_state 1294 reg_get_5g_bonded_channel_for_freq(struct wlan_objmgr_pdev *pdev, 1295 uint16_t freq, 1296 enum phy_ch_width ch_width, 1297 const struct bonded_channel_freq 1298 **bonded_chan_ptr_ptr); 1299 1300 #ifdef CONFIG_REG_6G_PWRMODE 1301 /** 1302 * reg_get_5g_bonded_channel_for_pwrmode()- Return the channel state for a 1303 * 5G or 6G channel frequency based on the channel width and bonded channel 1304 * @pdev: Pointer to pdev. 1305 * @freq: Channel center frequency. 1306 * @ch_width: Channel Width. 1307 * @bonded_chan_ptr_ptr: Pointer to bonded_channel_freq. 1308 * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup. 1309 * @input_puncture_bitmap: Input puncture bitmap 1310 * 1311 * Return: Channel State 1312 */ 1313 enum channel_state 1314 reg_get_5g_bonded_channel_for_pwrmode(struct wlan_objmgr_pdev *pdev, 1315 uint16_t freq, 1316 enum phy_ch_width ch_width, 1317 const struct bonded_channel_freq 1318 **bonded_chan_ptr_ptr, 1319 enum supported_6g_pwr_types 1320 in_6g_pwr_mode, 1321 uint16_t input_puncture_bitmap); 1322 #endif 1323 1324 #ifdef CONFIG_REG_6G_PWRMODE 1325 /** 1326 * reg_is_disable_for_pwrmode() - Check if the given channel frequency in 1327 * disable state 1328 * @pdev: Pointer to pdev 1329 * @freq: Channel frequency 1330 * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup. 1331 * 1332 * Return: True if channel state is disabled, else false 1333 */ 1334 bool reg_is_disable_for_pwrmode(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq, 1335 enum supported_6g_pwr_types in_6g_pwr_mode); 1336 #endif 1337 1338 #ifdef CONFIG_REG_CLIENT 1339 /** 1340 * reg_is_disable_in_secondary_list_for_freq() - Check if the given channel 1341 * frequency is in disable state 1342 * @pdev: Pointer to pdev 1343 * @freq: Channel frequency 1344 * 1345 * Return: True if channel state is disabled, else false 1346 */ 1347 bool reg_is_disable_in_secondary_list_for_freq(struct wlan_objmgr_pdev *pdev, 1348 qdf_freq_t freq); 1349 1350 /** 1351 * reg_is_enable_in_secondary_list_for_freq() - Check if the given channel 1352 * frequency is in enable state 1353 * @pdev: Pointer to pdev 1354 * @freq: Channel frequency 1355 * 1356 * Return: True if channel state is enabled, else false 1357 */ 1358 bool reg_is_enable_in_secondary_list_for_freq(struct wlan_objmgr_pdev *pdev, 1359 qdf_freq_t freq); 1360 1361 /** 1362 * reg_get_max_tx_power_for_pwr_mode() - Get maximum tx power 1363 * @pdev: Pointer to pdev 1364 * @in_6g_pwr_type: 6 GHz power type for which 6GHz frequencies needs to be 1365 * considered while getting the max power 1366 * 1367 * Return: return the value of the maximum tx power for 2GHz/5GHz channels 1368 * from current channel list and for 6GHz channels from the super channel list 1369 * for the specified power mode 1370 * 1371 */ 1372 uint8_t reg_get_max_tx_power_for_pwr_mode( 1373 struct wlan_objmgr_pdev *pdev, 1374 enum supported_6g_pwr_types in_6g_pwr_type); 1375 #endif 1376 1377 /** 1378 * reg_is_passive_for_freq() - Check if the given channel frequency is in 1379 * passive state 1380 * @pdev: Pointer to pdev 1381 * @freq: Channel frequency 1382 * 1383 * Return: True if channel state is passive, else false 1384 */ 1385 bool reg_is_passive_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); 1386 #endif /* CONFIG_CHAN_FREQ_API */ 1387 1388 /** 1389 * reg_get_max_tx_power() - Get maximum tx power from the current channel list 1390 * @pdev: Pointer to pdev 1391 * 1392 * Return: return the value of the maximum tx power in the current channel list 1393 * 1394 */ 1395 uint8_t reg_get_max_tx_power(struct wlan_objmgr_pdev *pdev); 1396 1397 /** 1398 * reg_set_ignore_fw_reg_offload_ind() - Set if regdb offload indication 1399 * needs to be ignored 1400 * @psoc: Pointer to psoc 1401 * 1402 * Return: QDF_STATUS 1403 */ 1404 QDF_STATUS reg_set_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc); 1405 1406 /** 1407 * reg_get_ignore_fw_reg_offload_ind() - Check whether regdb offload indication 1408 * needs to be ignored 1409 * 1410 * @psoc: Pointer to psoc 1411 */ 1412 bool reg_get_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc); 1413 1414 /** 1415 * reg_set_6ghz_supported() - Set if 6ghz is supported 1416 * 1417 * @psoc: Pointer to psoc 1418 * @val: value 1419 */ 1420 QDF_STATUS reg_set_6ghz_supported(struct wlan_objmgr_psoc *psoc, 1421 bool val); 1422 1423 /** 1424 * reg_set_5dot9_ghz_supported() - Set if 5.9ghz is supported 1425 * 1426 * @psoc: Pointer to psoc 1427 * @val: value 1428 */ 1429 QDF_STATUS reg_set_5dot9_ghz_supported(struct wlan_objmgr_psoc *psoc, 1430 bool val); 1431 1432 /** 1433 * reg_is_6ghz_op_class() - Check whether 6ghz oper class 1434 * 1435 * @pdev: Pointer to pdev 1436 * @op_class: oper class 1437 */ 1438 bool reg_is_6ghz_op_class(struct wlan_objmgr_pdev *pdev, 1439 uint8_t op_class); 1440 1441 #ifdef CONFIG_REG_CLIENT 1442 /** 1443 * reg_is_6ghz_supported() - Whether 6ghz is supported 1444 * 1445 * @psoc: pointer to psoc 1446 */ 1447 bool reg_is_6ghz_supported(struct wlan_objmgr_psoc *psoc); 1448 #endif 1449 1450 /** 1451 * reg_is_5dot9_ghz_supported() - Whether 5.9ghz is supported 1452 * 1453 * @psoc: pointer to psoc 1454 */ 1455 bool reg_is_5dot9_ghz_supported(struct wlan_objmgr_psoc *psoc); 1456 1457 /** 1458 * reg_is_fcc_regdmn () - Checks if the current reg domain is FCC3/FCC8/FCC15/ 1459 * FCC16 or not 1460 * @pdev: pdev ptr 1461 * 1462 * Return: true or false 1463 */ 1464 bool reg_is_fcc_regdmn(struct wlan_objmgr_pdev *pdev); 1465 1466 /** 1467 * reg_is_5dot9_ghz_freq () - Checks if the frequency is 5.9 GHz freq or not 1468 * @freq: frequency 1469 * @pdev: pdev ptr 1470 * 1471 * Return: true or false 1472 */ 1473 bool reg_is_5dot9_ghz_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); 1474 1475 /** 1476 * reg_is_5dot9_ghz_chan_allowed_master_mode () - Checks if 5.9 GHz channels 1477 * are allowed in master mode or not. 1478 * 1479 * @pdev: pdev ptr 1480 * 1481 * Return: true or false 1482 */ 1483 bool reg_is_5dot9_ghz_chan_allowed_master_mode(struct wlan_objmgr_pdev *pdev); 1484 1485 /** 1486 * reg_get_unii_5g_bitmap() - get unii_5g_bitmap value 1487 * @pdev: pdev pointer 1488 * @bitmap: Pointer to retrieve the unii_5g_bitmap of enum reg_unii_band 1489 * 1490 * Return: QDF_STATUS 1491 */ 1492 #ifdef DISABLE_UNII_SHARED_BANDS 1493 QDF_STATUS 1494 reg_get_unii_5g_bitmap(struct wlan_objmgr_pdev *pdev, uint8_t *bitmap); 1495 #endif 1496 1497 #ifdef CHECK_REG_PHYMODE 1498 /** 1499 * reg_get_max_phymode() - Recursively find the best possible phymode given a 1500 * phymode, a frequency, and per-country regulations 1501 * @pdev: pdev pointer 1502 * @phy_in: phymode that the user requested 1503 * @freq: current operating center frequency 1504 * 1505 * Return: maximum phymode allowed in current country that is <= phy_in 1506 */ 1507 enum reg_phymode reg_get_max_phymode(struct wlan_objmgr_pdev *pdev, 1508 enum reg_phymode phy_in, 1509 qdf_freq_t freq); 1510 #else 1511 static inline enum reg_phymode 1512 reg_get_max_phymode(struct wlan_objmgr_pdev *pdev, 1513 enum reg_phymode phy_in, 1514 qdf_freq_t freq) 1515 { 1516 return REG_PHYMODE_INVALID; 1517 } 1518 #endif /* CHECK_REG_PHYMODE */ 1519 1520 #ifdef CONFIG_REG_CLIENT 1521 /** 1522 * reg_band_bitmap_to_band_info() - Convert the band_bitmap to a band_info enum. 1523 * Since band_info enum only has combinations for 2G and 5G, 6G is not 1524 * considered in this function. 1525 * @band_bitmap: bitmap on top of reg_wifi_band of bands enabled 1526 * 1527 * Return: BAND_ALL if both 2G and 5G band is enabled 1528 * BAND_2G if 2G is enabled but 5G isn't 1529 * BAND_5G if 5G is enabled but 2G isn't 1530 */ 1531 enum band_info reg_band_bitmap_to_band_info(uint32_t band_bitmap); 1532 1533 QDF_STATUS 1534 reg_update_tx_power_on_ctry_change(struct wlan_objmgr_pdev *pdev, 1535 uint8_t vdev_id); 1536 #endif 1537 1538 #if defined(CONFIG_BAND_6GHZ) 1539 /** 1540 * reg_set_cur_6g_ap_pwr_type() - Set the current 6G regulatory AP power type. 1541 * @pdev: Pointer to PDEV object. 1542 * @reg_6g_ap_type: Regulatory 6G AP type ie VLPI/LPI/SP. 1543 * 1544 * Return: QDF_STATUS_E_INVAL if unable to set and QDF_STATUS_SUCCESS is set. 1545 */ 1546 QDF_STATUS 1547 reg_set_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev, 1548 enum reg_6g_ap_type reg_cur_6g_ap_pwr_type); 1549 1550 /** 1551 * reg_get_cur_6g_ap_pwr_type() - Get the current 6G regulatory AP power type. 1552 * @reg_6g_ap_pwr_type: The current regulatory 6G AP type ie VLPI/LPI/SP. 1553 * subordinate. 1554 * 1555 * Return: QDF_STATUS. 1556 */ 1557 QDF_STATUS 1558 reg_get_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev, 1559 enum reg_6g_ap_type *reg_cur_6g_ap_pwr_type); 1560 1561 #ifdef CONFIG_AFC_SUPPORT 1562 /** 1563 * reg_afc_start() - Start the AFC request from regulatory. This finally 1564 * sends the request to registered callbacks 1565 * @pdev: Pointer to pdev 1566 * @req_id: The AFC request ID 1567 * 1568 * Return: QDF_STATUS 1569 */ 1570 QDF_STATUS reg_afc_start(struct wlan_objmgr_pdev *pdev, uint64_t req_id); 1571 1572 /** 1573 * reg_get_partial_afc_req_info() - Get the AFC partial request information 1574 * @pdev: Pointer to pdev 1575 * @afc_req: Address of AFC request pointer 1576 * 1577 * NOTE:- The memory for AFC request is allocated by the function must be 1578 * freed by the caller. 1579 * Return: QDF_STATUS 1580 */ 1581 QDF_STATUS 1582 reg_get_partial_afc_req_info(struct wlan_objmgr_pdev *pdev, 1583 struct wlan_afc_host_partial_request **afc_req); 1584 1585 /** 1586 * reg_print_partial_afc_req_info() - Print the AFC partial request 1587 * information 1588 * @pdev: Pointer to pdev 1589 * @afc_req: Pointer to AFC request 1590 * 1591 * Return: Void 1592 */ 1593 void 1594 reg_print_partial_afc_req_info(struct wlan_objmgr_pdev *pdev, 1595 struct wlan_afc_host_partial_request *afc_req); 1596 1597 /** 1598 * reg_register_afc_req_rx_callback () - add AFC request received callback 1599 * @pdev: Pointer to pdev 1600 * @cbf: Pointer to callback handler 1601 * @arg: Pointer to opaque argument 1602 * 1603 * Return: QDF_STATUS 1604 */ 1605 QDF_STATUS reg_register_afc_req_rx_callback(struct wlan_objmgr_pdev *pdev, 1606 afc_req_rx_evt_handler cbf, 1607 void *arg); 1608 1609 /** 1610 * reg_unregister_afc_req_rx_callback () - remove AFC request received 1611 * callback 1612 * @pdev: Pointer to pdev 1613 * @cbf: Pointer to callback handler 1614 * 1615 * Return: QDF_STATUS 1616 */ 1617 QDF_STATUS reg_unregister_afc_req_rx_callback(struct wlan_objmgr_pdev *pdev, 1618 afc_req_rx_evt_handler cbf); 1619 1620 /** 1621 * reg_register_afc_power_event_callback() - add AFC power event received 1622 * @pdev: Pointer to pdev 1623 * @cbf: Pointer to callback function 1624 * @arg: Pointer to opaque argument 1625 * 1626 * Return: QDF_STATUS 1627 */ 1628 QDF_STATUS 1629 reg_register_afc_power_event_callback(struct wlan_objmgr_pdev *pdev, 1630 afc_power_tx_evt_handler cbf, 1631 void *arg); 1632 /** 1633 * reg_unregister_afc_power_event_callback() - remove AFC power event received 1634 * callback 1635 * @pdev: Pointer to pdev 1636 * @cbf: Pointer to callback function 1637 * 1638 * Return: QDF_STATUS 1639 */ 1640 QDF_STATUS 1641 reg_unregister_afc_power_event_callback(struct wlan_objmgr_pdev *pdev, 1642 afc_power_tx_evt_handler cbf); 1643 1644 /** 1645 * reg_send_afc_power_event() - Send AFC power event to registered 1646 * recipient 1647 * @pdev: Pointer to pdev 1648 * @power_info: Pointer to afc power info 1649 * 1650 * Return: QDF_STATUS 1651 */ 1652 QDF_STATUS reg_send_afc_power_event(struct wlan_objmgr_pdev *pdev, 1653 struct reg_fw_afc_power_event *power_info); 1654 1655 /** 1656 * reg_get_afc_dev_deploy_type() - Get AFC device deployment type 1657 * @pdev: Pointer to pdev 1658 * @reg_afc_dev_type: Pointer to afc device deployment type 1659 * 1660 * Return: QDF_STATUS 1661 */ 1662 QDF_STATUS 1663 reg_get_afc_dev_deploy_type(struct wlan_objmgr_pdev *pdev, 1664 enum reg_afc_dev_deploy_type *reg_afc_dev_type); 1665 1666 /** 1667 * reg_set_afc_soc_dev_deploy_type() - Set AFC soc device deployment type 1668 * @pdev: Pointer to psoc 1669 * @reg_afc_dev_type: afc device deployment type 1670 * 1671 * Return: QDF_STATUS 1672 */ 1673 QDF_STATUS 1674 reg_set_afc_soc_dev_type(struct wlan_objmgr_psoc *psoc, 1675 enum reg_afc_dev_deploy_type reg_afc_dev_type); 1676 1677 /** 1678 * reg_is_sta_connect_allowed() - Check if STA connection is allowed. 1679 * @pdev: Pointer to pdev 1680 * @root_ap_pwr_mode: power mode of the Root AP. 1681 * 1682 * Return: True if STA Vap is allowed to connect. 1683 */ 1684 bool 1685 reg_is_sta_connect_allowed(struct wlan_objmgr_pdev *pdev, 1686 enum reg_6g_ap_type root_ap_pwr_mode); 1687 1688 /** 1689 * reg_get_afc_soc_dev_deploy_type() - Get AFC soc device deployment type 1690 * @pdev: Pointer to psoc 1691 * @reg_afc_dev_type: Pointer to afc device deployment type 1692 * 1693 * Return: QDF_STATUS 1694 */ 1695 QDF_STATUS 1696 reg_get_afc_soc_dev_type(struct wlan_objmgr_psoc *psoc, 1697 enum reg_afc_dev_deploy_type *reg_afc_dev_type); 1698 1699 /** 1700 * reg_set_eirp_preferred_support() - Set EIRP as the preferred 1701 * support for TPC power command 1702 * @psoc: psoc pointer 1703 * @reg_is_eirp_support_preferred: Boolean to indicate if target prefers EIRP 1704 * support for TPC power command 1705 * 1706 * Return: Success or Failure 1707 */ 1708 QDF_STATUS 1709 reg_set_eirp_preferred_support(struct wlan_objmgr_psoc *psoc, 1710 bool reg_is_eirp_support_preferred); 1711 1712 /** 1713 * reg_get_eirp_preferred_support() - Check if is EIRP support is 1714 * preferred by the target for TPC power command 1715 * @psoc: psoc pointer 1716 * @reg_is_eirp_support_preferred: Pointer to reg_is_eirp_support_preferred 1717 * 1718 * Return: Success or Failure 1719 */ 1720 QDF_STATUS 1721 reg_get_eirp_preferred_support(struct wlan_objmgr_psoc *psoc, 1722 bool *reg_is_eirp_support_preferred); 1723 #endif /* CONFIG_AFC_SUPPORT */ 1724 1725 /** 1726 * reg_get_cur_6g_client_type() - Get the current 6G regulatory client Type. 1727 * @pdev: Pointer to PDEV object. 1728 * @reg_cur_6g_client_mobility_type: The current regulatory 6G client type ie. 1729 * default/subordinate. 1730 * 1731 * Return: QDF_STATUS. 1732 */ 1733 QDF_STATUS 1734 reg_get_cur_6g_client_type(struct wlan_objmgr_pdev *pdev, 1735 enum reg_6g_client_type 1736 *reg_cur_6g_client_mobility_type); 1737 1738 /** 1739 * reg_get_rnr_tpe_usable() - Tells if RNR IE is applicable for current domain. 1740 * @pdev: Pointer to PDEV object. 1741 * @reg_rnr_tpe_usable: Pointer to hold the bool value, true if RNR IE is 1742 * applicable, else false. 1743 * 1744 * Return: QDF_STATUS. 1745 */ 1746 QDF_STATUS reg_get_rnr_tpe_usable(struct wlan_objmgr_pdev *pdev, 1747 bool *reg_rnr_tpe_usable); 1748 1749 /** 1750 * reg_get_unspecified_ap_usable() - Tells if AP type unspecified by 802.11 can 1751 * be used or not. 1752 * @pdev: Pointer to PDEV object. 1753 * @reg_unspecified_ap_usable: Pointer to hold the bool value, true if 1754 * unspecified AP types can be used in the IE, else false. 1755 * 1756 * Return: QDF_STATUS. 1757 */ 1758 QDF_STATUS reg_get_unspecified_ap_usable(struct wlan_objmgr_pdev *pdev, 1759 bool *reg_unspecified_ap_usable); 1760 1761 /** 1762 * reg_is_6g_psd_power() - Checks if pdev has PSD power 1763 * 1764 * @pdev: pdev ptr 1765 * 1766 * Return: true if PSD power or false otherwise 1767 */ 1768 bool reg_is_6g_psd_power(struct wlan_objmgr_pdev *pdev); 1769 1770 /** 1771 * reg_get_6g_chan_ap_power() - Finds the TX power for the given channel 1772 * frequency, taking the AP's current power level into account 1773 * 1774 * @pdev: pdev ptr 1775 * @chan_freq: channel frequency 1776 * @is_psd: is channel PSD or not 1777 * @tx_power: transmit power to fill for chan_freq 1778 * @eirp_psd_power: EIRP PSD power, will only be filled if is_psd is true 1779 * 1780 * Return: QDF_STATUS 1781 */ 1782 QDF_STATUS reg_get_6g_chan_ap_power(struct wlan_objmgr_pdev *pdev, 1783 qdf_freq_t chan_freq, bool *is_psd, 1784 uint16_t *tx_power, 1785 uint16_t *eirp_psd_power); 1786 1787 /** 1788 * reg_get_client_power_for_connecting_ap() - Find the channel information when 1789 * device is operating as a client 1790 * 1791 * @pdev: pdev ptr 1792 * @ap_type: type of AP that device is connected to 1793 * @chan_freq: channel frequency 1794 * @is_psd: is channel PSD or not 1795 * @tx_power: transmit power to fill for chan_freq 1796 * @eirp_psd_power: EIRP power, will only be filled if is_psd is true 1797 * 1798 * This function is meant to be called to find the channel frequency power 1799 * information for a client when the device is operating as a client. It will 1800 * fill in the parameters tx_power and eirp_psd_power. eirp_psd_power 1801 * will only be filled if the channel is PSD. 1802 * 1803 * Return: QDF_STATUS 1804 */ 1805 QDF_STATUS reg_get_client_power_for_connecting_ap(struct wlan_objmgr_pdev *pdev, 1806 enum reg_6g_ap_type ap_type, 1807 qdf_freq_t chan_freq, 1808 bool is_psd, 1809 uint16_t *tx_power, 1810 uint16_t *eirp_psd_power); 1811 1812 /** 1813 * reg_get_client_power_for_6ghz_ap() - Find the channel information when 1814 * device is operating as a 6GHz AP 1815 * 1816 * @pdev: pdev ptr 1817 * @client_type: type of client that is connected to our AP 1818 * @chan_freq: channel frequency 1819 * @is_psd: is channel PSD or not 1820 * @tx_power: transmit power to fill for chan_freq 1821 * @eirp_psd_power: EIRP power, will only be filled if is_psd is true 1822 * 1823 * This function is meant to be called to find the channel frequency power 1824 * information for a client when the device is operating as an AP. It will fill 1825 * in the parameter is_psd, tx_power, and eirp_psd_power. eirp_psd_power will 1826 * only be filled if the channel is PSD. 1827 * 1828 * Return: QDF_STATUS 1829 */ 1830 QDF_STATUS reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev *pdev, 1831 enum reg_6g_client_type client_type, 1832 qdf_freq_t chan_freq, 1833 bool *is_psd, uint16_t *tx_power, 1834 uint16_t *eirp_psd_power); 1835 1836 /** 1837 * reg_set_ap_pwr_and_update_chan_list() - Set the AP power mode and recompute 1838 * the current channel list 1839 * 1840 * @pdev: pdev ptr 1841 * @ap_pwr_type: the AP power type to update to 1842 * 1843 * Return: QDF_STATUS 1844 */ 1845 QDF_STATUS reg_set_ap_pwr_and_update_chan_list(struct wlan_objmgr_pdev *pdev, 1846 enum reg_6g_ap_type ap_pwr_type); 1847 1848 /** 1849 * reg_get_6g_chan_psd_eirp_power() - For a given frequency, get the max PSD 1850 * from the mas_chan_list 1851 * @freq: Channel frequency 1852 * @mas_chan_list: Pointer to mas_chan_list 1853 * @reg_psd: Pointer to reg_psd 1854 * 1855 * Return: QDF_STATUS 1856 */ 1857 QDF_STATUS 1858 reg_get_6g_chan_psd_eirp_power(qdf_freq_t freq, 1859 struct regulatory_channel *mas_chan_list, 1860 uint16_t *reg_psd); 1861 1862 /** 1863 * reg_find_txpower_from_6g_list() - For a given frequency, get the max EIRP 1864 * from the mas_chan_list 1865 * @freq: Channel frequency 1866 * @mas_chan_list: Pointer to mas_chan_list 1867 * @reg_eirp: Pointer to reg_eirp 1868 * 1869 * Return: QDF_STATUS 1870 */ 1871 QDF_STATUS 1872 reg_find_txpower_from_6g_list(qdf_freq_t freq, 1873 struct regulatory_channel *chan_list, 1874 uint16_t *reg_eirp); 1875 #else 1876 static inline QDF_STATUS 1877 reg_set_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev, 1878 enum reg_6g_ap_type reg_cur_6g_ap_pwr_type) 1879 { 1880 return QDF_STATUS_E_NOSUPPORT; 1881 } 1882 1883 static inline QDF_STATUS 1884 reg_get_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev, 1885 enum reg_6g_ap_type *reg_cur_6g_ap_pwr_type) 1886 { 1887 *reg_cur_6g_ap_pwr_type = REG_MAX_AP_TYPE; 1888 return QDF_STATUS_E_NOSUPPORT; 1889 } 1890 1891 static inline QDF_STATUS 1892 reg_get_cur_6g_client_type(struct wlan_objmgr_pdev *pdev, 1893 enum reg_6g_client_type 1894 *reg_cur_6g_client_mobility_type) 1895 { 1896 *reg_cur_6g_client_mobility_type = REG_SUBORDINATE_CLIENT; 1897 return QDF_STATUS_E_NOSUPPORT; 1898 } 1899 1900 static inline 1901 QDF_STATUS reg_get_rnr_tpe_usable(struct wlan_objmgr_pdev *pdev, 1902 bool *reg_rnr_tpe_usable) 1903 { 1904 *reg_rnr_tpe_usable = false; 1905 return QDF_STATUS_E_NOSUPPORT; 1906 } 1907 1908 static inline 1909 QDF_STATUS reg_get_unspecified_ap_usable(struct wlan_objmgr_pdev *pdev, 1910 bool *reg_unspecified_ap_usable) 1911 { 1912 *reg_unspecified_ap_usable = false; 1913 return QDF_STATUS_E_NOSUPPORT; 1914 } 1915 1916 static inline 1917 bool reg_is_6g_psd_power(struct wlan_objmgr_pdev *pdev) 1918 { 1919 return false; 1920 } 1921 1922 static inline 1923 QDF_STATUS reg_get_6g_chan_ap_power(struct wlan_objmgr_pdev *pdev, 1924 qdf_freq_t chan_freq, bool *is_psd, 1925 uint16_t *tx_power, 1926 uint16_t *eirp_psd_power) 1927 { 1928 *is_psd = false; 1929 *eirp_psd_power = 0; 1930 *tx_power = 0; 1931 return QDF_STATUS_E_NOSUPPORT; 1932 } 1933 1934 static inline 1935 QDF_STATUS reg_get_client_power_for_connecting_ap(struct wlan_objmgr_pdev *pdev, 1936 enum reg_6g_ap_type ap_type, 1937 qdf_freq_t chan_freq, 1938 bool is_psd, 1939 uint16_t *tx_power, 1940 uint16_t *eirp_psd_power) 1941 { 1942 *tx_power = 0; 1943 *eirp_psd_power = 0; 1944 return QDF_STATUS_E_NOSUPPORT; 1945 } 1946 1947 static inline 1948 QDF_STATUS reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev *pdev, 1949 enum reg_6g_client_type client_type, 1950 qdf_freq_t chan_freq, 1951 bool *is_psd, uint16_t *tx_power, 1952 uint16_t *eirp_psd_power) 1953 { 1954 *is_psd = false; 1955 *tx_power = 0; 1956 *eirp_psd_power = 0; 1957 return QDF_STATUS_E_NOSUPPORT; 1958 } 1959 1960 static inline 1961 QDF_STATUS reg_set_ap_pwr_and_update_chan_list(struct wlan_objmgr_pdev *pdev, 1962 enum reg_6g_ap_type ap_pwr_type) 1963 { 1964 return QDF_STATUS_E_NOSUPPORT; 1965 } 1966 1967 static inline QDF_STATUS 1968 reg_get_6g_chan_psd_eirp_power(qdf_freq_t freq, 1969 struct regulatory_channel *mas_chan_list, 1970 uint16_t *eirp_psd_power) 1971 { 1972 *eirp_psd_power = 0; 1973 return QDF_STATUS_E_NOSUPPORT; 1974 } 1975 1976 static inline QDF_STATUS 1977 reg_find_txpower_from_6g_list(qdf_freq_t freq, 1978 struct regulatory_channel *chan_list, 1979 uint16_t *reg_eirp) 1980 { 1981 *reg_eirp = 0; 1982 return QDF_STATUS_E_NOSUPPORT; 1983 } 1984 #endif 1985 1986 #ifdef CONFIG_HOST_FIND_CHAN 1987 /** 1988 * reg_update_max_phymode_chwidth_for_pdev() - Update the maximum phymode 1989 * and the corresponding chwidth for the pdev. 1990 * @pdev: Pointer to PDEV object. 1991 * 1992 */ 1993 void reg_update_max_phymode_chwidth_for_pdev(struct wlan_objmgr_pdev *pdev); 1994 1995 /** 1996 * reg_modify_chan_list_for_max_chwidth_for_pwrmode() - Update the maximum 1997 * bandwidth for 1998 * each channel in the current channel list. 1999 * @pdev: Pointer to PDEV object. 2000 * @cur_chan_list: Pointer to the pdev current channel list. 2001 * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup. 2002 * 2003 * In countries like DK, the channel 144 is not supported by the regulatory. 2004 * When we get the regulatory rules, the entire UNII-2E's max bandwidth is set 2005 * to 160MHz but this is only true for channel 100 to 128. Channels 132 and 2006 * and 136 will have maximum bandwidth of 40MHz and channel 140 will have a 2007 * max bandwidth value of 20MHz (since 144 is not available). 2008 * These values in the current channel list are not updated based on the 2009 * bonded channels and hence will have an incorrect value for particular 2010 * channels. 2011 * Use this API to update the maximum bandwidth based on the device 2012 * capabilities and the availability of adjacent channels. 2013 */ 2014 void 2015 reg_modify_chan_list_for_max_chwidth_for_pwrmode(struct wlan_objmgr_pdev *pdev, 2016 struct regulatory_channel 2017 *cur_chan_list, 2018 enum supported_6g_pwr_types 2019 in_6g_pwr_mode); 2020 2021 #else 2022 static inline void 2023 reg_update_max_phymode_chwidth_for_pdev(struct wlan_objmgr_pdev *pdev) 2024 { 2025 } 2026 2027 static inline void 2028 reg_modify_chan_list_for_max_chwidth_for_pwrmode(struct wlan_objmgr_pdev *pdev, 2029 struct regulatory_channel 2030 *cur_chan_list, 2031 enum supported_6g_pwr_types 2032 in_6g_pwr_mode) 2033 { 2034 } 2035 #endif /* CONFIG_HOST_FIND_CHAN */ 2036 2037 /** 2038 * reg_is_phymode_unallowed() - Check if requested phymode is unallowed 2039 * @phy_in: phymode that the user requested 2040 * @phymode_bitmap: bitmap of unallowed phymodes for specific country 2041 * 2042 * Return: true if phymode is not allowed, else false 2043 */ 2044 bool reg_is_phymode_unallowed(enum reg_phymode phy_in, uint32_t phymode_bitmap); 2045 2046 /* 2047 * reg_is_regdb_offloaded() - is regdb offloaded 2048 * @psoc: Pointer to psoc object 2049 * 2050 * Return: true if regdb is offloaded, else false 2051 */ 2052 bool reg_is_regdb_offloaded(struct wlan_objmgr_psoc *psoc); 2053 2054 /** 2055 * reg_set_ext_tpc_supported() - Set if FW supports new WMI command for TPC 2056 * @psoc: Pointer to psoc 2057 * @val: value 2058 * 2059 * Return: QDF_STATUS 2060 */ 2061 QDF_STATUS reg_set_ext_tpc_supported(struct wlan_objmgr_psoc *psoc, 2062 bool val); 2063 2064 /** 2065 * reg_is_ext_tpc_supported() - Whether FW supports new WMI command for TPC 2066 * 2067 * @psoc: pointer to psoc 2068 * 2069 * Return: true if FW supports the new TPC command, else false 2070 */ 2071 bool reg_is_ext_tpc_supported(struct wlan_objmgr_psoc *psoc); 2072 2073 /** 2074 * reg_get_bonded_chan_entry() - Fetch the bonded channel pointer given a 2075 * frequency and channel width. 2076 * @freq: Input frequency. 2077 * @chwidth: Input channel width. 2078 * @cen320_freq: center frequency of 320. In 6G band 320Mhz channel are 2079 * overlapping. The exact band should be therefore identified 2080 * by the center frequency of the 320Mhz channel. 2081 * For example: Primary channel 6135 (IEEE37) can be part of either channel 2082 * (A) the 320Mhz channel with center 6105(IEEE31) or 2083 * (B) the 320Mhz channel with center 6265(IEEE63) 2084 * For (A) the start frequency is 5955(IEEE1) whereas for (B) the start 2085 * frequency is 6115(IEEE33) 2086 * 2087 * Return: A valid bonded channel pointer if found, else NULL. 2088 */ 2089 const struct bonded_channel_freq * 2090 reg_get_bonded_chan_entry(qdf_freq_t freq, enum phy_ch_width chwidth, 2091 qdf_freq_t cen320_freq); 2092 2093 /** 2094 * reg_set_2g_channel_params_for_freq() - set the 2.4G bonded channel parameters 2095 * @oper_freq: operating channel 2096 * @ch_params: channel parameters 2097 * @sec_ch_2g_freq: 2.4G secondary channel 2098 * 2099 * Return: void 2100 */ 2101 void reg_set_2g_channel_params_for_freq(struct wlan_objmgr_pdev *pdev, 2102 uint16_t oper_freq, 2103 struct ch_params *ch_params, 2104 uint16_t sec_ch_2g_freq); 2105 2106 /** 2107 * reg_combine_channel_states() - Get minimum of channel state1 and state2 2108 * @chan_state1: Channel state1 2109 * @chan_state2: Channel state2 2110 * 2111 * Return: Channel state 2112 */ 2113 enum channel_state reg_combine_channel_states(enum channel_state chan_state1, 2114 enum channel_state chan_state2); 2115 2116 #if defined(CONFIG_BAND_6GHZ) 2117 /** 2118 * reg_set_lower_6g_edge_ch_supp() - Set if lower 6ghz edge channel is 2119 * supported by FW 2120 * 2121 * @psoc: Pointer to psoc 2122 * @val: value 2123 */ 2124 QDF_STATUS reg_set_lower_6g_edge_ch_supp(struct wlan_objmgr_psoc *psoc, 2125 bool val); 2126 2127 /** 2128 * reg_set_disable_upper_6g_edge_ch_supp() - Set if upper 6ghz edge channel is 2129 * disabled by FW 2130 * 2131 * @psoc: Pointer to psoc 2132 * @val: value 2133 */ 2134 QDF_STATUS 2135 reg_set_disable_upper_6g_edge_ch_supp(struct wlan_objmgr_psoc *psoc, 2136 bool val); 2137 2138 /** 2139 * reg_is_lower_6g_edge_ch_supp() - Check whether 6GHz lower edge channel 2140 * (5935 MHz) is supported. 2141 * @psoc: pointer to psoc 2142 * 2143 * Return: true if edge channels are supported, else false 2144 */ 2145 bool reg_is_lower_6g_edge_ch_supp(struct wlan_objmgr_psoc *psoc); 2146 2147 /** 2148 * reg_is_upper_6g_edge_ch_disabled() - Check whether 6GHz upper edge 2149 * channel (7115 MHz) is disabled. 2150 * @psoc: pointer to psoc 2151 * 2152 * Return: true if edge channels are supported, else false 2153 */ 2154 bool reg_is_upper_6g_edge_ch_disabled(struct wlan_objmgr_psoc *psoc); 2155 2156 /** 2157 * reg_convert_enum_to_6g_idx() - Convert a channel enum between 2158 * MIN_6GHZ_CHANNEL and MAX_6GHZ_CHANNEL, to an index between 0 and 2159 * NUM_6GHZ_CHANNELS 2160 * @ch_idx: Channel index 2161 * 2162 * Return: enum channel_enum 2163 */ 2164 uint16_t reg_convert_enum_to_6g_idx(enum channel_enum ch_idx); 2165 2166 /** 2167 * reg_get_superchan_entry() - Get the address of the super channel list 2168 * entry for a given input channel index. 2169 * 2170 * @pdev: pdev ptr 2171 * @chan_enum: Channel enum 2172 * @p_sup_chan_entry: Pointer to address of *p_sup_chan_entry 2173 * 2174 * Return: QDF_STATUS_SUCCESS if super channel entry is available for the input 2175 * chan_enum else QDF_STATUS_E_FAILURE 2176 */ 2177 QDF_STATUS 2178 reg_get_superchan_entry(struct wlan_objmgr_pdev *pdev, 2179 enum channel_enum chan_enum, 2180 const struct super_chan_info **p_sup_chan_entry); 2181 #else 2182 static inline QDF_STATUS 2183 reg_set_lower_6g_edge_ch_supp(struct wlan_objmgr_psoc *psoc, bool val) 2184 { 2185 return QDF_STATUS_E_NOSUPPORT; 2186 } 2187 2188 static inline QDF_STATUS 2189 reg_set_disable_upper_6g_edge_ch_supp(struct wlan_objmgr_psoc *psoc, 2190 bool val) 2191 { 2192 return QDF_STATUS_E_NOSUPPORT; 2193 } 2194 2195 static inline bool reg_is_lower_6g_edge_ch_supp(struct wlan_objmgr_psoc *psoc) 2196 { 2197 return false; 2198 } 2199 2200 static inline bool 2201 reg_is_upper_6g_edge_ch_disabled(struct wlan_objmgr_psoc *psoc) 2202 { 2203 return false; 2204 } 2205 2206 static inline QDF_STATUS 2207 reg_get_superchan_entry(struct wlan_objmgr_pdev *pdev, 2208 enum channel_enum chan_enum, 2209 const struct super_chan_info **p_sup_chan_entry) 2210 { 2211 return QDF_STATUS_E_NOSUPPORT; 2212 } 2213 2214 static inline uint16_t reg_convert_enum_to_6g_idx(enum channel_enum ch_idx) 2215 { 2216 return INVALID_CHANNEL; 2217 } 2218 #endif 2219 2220 #ifdef FEATURE_WLAN_CH_AVOID_EXT 2221 /** 2222 * reg_process_ch_avoid_ext_event() - Process channel avoid extended event 2223 * @psoc: psoc for country information 2224 * @ch_avoid_event: channel avoid extended event buffer 2225 * 2226 * Return: QDF_STATUS 2227 */ 2228 2229 QDF_STATUS 2230 reg_process_ch_avoid_ext_event(struct wlan_objmgr_psoc *psoc, 2231 struct ch_avoid_ind_type *ch_avoid_event); 2232 /** 2233 * reg_check_coex_unsafe_nb_user_prefer() - get coex unsafe nb 2234 * user prefer ini 2235 * @psoc: pointer to psoc 2236 * 2237 * Return: bool 2238 */ 2239 2240 bool reg_check_coex_unsafe_nb_user_prefer(struct wlan_objmgr_psoc *psoc); 2241 2242 /** 2243 * reg_disable_coex_unsafe_channel() - get reg channel disable for 2244 * for coex unsafe channels 2245 * @psoc: pointer to psoc 2246 * 2247 * Return: bool 2248 */ 2249 2250 bool reg_check_coex_unsafe_chan_reg_disable(struct wlan_objmgr_psoc *psoc); 2251 #else 2252 static inline QDF_STATUS 2253 reg_process_ch_avoid_ext_event(struct wlan_objmgr_psoc *psoc, 2254 struct ch_avoid_ind_type *ch_avoid_event) 2255 { 2256 return QDF_STATUS_SUCCESS; 2257 } 2258 2259 static inline 2260 bool reg_check_coex_unsafe_nb_user_prefer(struct wlan_objmgr_psoc *psoc) 2261 { 2262 return false; 2263 } 2264 2265 static inline 2266 bool reg_check_coex_unsafe_chan_reg_disable(struct wlan_objmgr_psoc *psoc) 2267 { 2268 return false; 2269 } 2270 #endif 2271 2272 #if defined(CONFIG_AFC_SUPPORT) && defined(CONFIG_BAND_6GHZ) 2273 /** 2274 * reg_send_afc_cmd() - Send AFC cmd to the FW 2275 * @pdev: pdev ptr 2276 * @afc_ind_obj: Pointer to hold AFC indication 2277 * 2278 * Return: QDF_STATUS_SUCCESS if the WMI command is sent or QDF_STATUS_E_FAILURE 2279 * otherwise 2280 */ 2281 QDF_STATUS reg_send_afc_cmd(struct wlan_objmgr_pdev *pdev, 2282 struct reg_afc_resp_rx_ind_info *afc_ind_obj); 2283 2284 /** 2285 * reg_is_afc_power_event_received() - Checks if AFC power event is 2286 * received from the FW. 2287 * 2288 * @pdev: pdev ptr 2289 * 2290 * Return: true if AFC power event is received from the FW or false otherwise 2291 */ 2292 bool reg_is_afc_power_event_received(struct wlan_objmgr_pdev *pdev); 2293 2294 /** 2295 * reg_is_afc_done() - Check is AFC response has been received enabling 2296 * the given frequency. 2297 * @pdev: pdev ptr 2298 * @freq: given frequency 2299 * 2300 * Return: True if frequency is enabled, false otherwise 2301 */ 2302 bool reg_is_afc_done(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); 2303 2304 /** 2305 * reg_get_afc_req_id() - Get the AFC request ID 2306 * @pdev: pdev pointer 2307 * @req_id: Pointer to request id 2308 * 2309 * Return: QDF_STATUS 2310 */ 2311 QDF_STATUS reg_get_afc_req_id(struct wlan_objmgr_pdev *pdev, uint64_t *req_id); 2312 2313 /** 2314 * reg_is_afc_expiry_event_received() - Checks if AFC power event is 2315 * received from the FW. 2316 * 2317 * @pdev: pdev ptr 2318 * 2319 * Return: true if AFC expiry event is received from the FW or false otherwise 2320 */ 2321 bool reg_is_afc_expiry_event_received(struct wlan_objmgr_pdev *pdev); 2322 2323 /** 2324 * reg_is_noaction_on_afc_pwr_evt() - Checks if the regulatory module 2325 * needs to take action when AFC power event is received. 2326 * 2327 * @pdev: pdev ptr 2328 * 2329 * Return: true if regulatory should not take any action or false otherwise 2330 */ 2331 bool reg_is_noaction_on_afc_pwr_evt(struct wlan_objmgr_pdev *pdev); 2332 2333 /** 2334 * reg_dmn_set_afc_req_id() - Set the request ID in the AFC partial request 2335 * object 2336 * @afc_req: pointer to AFC partial request 2337 * @req_id: AFC request ID 2338 * 2339 * Return: Void 2340 */ 2341 void reg_dmn_set_afc_req_id(struct wlan_afc_host_partial_request *afc_req, 2342 uint64_t req_id); 2343 #endif 2344 2345 /** 2346 * reg_is_chwidth_supported() - Check if given channel width is supported 2347 * on a given pdev 2348 * @pdev: pdev pointer 2349 * @ch_width: channel width. 2350 * @is_supported: whether the channel width is supported 2351 * 2352 * Return QDF_STATUS_SUCCESS of operation 2353 */ 2354 QDF_STATUS reg_is_chwidth_supported(struct wlan_objmgr_pdev *pdev, 2355 enum phy_ch_width ch_width, 2356 bool *is_supported); 2357 2358 /** 2359 * reg_is_state_allowed() - Check the state of the regulatory channel if it 2360 * is invalid or disabled. 2361 * @chan_state: Channel state. 2362 * 2363 * Return bool: true if the channel is not an invalid channel or disabled 2364 * channel. 2365 */ 2366 bool reg_is_state_allowed(enum channel_state chan_state); 2367 2368 /** 2369 * reg_is_freq_enabled() - Checks if the given frequency is enabled on the given 2370 * power mode or not. If the frequency is not a 6G frequency then the input 2371 * power mode is ignored and only current channel list is searched. 2372 * 2373 * @pdev: pdev pointer. 2374 * @freq: input frequency. 2375 * @in_6g_pwr_mode: Power mode on which the freq is enabled or not is to be 2376 * checked. 2377 * 2378 * Return: True if the frequency is present in the given power mode channel 2379 * list. 2380 */ 2381 bool reg_is_freq_enabled(struct wlan_objmgr_pdev *pdev, 2382 qdf_freq_t freq, 2383 enum supported_6g_pwr_types in_6g_pwr_mode); 2384 2385 /** 2386 * reg_is_freq_idx_enabled() - Checks if the given frequency index is enabled on 2387 * the given power mode or not. If the frequency index is not a 6G frequency 2388 * then the input power mode is ignored and only current channel list is 2389 * searched. 2390 * 2391 * @pdev: pdev pointer. 2392 * @freq_idx: input frequency index. 2393 * @in_6g_pwr_mode: Power mode on which the frequency index is enabled or not 2394 * is to be checked. 2395 * 2396 * Return: True if the frequency index is present in the given power mode 2397 * channel list. 2398 */ 2399 bool reg_is_freq_idx_enabled(struct wlan_objmgr_pdev *pdev, 2400 enum channel_enum freq_idx, 2401 enum supported_6g_pwr_types in_6g_pwr_mode); 2402 2403 /** 2404 * reg_get_best_6g_pwr_type() - Returns the best 6g power type supported for 2405 * a given frequency. 2406 * @pdev: pdev pointer 2407 * @freq: input frequency. 2408 * 2409 * Return: supported_6g_pwr_types enum. 2410 */ 2411 enum supported_6g_pwr_types 2412 reg_get_best_6g_pwr_type(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); 2413 2414 /** 2415 * reg_conv_6g_ap_type_to_supported_6g_pwr_types() - Converts the 6G AP power 2416 * type to 6g supported power type enum. 2417 * @ap_pwr_type: input 6G AP power type. 2418 * 2419 * Return: supported_6g_pwr_types enum. 2420 */ 2421 enum supported_6g_pwr_types 2422 reg_conv_6g_ap_type_to_supported_6g_pwr_types(enum reg_6g_ap_type ap_pwr_type); 2423 2424 /** 2425 * reg_find_chwidth_from_bw () - Gets channel width for given 2426 * bandwidth 2427 * @bw: Bandwidth 2428 * 2429 * Return: phy_ch_width 2430 */ 2431 enum phy_ch_width reg_find_chwidth_from_bw(uint16_t bw); 2432 2433 #ifdef CONFIG_BAND_6GHZ 2434 /** 2435 * reg_get_thresh_priority_freq() - Get the prioritized frequency value 2436 * @pdev: pdev pointer 2437 */ 2438 qdf_freq_t reg_get_thresh_priority_freq(struct wlan_objmgr_pdev *pdev); 2439 2440 /** 2441 * reg_get_best_pwr_mode() - Get the AP's primary channel center frequency and 2442 * AP's operating bandwidth to return the best power mode, which is calculated 2443 * based on the maximum EIRP power among the 3 AP types, i.e, LPI, SP and VLP 2444 * @pdev: Pointer to pdev 2445 * @freq: Primary channel center frequency in MHz 2446 * @cen320: Band center of 320 MHz. (For other BW, this param is ignored during 2447 * processing) 2448 * @bw: AP's operating bandwidth in mhz 2449 * @in_punc_pattern: input puncture bitmap 2450 * 2451 * Return: Best power mode 2452 */ 2453 enum reg_6g_ap_type reg_get_best_pwr_mode(struct wlan_objmgr_pdev *pdev, 2454 qdf_freq_t freq, 2455 qdf_freq_t cen320, 2456 uint16_t bw, 2457 uint16_t in_punc_pattern); 2458 2459 /** 2460 * reg_get_eirp_pwr() - Get eirp power based on the AP power mode 2461 * @pdev: Pointer to pdev 2462 * @freq: Frequency in MHz 2463 * @cen320: 320 MHz Band center frequency 2464 * @bw: Bandwidth in MHz 2465 * @ap_pwr_type: AP power type 2466 * @in_punc_pattern: Input puncture pattern 2467 * 2468 * Return: EIRP power 2469 */ 2470 uint8_t reg_get_eirp_pwr(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq, 2471 qdf_freq_t cen320, 2472 uint16_t bw, enum reg_6g_ap_type ap_pwr_type, 2473 uint16_t in_punc_pattern); 2474 #endif /* CONFIG_BAND_6GHZ */ 2475 2476 /** 2477 * reg_get_5g_chan_state() - Get channel state for 2478 * 5G bonded channel using the channel frequency 2479 * @pdev: Pointer to pdev 2480 * @freq: channel center frequency. 2481 * @bw: channel band width 2482 * @in_6g_pwr_mode: Input power mode which decides the 6G channel list to be 2483 * used. 2484 * @input_puncture_bitmap: Input puncture bitmap 2485 * 2486 * Return: channel state 2487 */ 2488 enum channel_state 2489 reg_get_5g_chan_state(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq, 2490 enum phy_ch_width bw, 2491 enum supported_6g_pwr_types in_6g_pwr_mode, 2492 uint16_t input_puncture_bitmap); 2493 2494 /** 2495 * reg_get_320_bonded_channel_state_for_pwrmode() - Given a bonded channel 2496 * pointer and freq, determine if the subchannels of the bonded pair 2497 * are valid and supported by the current regulatory. 2498 * 2499 * @pdev: Pointer to struct wlan_objmgr_pdev. 2500 * @freq: Frequency in MHZ. 2501 * @bonded_chan_ptr: Pointer to const struct bonded_channel_freq. 2502 * @bw: channel bandwidth 2503 * @out_punc_bitmap: Output puncturing bitmap 2504 * @in_6g_pwr_type: Input 6g power type 2505 * @treat_nol_chan_as_disabled: Bool to treat nol as enabled/disabled 2506 * @input_punc_bitmap: Input puncture bitmap 2507 * 2508 * Return - The channel state of the bonded pair. 2509 */ 2510 #ifdef WLAN_FEATURE_11BE 2511 enum channel_state 2512 reg_get_320_bonded_channel_state_for_pwrmode(struct wlan_objmgr_pdev *pdev, 2513 qdf_freq_t freq, 2514 const struct bonded_channel_freq 2515 *bonded_chan_ptr, 2516 enum phy_ch_width bw, 2517 uint16_t *out_punc_bitmap, 2518 enum supported_6g_pwr_types 2519 in_6g_pwr_type, 2520 bool treat_nol_chan_as_disabled, 2521 uint16_t input_punc_bitmap); 2522 #endif 2523 2524 /** 2525 * reg_is_ch_width_320() - Given a channel width, find out if it is 320MHZ. 2526 * @ch_width: Channel width 2527 * Return - True if ch_width is 320, false otherwise. 2528 */ 2529 bool reg_is_ch_width_320(enum phy_ch_width ch_width); 2530 2531 /** 2532 * reg_fetch_punc_bitmap() - Return the puncture bitmap from the ch_params 2533 * @ch_params: Pointer to struct ch_params 2534 * 2535 * Return: puncture bitmap 2536 */ 2537 #ifdef WLAN_FEATURE_11BE 2538 uint16_t 2539 reg_fetch_punc_bitmap(struct ch_params *ch_params); 2540 #else 2541 static inline uint16_t 2542 reg_fetch_punc_bitmap(struct ch_params *ch_params) 2543 { 2544 return 0; 2545 } 2546 #endif 2547 2548 /** 2549 * reg_get_ch_state_based_on_nol_flag() - Given a channel, find out the 2550 * state of the channel. If "treat_nol_chan_as_disabled" flag is set, nol channels 2551 * are considered disabled, else nol channels are considered enabled. 2552 * @pdev: Pointer to struct wlan_objmgr_pdev 2553 * @freq: Primary frequency 2554 * @treat_nol_chan_as_disabled: Flag to consider nol chan as enabled/disabled. 2555 * @ch_param: pointer to struct ch_params 2556 * @in_6g_pwr_mode: Input 6g power type 2557 * 2558 * Return - Channel state 2559 */ 2560 enum channel_state 2561 reg_get_ch_state_based_on_nol_flag(struct wlan_objmgr_pdev *pdev, 2562 qdf_freq_t freq, 2563 struct ch_params *ch_param, 2564 enum supported_6g_pwr_types 2565 in_6g_pwr_mode, 2566 bool treat_nol_chan_as_disabled); 2567 2568 /** 2569 * reg_get_min_max_bw_reg_chan_list() - Given a frequency index, find out the 2570 * min/max bw of the channel. 2571 * 2572 * @pdev: pdev pointer. 2573 * @freq_idx: input frequency index. 2574 * @in_6g_pwr_mode: Input 6g power type. 2575 * @min_bw: Min bandwidth. 2576 * @max_bw: Max bandwidth 2577 * 2578 * Return: true/false. 2579 */ 2580 QDF_STATUS reg_get_min_max_bw_reg_chan_list(struct wlan_objmgr_pdev *pdev, 2581 enum channel_enum freq_idx, 2582 enum supported_6g_pwr_types 2583 in_6g_pwr_mode, 2584 uint16_t *min_bw, 2585 uint16_t *max_bw); 2586 2587 /** 2588 * reg_get_chan_state() - Given a frequency index, find out the 2589 * state of the channel. 2590 * 2591 * @pdev: pdev pointer. 2592 * @freq_idx: input frequency index. 2593 * @in_6g_pwr_mode: Input 6g power type 2594 * @treat_nol_chan_as_disabled: Bool to treat NOL channels as 2595 * disabled/enabled. 2596 * 2597 * Return: Channel state. 2598 */ 2599 enum channel_state reg_get_chan_state(struct wlan_objmgr_pdev *pdev, 2600 enum channel_enum freq_idx, 2601 enum supported_6g_pwr_types 2602 in_6g_pwr_mode, 2603 bool treat_nol_chan_as_disabled); 2604 2605 /** 2606 * reg_is_chan_disabled() - Check if a channel is disabled or not 2607 * 2608 * @chan_flags: Channel flags 2609 * @chan_state: Channel state 2610 * 2611 * Return: True if channel is disabled else false. 2612 */ 2613 bool reg_is_chan_disabled(uint32_t chan_flags, enum channel_state chan_state); 2614 2615 /** 2616 * reg_get_chan_state_for_320() - Get the channel state of a 320 MHz 2617 * bonded channel. 2618 * @pdev: Pointer to wlan_objmgr_pdev 2619 * @freq: Primary frequency 2620 * @center_320: Band center of 320 MHz 2621 * @ch_width: Channel width 2622 * @bonded_chan_ptr_ptr: Pointer to bonded channel pointer 2623 * @treat_nol_chan_as_disabled: Bool to treat nol chan as enabled/disabled 2624 * @in_pwr_type: Input 6g power type 2625 * @input_punc_bitmap: Input puncture bitmap 2626 * 2627 * Return: Channel state 2628 */ 2629 #ifdef WLAN_FEATURE_11BE 2630 enum channel_state 2631 reg_get_chan_state_for_320(struct wlan_objmgr_pdev *pdev, 2632 uint16_t freq, 2633 qdf_freq_t center_320, 2634 enum phy_ch_width ch_width, 2635 const struct bonded_channel_freq 2636 **bonded_chan_ptr_ptr, 2637 enum supported_6g_pwr_types in_pwr_type, 2638 bool treat_nol_chan_as_disabled, 2639 uint16_t input_punc_bitmap); 2640 #else 2641 static inline enum channel_state 2642 reg_get_chan_state_for_320(struct wlan_objmgr_pdev *pdev, 2643 uint16_t freq, 2644 qdf_freq_t center_320, 2645 enum phy_ch_width ch_width, 2646 const struct bonded_channel_freq 2647 **bonded_chan_ptr_ptr, 2648 enum supported_6g_pwr_types in_pwr_type, 2649 bool treat_nol_chan_as_disabled, 2650 uint16_t input_punc_bitmap) 2651 { 2652 return CHANNEL_STATE_INVALID; 2653 } 2654 #endif 2655 2656 /** 2657 * reg_get_regd_rules() - provides the reg domain rules info 2658 * @pdev: pdev pointer 2659 * @reg_rules: regulatory rules 2660 * 2661 * Return: QDF_STATUS 2662 */ 2663 QDF_STATUS reg_get_regd_rules(struct wlan_objmgr_pdev *pdev, 2664 struct reg_rule_info *reg_rules); 2665 2666 #if defined(CONFIG_AFC_SUPPORT) && defined(CONFIG_BAND_6GHZ) 2667 /** 2668 * reg_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 reg_is_sup_chan_entry_afc_done(struct wlan_objmgr_pdev *pdev, 2679 enum channel_enum chan_idx, 2680 enum supported_6g_pwr_types in_6g_pwr_mode); 2681 #else 2682 static inline bool 2683 reg_is_sup_chan_entry_afc_done(struct wlan_objmgr_pdev *pdev, 2684 enum channel_enum chan_idx, 2685 enum supported_6g_pwr_types in_6g_pwr_mode) 2686 { 2687 return false; 2688 } 2689 #endif 2690 2691 #ifdef CONFIG_BAND_6GHZ 2692 /** 2693 * reg_display_super_chan_list() - Display super channel list for all modes 2694 * @pdev: pdev pointer 2695 * 2696 * Return: QDF_STATUS 2697 */ 2698 QDF_STATUS 2699 reg_display_super_chan_list(struct wlan_objmgr_pdev *pdev); 2700 2701 #if defined(CONFIG_AFC_SUPPORT) && defined(CONFIG_BAND_6GHZ) 2702 /** 2703 * reg_get_afc_freq_range_and_psd_limits() - Get freq range and psd 2704 * limits from afc server response. 2705 * 2706 * @pdev: Pointer to pdev 2707 * @num_freq_obj: Number of frequency objects 2708 * @afc_obj: Pointer to struct afc_freq_obj 2709 * 2710 * Return: QDF_STATUS 2711 */ 2712 2713 QDF_STATUS 2714 reg_get_afc_freq_range_and_psd_limits(struct wlan_objmgr_pdev *pdev, 2715 uint8_t num_freq_obj, 2716 struct afc_freq_obj *afc_obj); 2717 2718 /** 2719 * reg_get_num_afc_freq_obj() - Get number of afc frequency objects 2720 * 2721 * @pdev: Pointer to pdev 2722 * @num_freq_obj: Number of frequency objects 2723 * 2724 * Return: QDF_STATUS 2725 */ 2726 QDF_STATUS 2727 reg_get_num_afc_freq_obj(struct wlan_objmgr_pdev *pdev, uint8_t *num_freq_obj); 2728 #endif 2729 #endif 2730 2731 /** 2732 * reg_get_max_bw_5G_for_fo() - get max bw 2733 * @pdev: PDEV object 2734 * 2735 * API to get max bw from pdev. 2736 * 2737 * Return: max bw 2738 */ 2739 uint16_t reg_get_max_bw_5G_for_fo(struct wlan_objmgr_pdev *pdev); 2740 #endif 2741