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