1 /* 2 * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. 3 * 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: reg_services.h 22 * This file provides prototypes of the regulatory component 23 * service functions 24 */ 25 26 #ifndef __REG_SERVICES_COMMON_H_ 27 #define __REG_SERVICES_COMMON_H_ 28 29 #define IS_VALID_PSOC_REG_OBJ(psoc_priv_obj) (psoc_priv_obj) 30 #define IS_VALID_PDEV_REG_OBJ(pdev_priv_obj) (pdev_priv_obj) 31 #define FREQ_TO_CHAN_SCALE 5 32 /* The distance between the 80Mhz center and the nearest 20Mhz channel */ 33 #define NEAREST_20MHZ_CHAN_FREQ_OFFSET 10 34 #define NUM_20_MHZ_CHAN_IN_80_MHZ_CHAN 4 35 #define NUM_20_MHZ_CHAN_IN_160_MHZ_CHAN 8 36 37 #ifdef CONFIG_CHAN_NUM_API 38 #define REG_MIN_24GHZ_CH_NUM channel_map[MIN_24GHZ_CHANNEL].chan_num 39 #define REG_MAX_24GHZ_CH_NUM channel_map[MAX_24GHZ_CHANNEL].chan_num 40 #define REG_MIN_5GHZ_CH_NUM channel_map[MIN_5GHZ_CHANNEL].chan_num 41 #define REG_MAX_5GHZ_CH_NUM channel_map[MAX_5GHZ_CHANNEL].chan_num 42 43 #define REG_IS_24GHZ_CH(chan_num) \ 44 (((chan_num) >= REG_MIN_24GHZ_CH_NUM) && \ 45 ((chan_num) <= REG_MAX_24GHZ_CH_NUM)) 46 #endif /* CONFIG_CHAN_NUM_API */ 47 48 #define REG_MIN_24GHZ_CH_FREQ channel_map[MIN_24GHZ_CHANNEL].center_freq 49 #define REG_MAX_24GHZ_CH_FREQ channel_map[MAX_24GHZ_CHANNEL].center_freq 50 51 #define REG_IS_24GHZ_CH_FREQ(freq) \ 52 (((freq) >= REG_MIN_24GHZ_CH_FREQ) && \ 53 ((freq) <= REG_MAX_24GHZ_CH_FREQ)) 54 55 #ifdef CONFIG_CHAN_FREQ_API 56 #define REG_MIN_5GHZ_CH_FREQ channel_map[MIN_5GHZ_CHANNEL].center_freq 57 #define REG_MAX_5GHZ_CH_FREQ channel_map[MAX_5GHZ_CHANNEL].center_freq 58 #endif /* CONFIG_CHAN_FREQ_API */ 59 60 #ifdef CONFIG_49GHZ_CHAN 61 #define REG_MIN_49GHZ_CH_FREQ channel_map[MIN_49GHZ_CHANNEL].center_freq 62 #define REG_MAX_49GHZ_CH_FREQ channel_map[MAX_49GHZ_CHANNEL].center_freq 63 #else 64 #define REG_MIN_49GHZ_CH_FREQ 0 65 #define REG_MAX_49GHZ_CH_FREQ 0 66 #endif /* CONFIG_49GHZ_CHAN */ 67 68 #define REG_IS_49GHZ_FREQ(freq) \ 69 (((freq) >= REG_MIN_49GHZ_CH_FREQ) && \ 70 ((freq) <= REG_MAX_49GHZ_CH_FREQ)) 71 72 #ifdef CONFIG_CHAN_NUM_API 73 #define REG_IS_5GHZ_CH(chan_num) \ 74 (((chan_num) >= REG_MIN_5GHZ_CH_NUM) && \ 75 ((chan_num) <= REG_MAX_5GHZ_CH_NUM)) 76 #endif /* CONFIG_CHAN_NUM_API */ 77 78 #define REG_IS_5GHZ_FREQ(freq) \ 79 (((freq) >= channel_map[MIN_5GHZ_CHANNEL].center_freq) && \ 80 ((freq) <= channel_map[MAX_5GHZ_CHANNEL].center_freq)) 81 82 /* 83 * It should be 2.5 MHz actually but since we are using integer use 2 84 * instead, which does not create any problem in the start edge calculation. 85 */ 86 #define HALF_5MHZ_BW 2 87 #define HALF_20MHZ_BW 10 88 89 #define TWO_GIG_STARTING_EDGE_FREQ (channel_map_global[MIN_24GHZ_CHANNEL]. \ 90 center_freq - HALF_20MHZ_BW) 91 #define TWO_GIG_ENDING_EDGE_FREQ (channel_map_global[MAX_24GHZ_CHANNEL]. \ 92 center_freq + HALF_20MHZ_BW) 93 #ifdef CONFIG_49GHZ_CHAN 94 #define FIVE_GIG_STARTING_EDGE_FREQ (channel_map_global[MIN_49GHZ_CHANNEL]. \ 95 center_freq - HALF_5MHZ_BW) 96 #else 97 #define FIVE_GIG_STARTING_EDGE_FREQ (channel_map_global[MIN_5GHZ_CHANNEL]. \ 98 center_freq - HALF_20MHZ_BW) 99 #endif /* CONFIG_49GHZ_CHAN */ 100 #define FIVE_GIG_ENDING_EDGE_FREQ (channel_map_global[MAX_5GHZ_CHANNEL]. \ 101 center_freq + HALF_20MHZ_BW) 102 103 #ifdef CONFIG_BAND_6GHZ 104 #define SIX_GIG_STARTING_EDGE_FREQ (channel_map_global[MIN_6GHZ_CHANNEL]. \ 105 center_freq - HALF_20MHZ_BW) 106 #define SIX_GIG_ENDING_EDGE_FREQ (channel_map_global[MAX_6GHZ_CHANNEL]. \ 107 center_freq + HALF_20MHZ_BW) 108 109 #define FREQ_LEFT_SHIFT 55 110 #define SIX_GHZ_NON_ORPHAN_START_FREQ \ 111 (channel_map_global[MIN_6GHZ_NON_ORPHAN_CHANNEL].center_freq - 5) 112 #define CHAN_FREQ_5935 5935 113 #define NUM_80MHZ_BAND_IN_6G 16 114 #define NUM_PSC_FREQ 15 115 #define PSC_BAND_MHZ (FREQ_TO_CHAN_SCALE * NUM_80MHZ_BAND_IN_6G) 116 #define REG_MIN_6GHZ_CHAN_FREQ channel_map[MIN_6GHZ_CHANNEL].center_freq 117 #define REG_MAX_6GHZ_CHAN_FREQ channel_map[MAX_6GHZ_CHANNEL].center_freq 118 #else 119 #define FREQ_LEFT_SHIFT 0 120 #define SIX_GHZ_NON_ORPHAN_START_FREQ 0 121 #define CHAN_FREQ_5935 0 122 #define NUM_80MHZ_BAND_IN_6G 0 123 #define NUM_PSC_FREQ 0 124 #define PSC_BAND_MHZ (FREQ_TO_CHAN_SCALE * NUM_80MHZ_BAND_IN_6G) 125 #define REG_MIN_6GHZ_CHAN_FREQ 0 126 #define REG_MAX_6GHZ_CHAN_FREQ 0 127 #endif /*CONFIG_BAND_6GHZ*/ 128 129 #define REG_CH_NUM(ch_enum) channel_map[ch_enum].chan_num 130 #define REG_CH_TO_FREQ(ch_enum) channel_map[ch_enum].center_freq 131 132 /* EEPROM setting is a country code */ 133 #define COUNTRY_ERD_FLAG 0x8000 134 #define MIN_6GHZ_OPER_CLASS 131 135 #define MAX_6GHZ_OPER_CLASS 136 136 137 extern const struct chan_map *channel_map; 138 extern const struct chan_map channel_map_us[]; 139 extern const struct chan_map channel_map_eu[]; 140 extern const struct chan_map channel_map_jp[]; 141 extern const struct chan_map channel_map_china[]; 142 extern const struct chan_map channel_map_global[]; 143 144 #ifdef CONFIG_CHAN_NUM_API 145 /** 146 * reg_get_chan_enum() - Get channel enum for given channel number 147 * @chan_num: Channel number 148 * 149 * Return: Channel enum 150 */ 151 enum channel_enum reg_get_chan_enum(uint8_t chan_num); 152 153 /** 154 * reg_get_channel_state() - Get channel state from regulatory 155 * @pdev: Pointer to pdev 156 * @ch: channel number. 157 * 158 * Return: channel state 159 */ 160 enum channel_state reg_get_channel_state(struct wlan_objmgr_pdev *pdev, 161 uint8_t ch); 162 163 /** 164 * reg_get_5g_bonded_channel() - get the 5G bonded channel state 165 * @pdev: Pointer to pdev structure 166 * @chan_num: channel number 167 * @ch_width: channel width 168 * @bonded_chan_ptr_ptr: bonded channel ptr ptr 169 * 170 * Return: channel state 171 */ 172 enum channel_state reg_get_5g_bonded_channel( 173 struct wlan_objmgr_pdev *pdev, uint8_t chan_num, 174 enum phy_ch_width ch_width, 175 const struct bonded_channel **bonded_chan_ptr_ptr); 176 177 /** 178 * reg_get_5g_bonded_channel_state() - Get channel state for 5G bonded channel 179 * @pdev: Pointer to pdev 180 * @ch: channel number. 181 * @bw: channel band width 182 * 183 * Return: channel state 184 */ 185 enum channel_state reg_get_5g_bonded_channel_state( 186 struct wlan_objmgr_pdev *pdev, uint8_t ch, 187 enum phy_ch_width bw); 188 189 /** 190 * reg_get_2g_bonded_channel_state() - Get channel state for 2G bonded channel 191 * @ch: channel number. 192 * @pdev: Pointer to pdev 193 * @oper_ch: Primary channel number 194 * @sec_ch: Secondary channel number 195 * @bw: channel band width 196 * 197 * Return: channel state 198 */ 199 enum channel_state reg_get_2g_bonded_channel_state( 200 struct wlan_objmgr_pdev *pdev, uint8_t oper_ch, uint8_t sec_ch, 201 enum phy_ch_width bw); 202 203 /** 204 * reg_set_channel_params () - Sets channel parameteres for given bandwidth 205 * @pdev: Pointer to pdev 206 * @ch: channel number. 207 * @sec_ch_2g: Secondary 2G channel 208 * @ch_params: pointer to the channel parameters. 209 * 210 * Return: None 211 */ 212 void reg_set_channel_params(struct wlan_objmgr_pdev *pdev, 213 uint8_t ch, uint8_t sec_ch_2g, 214 struct ch_params *ch_params); 215 216 /** 217 * reg_is_disable_ch() - Check if the given channel in disable state 218 * @pdev: Pointer to pdev 219 * @chan: channel number 220 * 221 * Return: True if channel state is disabled, else false 222 */ 223 bool reg_is_disable_ch(struct wlan_objmgr_pdev *pdev, uint8_t chan); 224 #endif /* CONFIG_CHAN_NUM_API */ 225 226 /** 227 * reg_read_default_country() - Get the default regulatory country 228 * @psoc: The physical SoC to get default country from 229 * @country_code: the buffer to populate the country code into 230 * 231 * Return: QDF_STATUS 232 */ 233 QDF_STATUS reg_read_default_country(struct wlan_objmgr_psoc *psoc, 234 uint8_t *country_code); 235 236 /** 237 * reg_get_ctry_idx_max_bw_from_country_code() - Get the max 5G bandwidth 238 * from country code 239 * @cc : Country Code 240 * @max_bw_5g : Max 5G bandwidth supported by the country 241 * 242 * Return : QDF_STATUS 243 */ 244 245 QDF_STATUS reg_get_max_5g_bw_from_country_code(uint16_t cc, 246 uint16_t *max_bw_5g); 247 248 /** 249 * reg_get_max_5g_bw_from_regdomain() - Get the max 5G bandwidth 250 * supported by the regdomain 251 * @orig_regdmn : Regdomain pair value 252 * @max_bw_5g : Max 5G bandwidth supported by the country 253 * 254 * Return : QDF_STATUS 255 */ 256 257 QDF_STATUS reg_get_max_5g_bw_from_regdomain(uint16_t regdmn, 258 uint16_t *max_bw_5g); 259 260 /** 261 * reg_get_current_dfs_region () - Get the current dfs region 262 * @pdev: Pointer to pdev 263 * @dfs_reg: pointer to dfs region 264 * 265 * Return: None 266 */ 267 void reg_get_current_dfs_region(struct wlan_objmgr_pdev *pdev, 268 enum dfs_reg *dfs_reg); 269 270 #ifdef CONFIG_CHAN_NUM_API 271 /** 272 * reg_get_channel_reg_power() - Get the txpower for the given channel 273 * @pdev: Pointer to pdev 274 * @chan_num: Channel number 275 * 276 * Return: txpower 277 */ 278 uint32_t reg_get_channel_reg_power(struct wlan_objmgr_pdev *pdev, 279 uint8_t chan_num); 280 281 /** 282 * reg_get_channel_freq() - Get the channel frequency 283 * @pdev: Pointer to pdev 284 * @chan_num: Channel number 285 * 286 * Return: frequency 287 */ 288 qdf_freq_t reg_get_channel_freq(struct wlan_objmgr_pdev *pdev, 289 uint8_t chan_num); 290 #endif /* CONFIG_CHAN_NUM_API */ 291 292 /** 293 * reg_get_bw_value() - give bandwidth value 294 * bw: bandwidth enum 295 * 296 * Return: uint16_t 297 */ 298 uint16_t reg_get_bw_value(enum phy_ch_width bw); 299 300 /** 301 * reg_set_dfs_region () - Set the current dfs region 302 * @pdev: Pointer to pdev 303 * @dfs_reg: pointer to dfs region 304 * 305 * Return: None 306 */ 307 void reg_set_dfs_region(struct wlan_objmgr_pdev *pdev, 308 enum dfs_reg dfs_reg); 309 310 #ifdef CONFIG_CHAN_NUM_API 311 /** 312 * reg_chan_to_band() - Get band from channel number 313 * @chan_num: channel number 314 * 315 * Return: band info 316 */ 317 enum band_info reg_chan_to_band(uint8_t chan_num); 318 #endif /* CONFIG_CHAN_NUM_API */ 319 320 /** 321 * reg_program_chan_list() - Set user country code and populate the channel list 322 * @pdev: Pointer to pdev 323 * @rd: Pointer to cc_regdmn_s structure 324 * 325 * Return: QDF_STATUS 326 */ 327 QDF_STATUS reg_program_chan_list(struct wlan_objmgr_pdev *pdev, 328 struct cc_regdmn_s *rd); 329 330 #ifdef CONFIG_CHAN_NUM_API 331 /** 332 * reg_update_nol_ch () - Updates NOL channels in current channel list 333 * @pdev: pointer to pdev object 334 * @ch_list: pointer to NOL channel list 335 * @num_ch: No.of channels in list 336 * @update_nol: set/reset the NOL status 337 * 338 * Return: None 339 */ 340 void reg_update_nol_ch(struct wlan_objmgr_pdev *pdev, uint8_t *chan_list, 341 uint8_t num_chan, bool nol_chan); 342 343 /** 344 * reg_is_dfs_ch () - Checks the channel state for DFS 345 * @pdev: pdev ptr 346 * @chan: channel 347 * 348 * Return: true or false 349 */ 350 bool reg_is_dfs_ch(struct wlan_objmgr_pdev *pdev, uint8_t chan); 351 #endif /* CONFIG_CHAN_NUM_API */ 352 353 /** 354 * reg_freq_to_chan() - Get channel number from frequency. 355 * @pdev: Pointer to pdev 356 * @freq: Channel frequency 357 * 358 * Return: Channel number if success, otherwise 0 359 */ 360 uint8_t reg_freq_to_chan(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); 361 362 /** 363 * reg_chan_to_freq() - Get frequency from channel number 364 * @pdev: Pointer to pdev 365 * @chan_num: Channel number 366 * 367 * Return: Channel frequency if success, otherwise 0 368 */ 369 qdf_freq_t reg_chan_to_freq(struct wlan_objmgr_pdev *pdev, uint8_t chan_num); 370 371 /** 372 * reg_legacy_chan_to_freq() - Get freq from chan noumber, for 2G and 5G 373 * @pdev: Pointer to pdev 374 * @chan_num: Channel number 375 * 376 * Return: Channel frequency if success, otherwise 0 377 */ 378 uint16_t reg_legacy_chan_to_freq(struct wlan_objmgr_pdev *pdev, 379 uint8_t chan_num); 380 381 #ifdef CONFIG_CHAN_NUM_API 382 /** 383 * reg_chan_is_49ghz() - Check if the input channel number is 4.9GHz 384 * @pdev: Pdev pointer 385 * @chan_num: Input channel number 386 * 387 * Return: true if the channel is 4.9GHz else false. 388 */ 389 bool reg_chan_is_49ghz(struct wlan_objmgr_pdev *pdev, uint8_t chan_num); 390 #endif /* CONFIG_CHAN_NUM_API */ 391 392 /** 393 * reg_program_default_cc() - Program default country code 394 * @pdev: Pdev pointer 395 * @regdmn: Regdomain value 396 * 397 * Return: QDF_STATUS 398 */ 399 QDF_STATUS reg_program_default_cc(struct wlan_objmgr_pdev *pdev, 400 uint16_t regdmn); 401 402 /** 403 * reg_get_current_cc() - Get current country code 404 * @pdev: Pdev pointer 405 * @regdmn: Pointer to get current country values 406 * 407 * Return: QDF_STATUS 408 */ 409 QDF_STATUS reg_get_current_cc(struct wlan_objmgr_pdev *pdev, 410 struct cc_regdmn_s *rd); 411 412 /** 413 * reg_set_regdb_offloaded() - set/clear regulatory offloaded flag 414 * 415 * @psoc: psoc pointer 416 * Return: Success or Failure 417 */ 418 QDF_STATUS reg_set_regdb_offloaded(struct wlan_objmgr_psoc *psoc, bool val); 419 420 /** 421 * reg_get_curr_regdomain() - Get current regdomain in use 422 * @pdev: pdev pointer 423 * @cur_regdmn: Current regdomain info 424 * 425 * Return: QDF status 426 */ 427 QDF_STATUS reg_get_curr_regdomain(struct wlan_objmgr_pdev *pdev, 428 struct cur_regdmn_info *cur_regdmn); 429 430 /** 431 * reg_modify_chan_144() - Enable/Disable channel 144 432 * @pdev: pdev pointer 433 * @en_chan_144: flag to disable/enable channel 144 434 * 435 * Return: Success or Failure 436 */ 437 QDF_STATUS reg_modify_chan_144(struct wlan_objmgr_pdev *pdev, bool en_chan_144); 438 439 /** 440 * reg_get_en_chan_144() - get en_chan_144 flag value 441 * @pdev: pdev pointer 442 * 443 * Return: en_chan_144 flag value 444 */ 445 bool reg_get_en_chan_144(struct wlan_objmgr_pdev *pdev); 446 447 /** 448 * reg_get_hal_reg_cap() - Get HAL REG capabilities 449 * @psoc: psoc for country information 450 * 451 * Return: hal reg cap pointer 452 */ 453 struct wlan_psoc_host_hal_reg_capabilities_ext *reg_get_hal_reg_cap( 454 struct wlan_objmgr_psoc *psoc); 455 456 /** 457 * reg_set_hal_reg_cap() - Set HAL REG capabilities 458 * @psoc: psoc for country information 459 * @reg_cap: Regulatory caps pointer 460 * @phy_cnt: number of phy 461 * 462 * Return: hal reg cap pointer 463 */ 464 QDF_STATUS reg_set_hal_reg_cap( 465 struct wlan_objmgr_psoc *psoc, 466 struct wlan_psoc_host_hal_reg_capabilities_ext *reg_cap, 467 uint16_t phy_cnt); 468 469 /** 470 * reg_update_hal_reg_cap() - Update HAL REG capabilities 471 * @psoc: psoc pointer 472 * @wireless_modes: 11AX wireless modes 473 * @phy_id: phy id 474 * 475 * Return: QDF_STATUS 476 */ 477 QDF_STATUS reg_update_hal_reg_cap(struct wlan_objmgr_psoc *psoc, 478 uint32_t wireless_modes, uint8_t phy_id); 479 480 /** 481 * reg_chan_in_range() - Check if the given channel is in pdev's channel range 482 * @chan_list: Pointer to regulatory channel list. 483 * @low_freq_2g: Low frequency 2G. 484 * @high_freq_2g: High frequency 2G. 485 * @low_freq_5g: Low frequency 5G. 486 * @high_freq_5g: High frequency 5G. 487 * @ch_enum: Channel enum. 488 * 489 * Return: true if ch_enum is with in pdev's channel range, else false. 490 */ 491 bool reg_chan_in_range(struct regulatory_channel *chan_list, 492 qdf_freq_t low_freq_2g, qdf_freq_t high_freq_2g, 493 qdf_freq_t low_freq_5g, qdf_freq_t high_freq_5g, 494 enum channel_enum ch_enum); 495 496 /** 497 * reg_init_channel_map() - Initialize the channel list based on the dfs region. 498 * @dfs_region: Dfs region 499 */ 500 void reg_init_channel_map(enum dfs_reg dfs_region); 501 502 /** 503 * reg_get_psoc_tx_ops() - Get regdb tx ops 504 * @psoc: Pointer to psoc structure 505 */ 506 struct wlan_lmac_if_reg_tx_ops *reg_get_psoc_tx_ops( 507 struct wlan_objmgr_psoc *psoc); 508 509 #ifdef CONFIG_CHAN_NUM_API 510 /** 511 * reg_update_nol_history_ch() - Set nol-history flag for the channels in the 512 * list. 513 * @pdev: Pdev ptr. 514 * @ch_list: Input channel list. 515 * @num_ch: Number of channels. 516 * @nol_history_ch: NOL-History flag. 517 * 518 * Return: void 519 */ 520 void reg_update_nol_history_ch(struct wlan_objmgr_pdev *pdev, 521 uint8_t *chan_list, 522 uint8_t num_chan, 523 bool nol_history_chan); 524 525 /** 526 * reg_is_24ghz_ch() - Check if the given channel number is 2.4GHz 527 * @chan: Channel number 528 * 529 * Return: true if channel number is 2.4GHz, else false 530 */ 531 bool reg_is_24ghz_ch(uint32_t chan); 532 533 /** 534 * reg_is_5ghz_ch() - Check if the given channel number is 5GHz 535 * @chan: Channel number 536 * 537 * Return: true if channel number is 5GHz, else false 538 */ 539 bool reg_is_5ghz_ch(uint32_t chan); 540 #endif /* CONFIG_CHAN_NUM_API */ 541 542 /** 543 * reg_is_24ghz_ch_freq() - Check if the given channel frequency is 2.4GHz 544 * @freq: Channel frequency 545 * 546 * Return: true if channel frequency is 2.4GHz, else false 547 */ 548 bool reg_is_24ghz_ch_freq(uint32_t freq); 549 550 /** 551 * reg_is_5ghz_ch_freq() - Check if the given channel frequency is 5GHz 552 * @freq: Channel frequency 553 * 554 * Return: true if channel frequency is 5GHz, else false 555 */ 556 bool reg_is_5ghz_ch_freq(uint32_t freq); 557 558 /** 559 * reg_is_range_overlap_2g() - Check if the given low_freq and high_freq 560 * is in the 2G range. 561 * 562 * @low_freq - Low frequency. 563 * @high_freq - High frequency. 564 * 565 * Return: Return true if given low_freq and high_freq overlaps 2G range, 566 * else false. 567 */ 568 bool reg_is_range_overlap_2g(qdf_freq_t low_freq, qdf_freq_t high_freq); 569 570 /** 571 * reg_is_range_overlap_5g() - Check if the given low_freq and high_freq 572 * is in the 5G range. 573 * 574 * @low_freq - Low frequency. 575 * @high_freq - High frequency. 576 * 577 * Return: Return true if given low_freq and high_freq overlaps 5G range, 578 * else false. 579 */ 580 bool reg_is_range_overlap_5g(qdf_freq_t low_freq, qdf_freq_t high_freq); 581 582 #ifdef CONFIG_BAND_6GHZ 583 /** 584 * reg_is_6ghz_chan_freq() - Check if the given channel frequency is 6GHz 585 * @freq: Channel frequency 586 * 587 * Return: true if channel frequency is 6GHz, else false 588 */ 589 bool reg_is_6ghz_chan_freq(uint16_t freq); 590 591 #ifdef CONFIG_6G_FREQ_OVERLAP 592 /** 593 * reg_is_range_only6g() - Check if the given low_freq and high_freq is only in 594 * the 6G range. 595 * 596 * @low_freq - Low frequency. 597 * @high_freq - High frequency. 598 * 599 * Return: Return true if given low_freq and high_freq overlaps only the 6G 600 * range, else false. 601 */ 602 bool reg_is_range_only6g(qdf_freq_t low_freq, qdf_freq_t high_freq); 603 604 /** 605 * reg_is_range_overlap_6g() - Check if the given low_freq and high_freq 606 * is in the 6G range. 607 * 608 * @low_freq - Low frequency. 609 * @high_freq - High frequency. 610 * 611 * Return: Return true if given low_freq and high_freq overlaps 6G range, 612 * else false. 613 */ 614 bool reg_is_range_overlap_6g(qdf_freq_t low_freq, qdf_freq_t high_freq); 615 #endif 616 617 /** 618 * REG_IS_6GHZ_FREQ() - Check if the given channel frequency is 6GHz 619 * @freq: Channel frequency 620 * 621 * Return: true if channel frequency is 6GHz, else false 622 */ 623 static inline bool REG_IS_6GHZ_FREQ(uint16_t freq) 624 { 625 return ((freq >= REG_MIN_6GHZ_CHAN_FREQ) && 626 (freq <= REG_MAX_6GHZ_CHAN_FREQ)); 627 } 628 629 /** 630 * reg_is_6ghz_psc_chan_freq() - Check if the given 6GHz channel frequency is 631 * preferred scanning channel frequency. 632 * @freq: Channel frequency 633 * 634 * Return: true if given 6GHz channel frequency is preferred scanning channel 635 * frequency, else false 636 */ 637 bool reg_is_6ghz_psc_chan_freq(uint16_t freq); 638 639 /** 640 * reg_is_6g_freq_indoor() - Check if a 6GHz frequency is indoor. 641 * @pdev: Pointer to pdev. 642 * @freq: Channel frequency. 643 * 644 * Return: Return true if a 6GHz frequency is indoor, else false. 645 */ 646 bool reg_is_6g_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); 647 648 /** 649 * reg_get_max_txpower_for_6g_tpe() - Get max txpower for 6G TPE IE. 650 * @pdev: Pointer to pdev. 651 * @freq: Channel frequency. 652 * @bw: Channel bandwidth. 653 * @reg_ap: Regulatory 6G AP type. 654 * @reg_client: Regulatory 6G client type. 655 * @is_psd: True if txpower is needed in PSD format, and false if needed in EIRP 656 * format. 657 * @tx_power: Pointer to tx-power. 658 * 659 * Return: Return QDF_STATUS_SUCCESS, if tx_power is filled for 6G TPE IE 660 * else return QDF_STATUS_E_FAILURE. 661 */ 662 QDF_STATUS reg_get_max_txpower_for_6g_tpe(struct wlan_objmgr_pdev *pdev, 663 qdf_freq_t freq, uint8_t bw, 664 enum reg_6g_ap_type reg_ap, 665 enum reg_6g_client_type reg_client, 666 bool is_psd, 667 uint8_t *tx_power); 668 669 /** 670 * reg_min_6ghz_chan_freq() - Get minimum 6GHz channel center frequency 671 * 672 * Return: Minimum 6GHz channel center frequency 673 */ 674 uint16_t reg_min_6ghz_chan_freq(void); 675 676 /** 677 * reg_max_6ghz_chan_freq() - Get maximum 6GHz channel center frequency 678 * 679 * Return: Maximum 6GHz channel center frequency 680 */ 681 uint16_t reg_max_6ghz_chan_freq(void); 682 #else 683 static inline bool reg_is_6ghz_chan_freq(uint16_t freq) 684 { 685 return false; 686 } 687 688 static inline bool 689 reg_is_6g_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq) 690 { 691 return false; 692 } 693 694 static inline QDF_STATUS 695 reg_get_max_txpower_for_6g_tpe(struct wlan_objmgr_pdev *pdev, 696 qdf_freq_t freq, uint8_t bw, 697 enum reg_6g_ap_type reg_ap, 698 enum reg_6g_client_type reg_client, 699 bool is_psd, 700 uint8_t *tx_power) 701 { 702 return QDF_STATUS_E_FAILURE; 703 } 704 705 #ifdef CONFIG_6G_FREQ_OVERLAP 706 static inline bool reg_is_range_overlap_6g(qdf_freq_t low_freq, 707 qdf_freq_t high_freq) 708 { 709 return false; 710 } 711 712 static inline bool reg_is_range_only6g(qdf_freq_t low_freq, 713 qdf_freq_t high_freq) 714 { 715 return false; 716 } 717 #endif 718 719 static inline bool REG_IS_6GHZ_FREQ(uint16_t freq) 720 { 721 return false; 722 } 723 724 static inline bool reg_is_6ghz_psc_chan_freq(uint16_t freq) 725 { 726 return false; 727 } 728 729 static inline uint16_t reg_min_6ghz_chan_freq(void) 730 { 731 return 0; 732 } 733 734 static inline uint16_t reg_max_6ghz_chan_freq(void) 735 { 736 return 0; 737 } 738 #endif /* CONFIG_BAND_6GHZ */ 739 740 /** 741 * reg_get_band_channel_list() - Get the channel list and number of channels 742 * @pdev: pdev ptr 743 * @band_mask: Input bitmap with band set 744 * @channel_list: Pointer to Channel List 745 * 746 * Get the given channel list and number of channels from the current channel 747 * list based on input band bitmap. 748 * 749 * Return: Number of channels, else 0 to indicate error 750 */ 751 uint16_t reg_get_band_channel_list(struct wlan_objmgr_pdev *pdev, 752 uint8_t band_mask, 753 struct regulatory_channel *channel_list); 754 755 /** 756 * reg_chan_band_to_freq - Return channel frequency based on the channel number 757 * and band. 758 * @pdev: pdev ptr 759 * @chan: Channel Number 760 * @band_mask: Bitmap for bands 761 * 762 * Return: Return channel frequency or return 0, if the channel is disabled or 763 * if the input channel number or band_mask is invalid. Composite bands are 764 * supported only for 2.4Ghz and 5Ghz bands. For other bands the following 765 * priority is given: 1) 6Ghz 2) 5Ghz 3) 2.4Ghz. 766 */ 767 qdf_freq_t reg_chan_band_to_freq(struct wlan_objmgr_pdev *pdev, 768 uint8_t chan, 769 uint8_t band_mask); 770 771 /** 772 * reg_is_49ghz_freq() - Check if the given channel frequency is 4.9GHz 773 * @freq: Channel frequency 774 * 775 * Return: true if channel frequency is 4.9GHz, else false 776 */ 777 bool reg_is_49ghz_freq(qdf_freq_t freq); 778 779 /** 780 * reg_ch_num() - Get channel number from channel enum 781 * @ch_enum: Channel enum 782 * 783 * Return: channel number 784 */ 785 qdf_freq_t reg_ch_num(uint32_t ch_enum); 786 787 /** 788 * reg_ch_to_freq() - Get channel frequency from channel enum 789 * @ch_enum: Channel enum 790 * 791 * Return: channel frequency 792 */ 793 qdf_freq_t reg_ch_to_freq(uint32_t ch_enum); 794 795 #ifdef CONFIG_CHAN_NUM_API 796 /** 797 * reg_is_same_band_channels() - Check if given channel numbers have same band 798 * @chan_num1: Channel number1 799 * @chan_num2: Channel number2 800 * 801 * Return: true if both the channels has the same band. 802 */ 803 bool reg_is_same_band_channels(uint8_t chan_num1, uint8_t chan_num2); 804 805 /** 806 * reg_is_channel_valid_5g_sbs() Check if the given channel is 5G SBS. 807 * @curchan: current channel 808 * @newchan:new channel 809 * 810 * Return: true if the given channel is a valid 5G SBS 811 */ 812 bool reg_is_channel_valid_5g_sbs(uint8_t curchan, uint8_t newchan); 813 814 /** 815 * reg_min_24ghz_ch_num() - Get minimum 2.4GHz channel number 816 * 817 * Return: Minimum 2.4GHz channel number 818 */ 819 uint8_t reg_min_24ghz_ch_num(void); 820 821 /** 822 * reg_max_24ghz_ch_num() - Get maximum 2.4GHz channel number 823 * 824 * Return: Maximum 2.4GHz channel number 825 */ 826 uint8_t reg_max_24ghz_ch_num(void); 827 828 /** 829 * reg_min_5ghz_ch_num() - Get minimum 5GHz channel number 830 * 831 * Return: Minimum 5GHz channel number 832 */ 833 uint8_t reg_min_5ghz_ch_num(void); 834 835 /** 836 * reg_max_5ghz_ch_num() - Get maximum 5GHz channel number 837 * 838 * Return: Maximum 5GHz channel number 839 */ 840 uint8_t reg_max_5ghz_ch_num(void); 841 #endif /* CONFIG_CHAN_NUM_API */ 842 843 #ifdef CONFIG_CHAN_FREQ_API 844 /** 845 * reg_min_24ghz_chan_freq() - Get minimum 2.4GHz channel frequency 846 * 847 * Return: Minimum 2.4GHz channel frequency 848 */ 849 qdf_freq_t reg_min_24ghz_chan_freq(void); 850 851 /** 852 * reg_max_24ghz_chan_freq() - Get maximum 2.4GHz channel frequency 853 * 854 * Return: Maximum 2.4GHz channel frequency 855 */ 856 qdf_freq_t reg_max_24ghz_chan_freq(void); 857 858 /** 859 * reg_min_5ghz_chan_freq() - Get minimum 5GHz channel frequency 860 * 861 * Return: Minimum 5GHz channel frequency 862 */ 863 qdf_freq_t reg_min_5ghz_chan_freq(void); 864 865 /** 866 * reg_max_5ghz_chan_freq() - Get maximum 5GHz channel frequency 867 * 868 * Return: Maximum 5GHz channel frequency 869 */ 870 qdf_freq_t reg_max_5ghz_chan_freq(void); 871 #endif /* CONFIG_CHAN_FREQ_API */ 872 873 /** 874 * reg_enable_dfs_channels() - Enable the use of DFS channels 875 * @pdev: The physical dev to enable/disable DFS channels for 876 * 877 * Return: QDF_STATUS 878 */ 879 QDF_STATUS reg_enable_dfs_channels(struct wlan_objmgr_pdev *pdev, bool enable); 880 881 /** 882 * reg_is_regdmn_en302502_applicable() - Find if ETSI EN302_502 radar pattern 883 * is applicable in current regulatory domain. 884 * @pdev: Pdev object pointer. 885 * 886 * Return: True if en302_502 is applicable, else false. 887 */ 888 bool reg_is_regdmn_en302502_applicable(struct wlan_objmgr_pdev *pdev); 889 890 /** 891 * reg_modify_pdev_chan_range() - Compute current channel list 892 * in accordance with the modified reg caps. 893 * @pdev: The physical dev for which channel list must be built. 894 * 895 * Return: QDF_STATUS 896 */ 897 QDF_STATUS reg_modify_pdev_chan_range(struct wlan_objmgr_pdev *pdev); 898 899 /** 900 * reg_update_pdev_wireless_modes() - Update the wireless_modes in the 901 * pdev_priv_obj with the input wireless_modes 902 * @pdev: pointer to wlan_objmgr_pdev. 903 * @wireless_modes: Wireless modes. 904 * 905 * Return : QDF_STATUS 906 */ 907 QDF_STATUS reg_update_pdev_wireless_modes(struct wlan_objmgr_pdev *pdev, 908 uint32_t wireless_modes); 909 910 /** 911 * reg_get_phybitmap() - Get phybitmap from regulatory pdev_priv_obj 912 * @pdev: pdev pointer 913 * @phybitmap: pointer to phybitmap 914 * 915 * Return: QDF STATUS 916 */ 917 QDF_STATUS reg_get_phybitmap(struct wlan_objmgr_pdev *pdev, 918 uint16_t *phybitmap); 919 #ifdef DISABLE_UNII_SHARED_BANDS 920 /** 921 * reg_disable_chan_coex() - Disable Coexisting channels based on the input 922 * bitmask. 923 * @pdev: pointer to wlan_objmgr_pdev. 924 * unii_5g_bitmap: UNII 5G bitmap. 925 * 926 * Return : QDF_STATUS 927 */ 928 QDF_STATUS reg_disable_chan_coex(struct wlan_objmgr_pdev *pdev, 929 uint8_t unii_5g_bitmap); 930 #endif 931 932 #ifdef CONFIG_CHAN_FREQ_API 933 /** 934 * reg_is_freq_present_in_cur_chan_list() - Check the input frequency 935 * @pdev: Pointer to pdev 936 * @freq: Channel center frequency in MHz 937 * 938 * Check if the input channel center frequency is present in the current 939 * channel list 940 * 941 * Return: Return true if channel center frequency is present in the current 942 * channel list, else return false. 943 */ 944 bool 945 reg_is_freq_present_in_cur_chan_list(struct wlan_objmgr_pdev *pdev, 946 qdf_freq_t freq); 947 948 /** 949 * reg_get_chan_enum_for_freq() - Get channel enum for given channel frequency 950 * @freq: Channel Frequency 951 * 952 * Return: Channel enum 953 */ 954 enum channel_enum reg_get_chan_enum_for_freq(qdf_freq_t freq); 955 956 /** 957 * reg_get_channel_list_with_power_for_freq() - Provides the channel list with 958 * power 959 * @pdev: Pointer to pdev 960 * @ch_list: Pointer to the channel list. 961 * @num_chan: Pointer to save number of channels 962 * 963 * Return: QDF_STATUS 964 */ 965 QDF_STATUS 966 reg_get_channel_list_with_power_for_freq(struct wlan_objmgr_pdev *pdev, 967 struct channel_power *ch_list, 968 uint8_t *num_chan); 969 970 /** 971 * reg_get_channel_state_for_freq() - Get channel state from regulatory 972 * @pdev: Pointer to pdev 973 * @freq: channel center frequency. 974 * 975 * Return: channel state 976 */ 977 enum channel_state reg_get_channel_state_for_freq(struct wlan_objmgr_pdev *pdev, 978 qdf_freq_t freq); 979 980 /** 981 * reg_get_5g_bonded_channel_state_for_freq() - Get channel state for 982 * 5G bonded channel using the channel frequency 983 * @pdev: Pointer to pdev 984 * @freq: channel center frequency. 985 * @bw: channel band width 986 * 987 * Return: channel state 988 */ 989 enum channel_state 990 reg_get_5g_bonded_channel_state_for_freq(struct wlan_objmgr_pdev *pdev, 991 qdf_freq_t freq, 992 enum phy_ch_width bw); 993 994 /** 995 * reg_get_2g_bonded_channel_state_for_freq() - Get channel state for 2G 996 * bonded channel 997 * @freq: channel center frequency. 998 * @pdev: Pointer to pdev 999 * @oper_ch_freq: Primary channel center frequency 1000 * @sec_ch_freq: Secondary channel center frequency 1001 * @bw: channel band width 1002 * 1003 * Return: channel state 1004 */ 1005 enum channel_state 1006 reg_get_2g_bonded_channel_state_for_freq(struct wlan_objmgr_pdev *pdev, 1007 qdf_freq_t oper_ch_freq, 1008 qdf_freq_t sec_ch_freq, 1009 enum phy_ch_width bw); 1010 1011 /** 1012 * reg_set_channel_params_for_freq () - Sets channel parameteres for given 1013 * bandwidth 1014 * @pdev: Pointer to pdev 1015 * @freq: Channel center frequency. 1016 * @sec_ch_2g_freq: Secondary 2G channel frequency 1017 * @ch_params: pointer to the channel parameters. 1018 * 1019 * Return: None 1020 */ 1021 void reg_set_channel_params_for_freq(struct wlan_objmgr_pdev *pdev, 1022 qdf_freq_t freq, 1023 qdf_freq_t sec_ch_2g_freq, 1024 struct ch_params *ch_params); 1025 1026 /** 1027 * reg_get_channel_reg_power_for_freq() - Get the txpower for the given channel 1028 * @pdev: Pointer to pdev 1029 * @freq: Channel frequency 1030 * 1031 * Return: txpower 1032 */ 1033 uint8_t reg_get_channel_reg_power_for_freq(struct wlan_objmgr_pdev *pdev, 1034 qdf_freq_t freq); 1035 1036 /** 1037 * reg_update_nol_ch_for_freq () - Updates NOL channels in current channel list 1038 * @pdev: pointer to pdev object 1039 * @chan_freq_list: pointer to NOL channel list 1040 * @num_ch: No.of channels in list 1041 * @update_nol: set/reset the NOL status 1042 * 1043 * Return: None 1044 */ 1045 void reg_update_nol_ch_for_freq(struct wlan_objmgr_pdev *pdev, 1046 uint16_t *chan_freq_list, 1047 uint8_t num_chan, 1048 bool nol_chan); 1049 /** 1050 * reg_is_dfs_for_freq () - Checks the channel state for DFS 1051 * @pdev: pdev ptr 1052 * @freq: Channel center frequency 1053 * 1054 * Return: true or false 1055 */ 1056 bool reg_is_dfs_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); 1057 1058 /** 1059 * reg_chan_freq_is_49ghz() - Check if the input channel center frequency is 1060 * 4.9GHz 1061 * @pdev: Pdev pointer 1062 * @chan_num: Input channel center frequency 1063 * 1064 * Return: true if the frequency is 4.9GHz else false. 1065 */ 1066 bool reg_chan_freq_is_49ghz(qdf_freq_t freq); 1067 1068 /** 1069 * reg_update_nol_history_ch_for_freq() - Set nol-history flag for the channels 1070 * in the list. 1071 * @pdev: Pdev ptr. 1072 * @chan_list: Input channel freqeuncy list. 1073 * @num_ch: Number of channels. 1074 * @nol_history_ch: NOL-History flag. 1075 * 1076 * Return: void 1077 */ 1078 void reg_update_nol_history_ch_for_freq(struct wlan_objmgr_pdev *pdev, 1079 uint16_t *chan_list, 1080 uint8_t num_chan, 1081 bool nol_history_chan); 1082 1083 /** 1084 * reg_is_same_5g_band_freqs() - Check if given channel center 1085 * frequencies have same band 1086 * @freq1: Channel Center Frequency 1 1087 * @freq2: Channel Center Frequency 2 1088 * 1089 * Return: true if both the frequencies has the same band. 1090 */ 1091 bool reg_is_same_band_freqs(qdf_freq_t freq1, qdf_freq_t freq2); 1092 1093 /** 1094 * reg_is_frequency_valid_5g_sbs() Check if the given frequency is 5G SBS. 1095 * @curfreq: current channel frequency 1096 * @newfreq: new channel center frequency 1097 * 1098 * Return: true if the given center frequency is a valid 5G SBS 1099 */ 1100 bool reg_is_frequency_valid_5g_sbs(qdf_freq_t curfreq, qdf_freq_t newfreq); 1101 1102 /** 1103 * reg_freq_to_band() - Get band from channel frequency 1104 * @chan_num: channel frequency 1105 * 1106 * Return: wifi band 1107 */ 1108 enum reg_wifi_band reg_freq_to_band(qdf_freq_t freq); 1109 1110 /** 1111 * reg_min_chan_freq() - minimum channel frequency supported 1112 * 1113 * Return: channel frequency 1114 */ 1115 qdf_freq_t reg_min_chan_freq(void); 1116 1117 /** 1118 * reg_max_chan_freq() - maximum channel frequency supported 1119 * 1120 * Return: channel frequency 1121 */ 1122 qdf_freq_t reg_max_chan_freq(void); 1123 1124 /** 1125 * reg_get_5g_bonded_channel_for_freq()- Return the channel state for a 1126 * 5G or 6G channel frequency based on the channel width and bonded channel 1127 * @pdev: Pointer to pdev. 1128 * @freq: Channel center frequency. 1129 * @ch_width: Channel Width. 1130 * @bonded_chan_ptr_ptr: Pointer to bonded_channel_freq. 1131 * 1132 * Return: Channel State 1133 */ 1134 enum channel_state 1135 reg_get_5g_bonded_channel_for_freq(struct wlan_objmgr_pdev *pdev, 1136 uint16_t freq, 1137 enum phy_ch_width ch_width, 1138 const struct bonded_channel_freq 1139 **bonded_chan_ptr_ptr); 1140 1141 /** 1142 * reg_is_disable_for_freq() - Check if the given channel frequency in 1143 * disable state 1144 * @pdev: Pointer to pdev 1145 * @freq: Channel frequency 1146 * 1147 * Return: True if channel state is disabled, else false 1148 */ 1149 bool reg_is_disable_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); 1150 1151 /** 1152 * reg_is_passive_for_freq() - Check if the given channel frequency is in 1153 * passive state 1154 * @pdev: Pointer to pdev 1155 * @freq: Channel frequency 1156 * 1157 * Return: True if channel state is passive, else false 1158 */ 1159 bool reg_is_passive_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); 1160 #endif /* CONFIG_CHAN_FREQ_API */ 1161 1162 /** 1163 * reg_get_max_tx_power() - Get maximum tx power from the current channel list 1164 * @pdev: Pointer to pdev 1165 * 1166 * Return: return the value of the maximum tx power in the current channel list 1167 * 1168 */ 1169 uint8_t reg_get_max_tx_power(struct wlan_objmgr_pdev *pdev); 1170 1171 /** 1172 * reg_set_ignore_fw_reg_offload_ind() - Set if regdb offload indication 1173 * needs to be ignored 1174 * @psoc: Pointer to psoc 1175 * 1176 * Return: QDF_STATUS 1177 */ 1178 QDF_STATUS reg_set_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc); 1179 1180 /** 1181 * reg_get_ignore_fw_reg_offload_ind() - Check whether regdb offload indication 1182 * needs to be ignored 1183 * 1184 * @psoc: Pointer to psoc 1185 */ 1186 bool reg_get_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc); 1187 1188 /** 1189 * reg_set_6ghz_supported() - Set if 6ghz is supported 1190 * 1191 * @psoc: Pointer to psoc 1192 * @val: value 1193 */ 1194 QDF_STATUS reg_set_6ghz_supported(struct wlan_objmgr_psoc *psoc, 1195 bool val); 1196 1197 /** 1198 * reg_set_5dot9_ghz_supported() - Set if 5.9ghz is supported 1199 * 1200 * @psoc: Pointer to psoc 1201 * @val: value 1202 */ 1203 QDF_STATUS reg_set_5dot9_ghz_supported(struct wlan_objmgr_psoc *psoc, 1204 bool val); 1205 1206 /** 1207 * reg_is_6ghz_op_class() - Check whether 6ghz oper class 1208 * 1209 * @pdev: Pointer to pdev 1210 * @op_class: oper class 1211 */ 1212 bool reg_is_6ghz_op_class(struct wlan_objmgr_pdev *pdev, 1213 uint8_t op_class); 1214 1215 #ifdef CONFIG_REG_CLIENT 1216 /** 1217 * reg_is_6ghz_supported() - Whether 6ghz is supported 1218 * 1219 * @psoc: pointer to psoc 1220 */ 1221 bool reg_is_6ghz_supported(struct wlan_objmgr_psoc *psoc); 1222 #endif 1223 1224 /** 1225 * reg_is_5dot9_ghz_supported() - Whether 5.9ghz is supported 1226 * 1227 * @psoc: pointer to psoc 1228 */ 1229 bool reg_is_5dot9_ghz_supported(struct wlan_objmgr_psoc *psoc); 1230 1231 /** 1232 * reg_is_fcc_regdmn () - Checks if the current reg domain is FCC3/FCC8/FCC15/ 1233 * FCC16 or not 1234 * @pdev: pdev ptr 1235 * 1236 * Return: true or false 1237 */ 1238 bool reg_is_fcc_regdmn(struct wlan_objmgr_pdev *pdev); 1239 1240 /** 1241 * reg_is_5dot9_ghz_freq () - Checks if the frequency is 5.9 GHz freq or not 1242 * @freq: frequency 1243 * @pdev: pdev ptr 1244 * 1245 * Return: true or false 1246 */ 1247 bool reg_is_5dot9_ghz_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); 1248 1249 /** 1250 * reg_is_5dot9_ghz_chan_allowed_master_mode () - Checks if 5.9 GHz channels 1251 * are allowed in master mode or not. 1252 * 1253 * @pdev: pdev ptr 1254 * 1255 * Return: true or false 1256 */ 1257 bool reg_is_5dot9_ghz_chan_allowed_master_mode(struct wlan_objmgr_pdev *pdev); 1258 1259 /** 1260 * reg_get_unii_5g_bitmap() - get unii_5g_bitmap value 1261 * @pdev: pdev pointer 1262 * @bitmap: Pointer to retrieve the unii_5g_bitmap of enum reg_unii_band 1263 * 1264 * Return: QDF_STATUS 1265 */ 1266 #ifdef DISABLE_UNII_SHARED_BANDS 1267 QDF_STATUS 1268 reg_get_unii_5g_bitmap(struct wlan_objmgr_pdev *pdev, uint8_t *bitmap); 1269 #endif 1270 1271 #ifdef CHECK_REG_PHYMODE 1272 /** 1273 * reg_get_max_phymode() - Recursively find the best possible phymode given a 1274 * phymode, a frequency, and per-country regulations 1275 * @pdev: pdev pointer 1276 * @phy_in: phymode that the user requested 1277 * @freq: current operating center frequency 1278 * 1279 * Return: maximum phymode allowed in current country that is <= phy_in 1280 */ 1281 enum reg_phymode reg_get_max_phymode(struct wlan_objmgr_pdev *pdev, 1282 enum reg_phymode phy_in, 1283 qdf_freq_t freq); 1284 #else 1285 static inline enum reg_phymode 1286 reg_get_max_phymode(struct wlan_objmgr_pdev *pdev, 1287 enum reg_phymode phy_in, 1288 qdf_freq_t freq) 1289 { 1290 return REG_PHYMODE_INVALID; 1291 } 1292 #endif /* CHECK_REG_PHYMODE */ 1293 1294 #ifdef CONFIG_REG_CLIENT 1295 /** 1296 * reg_band_bitmap_to_band_info() - Convert the band_bitmap to a band_info enum. 1297 * Since band_info enum only has combinations for 2G and 5G, 6G is not 1298 * considered in this function. 1299 * @band_bitmap: bitmap on top of reg_wifi_band of bands enabled 1300 * 1301 * Return: BAND_ALL if both 2G and 5G band is enabled 1302 * BAND_2G if 2G is enabled but 5G isn't 1303 * BAND_5G if 5G is enabled but 2G isn't 1304 */ 1305 enum band_info reg_band_bitmap_to_band_info(uint32_t band_bitmap); 1306 #endif 1307 #if defined(CONFIG_BAND_6GHZ) 1308 /** 1309 * reg_set_cur_6g_ap_pwr_type() - Set the current 6G regulatory AP power type. 1310 * @pdev: Pointer to PDEV object. 1311 * @reg_6g_ap_type: Regulatory 6G AP type ie VLPI/LPI/SP. 1312 * 1313 * Return: QDF_STATUS_E_INVAL if unable to set and QDF_STATUS_SUCCESS is set. 1314 */ 1315 QDF_STATUS 1316 reg_set_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev, 1317 enum reg_6g_ap_type reg_cur_6g_ap_pwr_type); 1318 1319 /** 1320 * reg_get_cur_6g_ap_pwr_type() - Get the current 6G regulatory AP power type. 1321 * @reg_6g_ap_pwr_type: The current regulatory 6G AP type ie VLPI/LPI/SP. 1322 * subordinate. 1323 * 1324 * Return: QDF_STATUS. 1325 */ 1326 QDF_STATUS 1327 reg_get_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev, 1328 enum reg_6g_ap_type *reg_cur_6g_ap_pwr_type); 1329 /** 1330 * reg_get_cur_6g_client_type() - Get the current 6G regulatory client Type. 1331 * @pdev: Pointer to PDEV object. 1332 * @reg_cur_6g_client_mobility_type: The current regulatory 6G client type ie. 1333 * default/subordinate. 1334 * 1335 * Return: QDF_STATUS. 1336 */ 1337 QDF_STATUS 1338 reg_get_cur_6g_client_type(struct wlan_objmgr_pdev *pdev, 1339 enum reg_6g_client_type 1340 *reg_cur_6g_client_mobility_type); 1341 1342 /** 1343 * reg_get_rnr_tpe_usable() - Tells if RNR IE is applicable for current domain. 1344 * @pdev: Pointer to PDEV object. 1345 * @reg_rnr_tpe_usable: Pointer to hold the bool value, true if RNR IE is 1346 * applicable, else false. 1347 * 1348 * Return: QDF_STATUS. 1349 */ 1350 QDF_STATUS reg_get_rnr_tpe_usable(struct wlan_objmgr_pdev *pdev, 1351 bool *reg_rnr_tpe_usable); 1352 1353 /** 1354 * reg_get_unspecified_ap_usable() - Tells if AP type unspecified by 802.11 can 1355 * be used or not. 1356 * @pdev: Pointer to PDEV object. 1357 * @reg_unspecified_ap_usable: Pointer to hold the bool value, true if 1358 * unspecified AP types can be used in the IE, else false. 1359 * 1360 * Return: QDF_STATUS. 1361 */ 1362 QDF_STATUS reg_get_unspecified_ap_usable(struct wlan_objmgr_pdev *pdev, 1363 bool *reg_unspecified_ap_usable); 1364 #else 1365 static inline QDF_STATUS 1366 reg_set_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev, 1367 enum reg_6g_ap_type reg_cur_6g_ap_pwr_type) 1368 { 1369 return QDF_STATUS_E_NOSUPPORT; 1370 } 1371 1372 static inline QDF_STATUS 1373 reg_get_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev, 1374 enum reg_6g_ap_type *reg_cur_6g_ap_pwr_type) 1375 { 1376 *reg_cur_6g_ap_pwr_type = REG_MAX_AP_TYPE; 1377 return QDF_STATUS_E_NOSUPPORT; 1378 } 1379 1380 static inline QDF_STATUS 1381 reg_get_cur_6g_client_type(struct wlan_objmgr_pdev *pdev, 1382 enum reg_6g_client_type 1383 *reg_cur_6g_client_mobility_type) 1384 { 1385 *reg_cur_6g_client_mobility_type = REG_SUBORDINATE_CLIENT; 1386 return QDF_STATUS_E_NOSUPPORT; 1387 } 1388 1389 static inline 1390 QDF_STATUS reg_get_rnr_tpe_usable(struct wlan_objmgr_pdev *pdev, 1391 bool *reg_rnr_tpe_usable) 1392 { 1393 *reg_rnr_tpe_usable = false; 1394 return QDF_STATUS_E_NOSUPPORT; 1395 } 1396 1397 static inline 1398 QDF_STATUS reg_get_unspecified_ap_usable(struct wlan_objmgr_pdev *pdev, 1399 bool *reg_unspecified_ap_usable) 1400 { 1401 *reg_unspecified_ap_usable = false; 1402 return QDF_STATUS_E_NOSUPPORT; 1403 } 1404 #endif 1405 #endif 1406