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