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