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