xref: /wlan-driver/qca-wifi-host-cmn/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /**
21  * DOC: wlan_reg_services_api.h
22  * This file provides prototypes of the routines needed for the
23  * external components to utilize the services provided by the
24  * regulatory component.
25  */
26 
27 #ifndef __WLAN_REG_SERVICES_API_H
28 #define __WLAN_REG_SERVICES_API_H
29 
30 #include <reg_services_public_struct.h>
31 
32 /**
33  * wlan_reg_max_5ghz_ch_num() - Get maximum 5GHz channel number
34  *
35  * Return: Maximum 5GHz channel number
36  */
37 uint8_t wlan_reg_max_5ghz_ch_num(void);
38 #define WLAN_REG_MAX_5GHZ_CH_NUM wlan_reg_max_5ghz_ch_num()
39 
40 #ifdef CONFIG_CHAN_FREQ_API
41 /**
42  * wlan_reg_min_24ghz_chan_freq() - Get minimum 2.4GHz channel frequency
43  *
44  * Return: Minimum 2.4GHz channel frequency
45  */
46 qdf_freq_t wlan_reg_min_24ghz_chan_freq(void);
47 #define WLAN_REG_MIN_24GHZ_CHAN_FREQ wlan_reg_min_24ghz_chan_freq()
48 
49 /**
50  * wlan_reg_max_24ghz_chan_freq() - Get maximum 2.4GHz channel frequency
51  *
52  * Return: Maximum 2.4GHz channel frequency
53  */
54 qdf_freq_t wlan_reg_max_24ghz_chan_freq(void);
55 #define WLAN_REG_MAX_24GHZ_CHAN_FREQ wlan_reg_max_24ghz_chan_freq()
56 
57 /**
58  * wlan_reg_min_5ghz_chan_freq() - Get minimum 5GHz channel frequency
59  *
60  * Return: Minimum 5GHz channel frequency
61  */
62 qdf_freq_t wlan_reg_min_5ghz_chan_freq(void);
63 #define WLAN_REG_MIN_5GHZ_CHAN_FREQ wlan_reg_min_5ghz_chan_freq()
64 
65 /**
66  * wlan_reg_max_5ghz_chan_freq() - Get maximum 5GHz channel frequency
67  *
68  * Return: Maximum 5GHz channel frequency
69  */
70 qdf_freq_t wlan_reg_max_5ghz_chan_freq(void);
71 #define WLAN_REG_MAX_5GHZ_CHAN_FREQ wlan_reg_max_5ghz_chan_freq()
72 #endif /* CONFIG_CHAN_FREQ_API */
73 
74 /**
75  * wlan_reg_is_24ghz_ch_freq() - Check if the given channel frequency is 2.4GHz
76  * @freq: Channel frequency
77  *
78  * Return: true if channel frequency is 2.4GHz, else false
79  */
80 bool wlan_reg_is_24ghz_ch_freq(qdf_freq_t freq);
81 #define WLAN_REG_IS_24GHZ_CH_FREQ(freq) wlan_reg_is_24ghz_ch_freq(freq)
82 
83 /**
84  * wlan_reg_is_5ghz_ch_freq() - Check if the given channel frequency is 5GHz
85  * @freq: Channel frequency
86  *
87  * Return: true if channel frequency is 5GHz, else false
88  */
89 bool wlan_reg_is_5ghz_ch_freq(qdf_freq_t freq);
90 #define WLAN_REG_IS_5GHZ_CH_FREQ(freq) wlan_reg_is_5ghz_ch_freq(freq)
91 
92 /**
93  * wlan_reg_is_range_overlap_2g() - Check if the given low_freq and high_freq
94  * is in the 2G range.
95  *
96  * @low_freq: Low frequency.
97  * @high_freq: High frequency.
98  *
99  * Return: Return true if given low_freq and high_freq overlaps 2G range,
100  * else false.
101  */
102 bool wlan_reg_is_range_overlap_2g(qdf_freq_t low_freq, qdf_freq_t high_freq);
103 
104 /**
105  * wlan_reg_is_range_overlap_5g() - Check if the given low_freq and high_freq
106  * is in the 5G range.
107  *
108  * @low_freq: Low frequency.
109  * @high_freq: High frequency.
110  *
111  * Return: Return true if given low_freq and high_freq overlaps 5G range,
112  * else false.
113  */
114 bool wlan_reg_is_range_overlap_5g(qdf_freq_t low_freq, qdf_freq_t high_freq);
115 
116 /**
117  * wlan_reg_is_freq_indoor() - Check if a frequency is indoor.
118  * @pdev: Pointer to pdev.
119  * @freq: Channel frequency.
120  *
121  * Return: Return true if a frequency is indoor, else false.
122  */
123 bool wlan_reg_is_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq);
124 
125 /**
126  * wlan_reg_get_min_chwidth() - Return min chanwidth supported by freq.
127  * @pdev: Pointer to pdev.
128  * @freq: Channel frequency.
129  *
130  * Return: Min chwidth supported by freq as per regulatory DB.
131  */
132 uint16_t wlan_reg_get_min_chwidth(struct wlan_objmgr_pdev *pdev,
133 				  qdf_freq_t freq);
134 
135 /**
136  * wlan_reg_get_max_chwidth() - Return max chanwidth supported by freq.
137  * @pdev: Pointer to pdev.
138  * @freq: Channel frequency.
139  *
140  * Return: Max chwidth supported by freq as per regulatory DB.
141  */
142 uint16_t wlan_reg_get_max_chwidth(struct wlan_objmgr_pdev *pdev,
143 				  qdf_freq_t freq);
144 
145 /**
146  * wlan_reg_get_next_lower_bandwidth() - Get next lower bandwdith
147  * @ch_width: channel bandwdith
148  *
149  * Return: Return next lower bandwidth of input channel bandwidth
150  */
151 enum phy_ch_width
152 wlan_reg_get_next_lower_bandwidth(enum phy_ch_width ch_width);
153 
154 /**
155  * wlan_reg_get_next_higher_bandwidth() - Get next higher bandwdith
156  * @ch_width: channel bandwdith
157  *
158  * Return: Return next higher bandwidth of input channel bandwidth
159  */
160 enum phy_ch_width
161 wlan_reg_get_next_higher_bandwidth(enum phy_ch_width ch_width);
162 
163 #ifdef CONFIG_REG_CLIENT
164 /**
165  * wlan_reg_is_freq_indoor_in_secondary_list() - Check if the input frequency is
166  * an indoor frequency in the secondary list
167  * @pdev: Pointer to pdev.
168  * @freq: Channel frequency.
169  *
170  * Return: Return true if a frequency is indoor, else false.
171  */
172 bool wlan_reg_is_freq_indoor_in_secondary_list(struct wlan_objmgr_pdev *pdev,
173 					       qdf_freq_t freq);
174 #endif
175 
176 #ifdef CONFIG_BAND_6GHZ
177 /**
178  * wlan_reg_is_6ghz_chan_freq() - Check if the given channel frequency is 6GHz
179  * @freq: Channel frequency
180  *
181  * Return: true if channel frequency is 6GHz, else false
182  */
183 bool wlan_reg_is_6ghz_chan_freq(uint16_t freq);
184 #define WLAN_REG_IS_6GHZ_CHAN_FREQ(freq) wlan_reg_is_6ghz_chan_freq(freq)
185 
186 #ifdef CONFIG_6G_FREQ_OVERLAP
187 /**
188  * wlan_reg_is_range_only6g() - Check if the given low_freq and high_freq
189  * is in the 6G range.
190  * @low_freq: Low frequency.
191  * @high_freq: High frequency.
192  *
193  * Return: Return true if given low_freq and high_freq overlaps 6G range,
194  * else false.
195  */
196 bool wlan_reg_is_range_only6g(qdf_freq_t low_freq, qdf_freq_t high_freq);
197 
198 /**
199  * wlan_reg_is_range_overlap_6g() - Check if the given low_freq and high_freq
200  * is in the 6G range.
201  *
202  * @low_freq: Low frequency.
203  * @high_freq: High frequency.
204  *
205  * Return: Return true if given low_freq and high_freq overlaps 6G range,
206  * else false.
207  */
208 bool wlan_reg_is_range_overlap_6g(qdf_freq_t low_freq, qdf_freq_t high_freq);
209 #else
wlan_reg_is_range_only6g(qdf_freq_t low_freq,qdf_freq_t high_freq)210 static inline bool wlan_reg_is_range_only6g(qdf_freq_t low_freq,
211 					    qdf_freq_t high_freq)
212 {
213 	return false;
214 }
215 
wlan_reg_is_range_overlap_6g(qdf_freq_t low_freq,qdf_freq_t high_freq)216 static inline bool wlan_reg_is_range_overlap_6g(qdf_freq_t low_freq,
217 						qdf_freq_t high_freq)
218 {
219 	return false;
220 }
221 #endif
222 
223 /**
224  * wlan_reg_get_6g_ap_master_chan_list() - provide  the appropriate ap master
225  * channel list
226  * @pdev: pdev pointer
227  * @ap_pwr_type: The ap power type (LPI/VLP/SP)
228  * @chan_list: channel list pointer
229  *
230  * Return: QDF_STATUS
231  */
232 QDF_STATUS wlan_reg_get_6g_ap_master_chan_list(
233 					struct wlan_objmgr_pdev *pdev,
234 					enum reg_6g_ap_type ap_pwr_type,
235 					struct regulatory_channel *chan_list);
236 
237 #ifdef CONFIG_REG_CLIENT
238 /**
239  * wlan_reg_get_power_string() - wlan reg get power type string
240  * @power_type: power type enum
241  *
242  * Return: power type string
243  */
244 const char *wlan_reg_get_power_string(enum reg_6g_ap_type power_type);
245 #endif
246 
247 /**
248  * wlan_reg_is_6ghz_psc_chan_freq() - Check if the given 6GHz channel frequency
249  * is preferred scanning channel frequency.
250  * @freq: Channel frequency
251  *
252  * Return: true if given 6GHz channel frequency is preferred scanning channel
253  * frequency, else false
254  */
255 bool wlan_reg_is_6ghz_psc_chan_freq(uint16_t freq);
256 #define WLAN_REG_IS_6GHZ_PSC_CHAN_FREQ(freq) \
257 	wlan_reg_is_6ghz_psc_chan_freq(freq)
258 
259 /**
260  * wlan_reg_min_6ghz_chan_freq() - Get minimum 6GHz channel center frequency
261  *
262  * Return: Minimum 6GHz channel center frequency
263  */
264 uint16_t wlan_reg_min_6ghz_chan_freq(void);
265 #define WLAN_REG_MIN_6GHZ_CHAN_FREQ wlan_reg_min_6ghz_chan_freq()
266 
267 /**
268  * wlan_reg_max_6ghz_chan_freq() - Get maximum 6GHz channel center frequency
269  *
270  * Return: Maximum 6GHz channel center frequency
271  */
272 uint16_t wlan_reg_max_6ghz_chan_freq(void);
273 #define WLAN_REG_MAX_6GHZ_CHAN_FREQ wlan_reg_max_6ghz_chan_freq()
274 
275 /**
276  * wlan_reg_is_6g_freq_indoor() - Check if a 6GHz frequency is indoor.
277  * @pdev: Pointer to pdev.
278  * @freq: Channel frequency.
279  *
280  * Return: Return true if a 6GHz frequency is indoor, else false.
281  */
282 bool wlan_reg_is_6g_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq);
283 #define WLAN_REG_IS_6GHZ_FREQ_INDOOR(pdev, freq) \
284 					wlan_reg_is_6g_freq_indoor(pdev, freq)
285 
286 /**
287  * wlan_reg_get_max_txpower_for_6g_tpe() - Get max txpower for 6G TPE IE.
288  * @pdev: Pointer to pdev.
289  * @freq: Channel frequency.
290  * @bw: Channel bandwidth.
291  * @reg_ap: Regulatory 6G AP type.
292  * @reg_client: Regulatory client type.
293  * @is_psd: True if txpower is needed in PSD format, and false if needed in EIRP
294  * format.
295  * @tx_power: Pointer to tx-power.
296  *
297  * Return: Return QDF_STATUS_SUCCESS, if tx_power is filled for 6G TPE IE
298  * else return QDF_STATUS_E_FAILURE.
299  */
300 QDF_STATUS
301 wlan_reg_get_max_txpower_for_6g_tpe(struct wlan_objmgr_pdev *pdev,
302 				    qdf_freq_t freq, uint8_t bw,
303 				    enum reg_6g_ap_type reg_ap,
304 				    enum reg_6g_client_type reg_client,
305 				    bool is_psd,
306 				    uint8_t *tx_power);
307 
308 /**
309  * wlan_reg_get_superchan_entry() - Get the address of the super channel list
310  * entry for a given input channel index.
311  *
312  * @pdev: pdev ptr
313  * @chan_enum: Channel enum
314  * @p_sup_chan_entry: Pointer to address of *p_sup_chan_entry
315  *
316  * Return: QDF_STATUS_SUCCESS if super channel entry is available for the input
317  * chan_enum else QDF_STATUS_E_FAILURE
318  */
319 QDF_STATUS wlan_reg_get_superchan_entry(
320 		struct wlan_objmgr_pdev *pdev,
321 		enum channel_enum chan_enum,
322 		const struct super_chan_info **p_sup_chan_entry);
323 /**
324  * wlan_reg_is_6ghz_unii5_chan_freq() - Check if the given 6GHz channel freq
325  * is UNII-5 band or not.
326  * @freq: Channel frequency
327  *
328  * Return: true if given 6GHz channel frequency is UNII-5 band, else false
329  */
330 bool wlan_reg_is_6ghz_unii5_chan_freq(qdf_freq_t freq);
331 #define WLAN_REG_IS_6GHZ_UNII5_CHAN_FREQ(freq) \
332 	wlan_reg_is_6ghz_unii5_chan_freq(freq)
333 #else
334 
335 #define WLAN_REG_IS_6GHZ_CHAN_FREQ(freq) (false)
wlan_reg_is_6ghz_chan_freq(uint16_t freq)336 static inline bool wlan_reg_is_6ghz_chan_freq(uint16_t freq)
337 {
338 	return false;
339 }
340 
wlan_reg_is_range_only6g(qdf_freq_t low_freq,qdf_freq_t high_freq)341 static inline bool wlan_reg_is_range_only6g(qdf_freq_t low_freq,
342 					    qdf_freq_t high_freq)
343 {
344 	return false;
345 }
346 
347 #define WLAN_REG_IS_6GHZ_PSC_CHAN_FREQ(freq) (false)
wlan_reg_is_6ghz_psc_chan_freq(uint16_t freq)348 static inline bool wlan_reg_is_6ghz_psc_chan_freq(uint16_t freq)
349 {
350 	return false;
351 }
352 
353 #define WLAN_REG_MIN_6GHZ_CHAN_FREQ (false)
wlan_reg_min_6ghz_chan_freq(void)354 static inline uint16_t wlan_reg_min_6ghz_chan_freq(void)
355 {
356 	return 0;
357 }
358 
359 #define WLAN_REG_MAX_6GHZ_CHAN_FREQ (false)
wlan_reg_max_6ghz_chan_freq(void)360 static inline uint16_t wlan_reg_max_6ghz_chan_freq(void)
361 {
362 	return 0;
363 }
364 
365 #define WLAN_REG_IS_6GHZ_FREQ_INDOOR(pdev, freq) (false)
366 static inline bool
wlan_reg_is_6g_freq_indoor(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq)367 wlan_reg_is_6g_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
368 {
369 	return false;
370 }
371 
wlan_reg_is_range_overlap_6g(qdf_freq_t low_freq,qdf_freq_t high_freq)372 static inline bool wlan_reg_is_range_overlap_6g(qdf_freq_t low_freq,
373 						qdf_freq_t high_freq)
374 {
375 	return false;
376 }
377 
378 static inline QDF_STATUS
wlan_reg_get_max_txpower_for_6g_tpe(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq,uint8_t bw,enum reg_6g_ap_type reg_ap,enum reg_6g_client_type reg_client,bool is_psd,uint8_t * tx_power)379 wlan_reg_get_max_txpower_for_6g_tpe(struct wlan_objmgr_pdev *pdev,
380 				    qdf_freq_t freq, uint8_t bw,
381 				    enum reg_6g_ap_type reg_ap,
382 				    enum reg_6g_client_type reg_client,
383 				    bool is_psd,
384 				    uint8_t *tx_power)
385 {
386 	return QDF_STATUS_E_FAILURE;
387 }
388 
389 static inline QDF_STATUS
wlan_reg_get_6g_ap_master_chan_list(struct wlan_objmgr_pdev * pdev,enum reg_6g_ap_type ap_pwr_type,struct regulatory_channel * chan_list)390 wlan_reg_get_6g_ap_master_chan_list(struct wlan_objmgr_pdev *pdev,
391 				    enum reg_6g_ap_type ap_pwr_type,
392 				    struct regulatory_channel *chan_list)
393 {
394 	return QDF_STATUS_E_FAILURE;
395 }
396 
397 static inline
wlan_reg_get_superchan_entry(struct wlan_objmgr_pdev * pdev,enum channel_enum chan_enum,const struct super_chan_info ** p_sup_chan_entry)398 QDF_STATUS wlan_reg_get_superchan_entry(
399 		struct wlan_objmgr_pdev *pdev,
400 		enum channel_enum chan_enum,
401 		const struct super_chan_info **p_sup_chan_entry)
402 {
403 	*p_sup_chan_entry = NULL;
404 	return QDF_STATUS_E_NOSUPPORT;
405 }
406 
407 static inline
wlan_reg_get_power_string(enum reg_6g_ap_type power_type)408 const char *wlan_reg_get_power_string(enum reg_6g_ap_type power_type)
409 {
410 	return "INVALID";
411 }
412 
413 #define WLAN_REG_IS_6GHZ_UNII5_CHAN_FREQ(freq) (false)
wlan_reg_is_6ghz_unii5_chan_freq(qdf_freq_t freq)414 static inline bool wlan_reg_is_6ghz_unii5_chan_freq(qdf_freq_t freq)
415 {
416 	return false;
417 }
418 #endif /* CONFIG_BAND_6GHZ */
419 
420 /**
421  * wlan_reg_get_band_channel_list() - Get channel list based on the band_mask
422  * @pdev: pdev ptr
423  * @band_mask: Input bitmap with band set
424  * @channel_list: Pointer to Channel List
425  *
426  * Get the given channel list and number of channels from the current channel
427  * list based on input band bitmap.
428  *
429  * Return: Number of channels, else 0 to indicate error
430  */
431 uint16_t
432 wlan_reg_get_band_channel_list(struct wlan_objmgr_pdev *pdev,
433 			       uint8_t band_mask,
434 			       struct regulatory_channel *channel_list);
435 
436 #ifdef CONFIG_REG_6G_PWRMODE
437 /**
438  * wlan_reg_get_band_channel_list_for_pwrmode() - Get channel list based on the
439  * band_mask and input 6G power mode.
440  * @pdev: pdev ptr
441  * @band_mask: Input bitmap with band set
442  * @channel_list: Pointer to Channel List
443  * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup.
444  *
445  * Get the given channel list and number of channels from the current channel
446  * list based on input band bitmap.
447  *
448  * Return: Number of channels, else 0 to indicate error
449  */
450 uint16_t
451 wlan_reg_get_band_channel_list_for_pwrmode(struct wlan_objmgr_pdev *pdev,
452 					   uint8_t band_mask,
453 					   struct regulatory_channel
454 					   *channel_list,
455 					   enum supported_6g_pwr_types
456 					   in_6g_pwr_type);
457 #endif
458 
459 #ifdef CONFIG_REG_CLIENT
460 /**
461  * wlan_reg_get_secondary_band_channel_list() - Get secondary channel list for
462  * SAP based on the band_mask
463  * @pdev: pdev ptr
464  * @band_mask: Input bitmap with band set
465  * @channel_list: Pointer to Channel List
466  *
467  * Get the given channel list and number of channels from the secondary current
468  * channel list based on input band bitmap.
469  *
470  * Return: Number of channels, else 0 to indicate error
471  */
472 uint16_t
473 wlan_reg_get_secondary_band_channel_list(struct wlan_objmgr_pdev *pdev,
474 					 uint8_t band_mask,
475 					 struct regulatory_channel
476 					 *channel_list);
477 #endif
478 
479 /**
480  * wlan_reg_chan_band_to_freq - Return channel frequency based on the channel
481  * number and band.
482  * @pdev: pdev ptr
483  * @chan: Channel Number
484  * @band_mask: Bitmap for bands
485  *
486  * Return: Return channel frequency or return 0, if the channel is disabled or
487  * if the input channel number or band_mask is invalid. Composite bands are
488  * supported only for 2.4Ghz and 5Ghz bands. For other bands the following
489  * priority is given: 1) 6Ghz 2) 5Ghz 3) 2.4Ghz.
490  */
491 qdf_freq_t wlan_reg_chan_band_to_freq(struct wlan_objmgr_pdev *pdev,
492 				      uint8_t chan,
493 				      uint8_t band_mask);
494 
495 #ifdef CONFIG_49GHZ_CHAN
496 /**
497  * wlan_reg_is_49ghz_freq() - Check if the given channel frequency is 4.9GHz
498  * @freq: Channel frequency
499  *
500  * Return: true if channel frequency is 4.9GHz, else false
501  */
502 bool wlan_reg_is_49ghz_freq(qdf_freq_t freq);
503 
504 #else
505 
wlan_reg_is_49ghz_freq(qdf_freq_t freq)506 static inline bool wlan_reg_is_49ghz_freq(qdf_freq_t freq)
507 {
508 	return false;
509 }
510 #endif /* CONFIG_49GHZ_CHAN */
511 #define WLAN_REG_IS_49GHZ_FREQ(freq) wlan_reg_is_49ghz_freq(freq)
512 
513 /**
514  * wlan_reg_ch_num() - Get channel number from channel enum
515  * @ch_enum: Channel enum
516  *
517  * Return: channel number
518  */
519 uint8_t wlan_reg_ch_num(uint32_t ch_enum);
520 #define WLAN_REG_CH_NUM(ch_enum) wlan_reg_ch_num(ch_enum)
521 
522 /**
523  * wlan_reg_ch_to_freq() - Get channel frequency from channel enum
524  * @ch_enum: Channel enum
525  *
526  * Return: channel frequency
527  */
528 qdf_freq_t wlan_reg_ch_to_freq(uint32_t ch_enum);
529 #define WLAN_REG_CH_TO_FREQ(ch_enum) wlan_reg_ch_to_freq(ch_enum)
530 
531 /**
532  * wlan_reg_read_default_country() - Read the default country for the regdomain
533  * @psoc: Psoc object
534  * @country: pointer to the country code.
535  *
536  * Return: QDF_STATUS
537  */
538 QDF_STATUS wlan_reg_read_default_country(struct wlan_objmgr_psoc *psoc,
539 				   uint8_t *country);
540 
541 /**
542  * wlan_get_next_lower_bandwidth() - Get next lower bandwidth
543  * @ch_width: Channel width
544  *
545  * Return: Channel width
546  */
547 enum phy_ch_width wlan_get_next_lower_bandwidth(enum phy_ch_width ch_width);
548 
549 /**
550  * wlan_reg_get_max_5g_bw_from_country_code() - Get the max 5G
551  * bandwidth from country code
552  * @pdev: pdev pointer
553  * @cc: Country Code
554  * @max_bw_5g: Max 5G bandwidth supported by the country
555  *
556  * Return: QDF_STATUS
557  */
558 
559 QDF_STATUS wlan_reg_get_max_5g_bw_from_country_code(
560 					struct wlan_objmgr_pdev *pdev,
561 					uint16_t cc,
562 					uint16_t *max_bw_5g);
563 
564 /**
565  * wlan_reg_get_max_5g_bw_from_regdomain() - Get the max 5G bandwidth
566  * supported by the regdomain
567  * @pdev: pdev pointer
568  * @regdmn: Regdomain Pair value
569  * @max_bw_5g: Max 5G bandwidth supported by the country
570  *
571  * Return: QDF_STATUS
572  */
573 QDF_STATUS wlan_reg_get_max_5g_bw_from_regdomain(
574 					struct wlan_objmgr_pdev *pdev,
575 					uint16_t regdmn,
576 					uint16_t *max_bw_5g);
577 
578 /**
579  * wlan_reg_get_max_bw_5G_for_fo() - get max_5g_bw for FullOffload
580  * @pdev: PDEV object
581  *
582  * API to get max_bw_5g from pdev object
583  *
584  * Return: @max_bw_5g
585  */
586 QDF_STATUS wlan_reg_get_max_bw_5G_for_fo(struct wlan_objmgr_pdev *pdev);
587 
588 /**
589  * wlan_reg_is_regdb_offloaded() - get offload_enabled
590  * @psoc: Psoc object
591  *
592  * API to get offload_enabled from psoc.
593  *
594  * Return: true if offload enabled
595  */
596 
597 bool wlan_reg_is_regdb_offloaded(struct wlan_objmgr_psoc *psoc);
598 
599 /**
600  * wlan_reg_get_fcc_constraint() - Check FCC constraint on given frequency
601  * @pdev: physical dev to get
602  * @freq: frequency to be checked
603  *
604  * Return: If FCC constraint is on applied given frequency return true
605  *	   else return false.
606  */
607 bool wlan_reg_get_fcc_constraint(struct wlan_objmgr_pdev *pdev, uint32_t freq);
608 
609 /**
610  * wlan_reg_get_country_max_allowed_bw() - get max allowed channel width as per
611  * all reg rules of client
612  * @pdev: physical dev to get
613  *
614  * Return: max allowed channel width for current country code
615  */
616 uint32_t wlan_reg_get_country_max_allowed_bw(struct wlan_objmgr_pdev *pdev);
617 
618 /**
619  * wlan_reg_is_6ghz_band_set - Check if 6 GHz band set
620  * @pdev: Pointer to pdev
621  *
622  * Return: True if 6 GHz band set else return flase
623  */
624 bool wlan_reg_is_6ghz_band_set(struct wlan_objmgr_pdev *pdev);
625 
626 /**
627  * wlan_reg_get_keep_6ghz_sta_cli_connection() - Get keep 6ghz sta cli
628  *                                               connection flag
629  * @pdev: Pointer to pdev
630  *
631  * Return: Return true if keep 6ghz sta cli connection set else return false
632  */
633 bool wlan_reg_get_keep_6ghz_sta_cli_connection(struct wlan_objmgr_pdev *pdev);
634 #ifdef CONFIG_REG_CLIENT
635 /**
636  * wlan_reg_read_current_country() - Read the current country for the regdomain
637  * @psoc: pointer to psoc
638  * @country: pointer to the country code.
639  *
640  * Return: QDF_STATUS
641  */
642 QDF_STATUS wlan_reg_read_current_country(struct wlan_objmgr_psoc *psoc,
643 					 uint8_t *country);
644 
645 #ifdef CONFIG_REG_CLIENT
646 /**
647  * wlan_reg_get_best_6g_power_type() - Return best power type for 6GHz
648  * connection
649  * @psoc: pointer to psoc
650  * @pdev: pointer to pdev
651  * @pwr_type_6g: pointer to 6G power type
652  * @ap_pwr_type: AP's power type for 6G as advertised in HE ops IE
653  * @chan_freq: Connection channel frequency
654  *
655  * Return: QDF_STATUS
656  */
657 QDF_STATUS
658 wlan_reg_get_best_6g_power_type(struct wlan_objmgr_psoc *psoc,
659 				struct wlan_objmgr_pdev *pdev,
660 				enum reg_6g_ap_type *pwr_type_6g,
661 				enum reg_6g_ap_type ap_pwr_type,
662 				uint32_t chan_freq);
663 #endif
664 
665 #ifdef CONFIG_CHAN_FREQ_API
666 /**
667  * wlan_reg_is_etsi_srd_chan_for_freq() - Checks if the ch is
668  * ETSI13/ETSI18/ETSI20 srd ch
669  * or not
670  * @pdev: pdev ptr
671  * @freq: channel center frequency
672  *
673  * Return: true or false
674  */
675 bool wlan_reg_is_etsi_srd_chan_for_freq(struct wlan_objmgr_pdev *pdev,
676 					qdf_freq_t freq);
677 #endif /*CONFIG_CHAN_FREQ_API*/
678 
679 /**
680  * wlan_reg_is_etsi_regdmn() - Check if current reg domain is
681  * ETSI13/ETSI18/ETSI20 or not
682  * @pdev: pdev ptr
683  *
684  * Return: true or false
685  */
686 bool wlan_reg_is_etsi_regdmn(struct wlan_objmgr_pdev *pdev);
687 
688 /**
689  * wlan_reg_is_etsi_srd_chan_allowed_master_mode() - Checks if regdmn is
690  * ETSI13 and SRD channels are allowed in master mode or not.
691  *
692  * @pdev: pdev ptr
693  *
694  * Return: true or false
695  */
696 bool wlan_reg_is_etsi_srd_chan_allowed_master_mode(struct wlan_objmgr_pdev
697 						     *pdev);
698 #endif
699 
700 /**
701  * wlan_reg_is_world() - reg is world mode
702  * @country: The country information
703  *
704  * Return: true or false
705  */
706 bool wlan_reg_is_world(uint8_t *country);
707 
708 /**
709  * wlan_reg_get_dfs_region() - Get the current dfs region
710  * @pdev: pdev pointer
711  * @dfs_reg: pointer to dfs region
712  *
713  * Return: Status
714  */
715 QDF_STATUS wlan_reg_get_dfs_region(struct wlan_objmgr_pdev *pdev,
716 			     enum dfs_reg *dfs_reg);
717 
718 /**
719  * wlan_reg_is_chan_disabled_and_not_nol() - In the regulatory channel list, a
720  * channel may be disabled by the regulatory/device or by radar. Radar is
721  * temporary and a radar disabled channel does not mean that the channel is
722  * permanently disabled. The API checks if the channel is disabled, but not due
723  * to radar.
724  * @chan: Regulatory channel object
725  *
726  * Return: True,  the channel is disabled, but not due to radar, else false.
727  */
728 bool wlan_reg_is_chan_disabled_and_not_nol(struct regulatory_channel *chan);
729 
730 /**
731  * wlan_reg_get_current_chan_list() - provide the pdev current channel list
732  * @pdev: pdev pointer
733  * @chan_list: channel list pointer
734  *
735  * Return: QDF_STATUS
736  */
737 QDF_STATUS wlan_reg_get_current_chan_list(struct wlan_objmgr_pdev *pdev,
738 		struct regulatory_channel *chan_list);
739 
740 /**
741  * wlan_reg_is_freq_enabled() - Checks if the given frequency is enabled on the
742  * given power mode or not. If the frequency is not a 6G frequency then the
743  * input power mode is ignored and only current channel list is searched.
744  *
745  * @pdev: pdev pointer.
746  * @freq: input frequency.
747  * @in_6g_pwr_mode: Power mode on which the freq is enabled or not is to be
748  * checked.
749  *
750  * Return: True if the frequency is present in the given power mode channel
751  * list.
752  */
753 bool wlan_reg_is_freq_enabled(struct wlan_objmgr_pdev *pdev,
754 			      qdf_freq_t freq,
755 			      enum supported_6g_pwr_types in_6g_pwr_mode);
756 
757 /**
758  * wlan_reg_is_freq_idx_enabled() - Checks if the given frequency index is
759  * enabled on the given power mode or not. If the frequency index is not a 6G
760  * frequency then the input power mode is ignored and only current channel list
761  * is searched.
762  *
763  * @pdev: pdev pointer.
764  * @freq_idx: input frequency index.
765  * @in_6g_pwr_mode: Power mode on which the frequency index is enabled or not
766  * is to be checked.
767  *
768  * Return: True if the frequency index is present in the given power mode
769  * channel list.
770  */
771 bool wlan_reg_is_freq_idx_enabled(struct wlan_objmgr_pdev *pdev,
772 				  enum channel_enum freq_idx,
773 				  enum supported_6g_pwr_types in_6g_pwr_mode);
774 
775 /**
776  * wlan_reg_get_pwrmode_chan_list() - Get the modified channel list. A modified
777  * current channel list consists of 2G and 5G portions of the current channel
778  * list and the 6G portion of the current channel list is derived from the input
779  * 6g power type.
780  * @pdev: Pointer to pdev
781  * @chan_list: Pointer to buffer which stores list of regulatory_channels.
782  * @in_6g_pwr_mode: 6GHz power type
783  *
784  * Return:
785  * QDF_STATUS_SUCCESS: Success
786  * QDF_STATUS_E_INVAL: Failed to get channel list
787  */
788 QDF_STATUS wlan_reg_get_pwrmode_chan_list(struct wlan_objmgr_pdev *pdev,
789 					  struct regulatory_channel *chan_list,
790 					  enum supported_6g_pwr_types
791 					  in_6g_pwr_mode);
792 
793 #ifdef CONFIG_REG_CLIENT
794 /**
795  * wlan_reg_get_secondary_current_chan_list() - provide the pdev secondary
796  * current channel list
797  * @pdev: pdev pointer
798  * @chan_list: channel list pointer
799  *
800  * Return: QDF_STATUS
801  */
802 QDF_STATUS wlan_reg_get_secondary_current_chan_list(
803 					struct wlan_objmgr_pdev *pdev,
804 					struct regulatory_channel *chan_list);
805 #endif
806 
807 #if defined(CONFIG_AFC_SUPPORT) && defined(CONFIG_BAND_6GHZ)
808 /**
809  * wlan_reg_get_6g_afc_chan_list() - provide the pdev afc channel list
810  * @pdev: pdev pointer
811  * @chan_list: channel list pointer
812  *
813  * Return: QDF_STATUS
814  */
815 QDF_STATUS wlan_reg_get_6g_afc_chan_list(struct wlan_objmgr_pdev *pdev,
816 					 struct regulatory_channel *chan_list);
817 
818 /**
819  * wlan_reg_get_6g_afc_mas_chan_list() - provide the pdev afc master channel
820  * list
821  * @pdev: pdev pointer
822  * @chan_list: channel list pointer
823  *
824  * Return: QDF_STATUS
825  */
826 QDF_STATUS
827 wlan_reg_get_6g_afc_mas_chan_list(struct wlan_objmgr_pdev *pdev,
828 				  struct regulatory_channel *chan_list);
829 
830 /**
831  * wlan_reg_is_afc_power_event_received() - Checks if AFC power event is
832  * received from the FW.
833  *
834  * @pdev: pdev ptr
835  *
836  * Return: true if AFC power event is received from the FW or false otherwise
837  */
838 bool wlan_reg_is_afc_power_event_received(struct wlan_objmgr_pdev *pdev);
839 
840 /**
841  * wlan_reg_is_afc_done() - Check if AFC response enables the given frequency.
842  * @pdev: pdev ptr
843  * @freq: given frequency.
844  *
845  * Return: True if frequency is enabled, false otherwise.
846  */
847 bool wlan_reg_is_afc_done(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq);
848 
849 /**
850  * wlan_reg_get_afc_req_id() - Get the AFC request ID
851  * @pdev: pdev pointer
852  * @req_id: Pointer to request id
853  *
854  * Return: QDF_STATUS
855  */
856 QDF_STATUS wlan_reg_get_afc_req_id(struct wlan_objmgr_pdev *pdev,
857 				   uint64_t *req_id);
858 
859 /**
860  * wlan_reg_is_afc_expiry_event_received() - Checks if AFC power event is
861  * received from the FW.
862  *
863  * @pdev: pdev ptr
864  *
865  * Return: true if AFC exipry event is received from the FW or false otherwise
866  */
867 bool wlan_reg_is_afc_expiry_event_received(struct wlan_objmgr_pdev *pdev);
868 
869 /**
870  * wlan_reg_is_noaction_on_afc_pwr_evt() - Checks whether driver needs to
871  * take action for AFC action or the response should be handled by the
872  * user application.
873  *
874  * @pdev: pdev ptr
875  *
876  * Return: true if driver need not take action for AFC resp, false otherwise.
877  */
878 bool
879 wlan_reg_is_noaction_on_afc_pwr_evt(struct wlan_objmgr_pdev *pdev);
880 
881 /**
882  * wlan_reg_get_afc_dev_deploy_type() - Get AFC device deployment type
883  * @pdev: pdev pointer
884  * @afc_dev_type: Pointer to afc device deployment type
885  *
886  * Return: QDF_STATUS
887  */
888 QDF_STATUS
889 wlan_reg_get_afc_dev_deploy_type(struct wlan_objmgr_pdev *pdev,
890 				 enum reg_afc_dev_deploy_type *afc_dev_type);
891 
892 /**
893  * wlan_reg_is_sta_connect_allowed() - Check if STA connection allowed
894  * @pdev: pdev pointer
895  * @root_ap_pwr_mode: power mode of the Root AP.
896  *
897  * Return : True if STA Vap connection is allowed.
898  */
899 bool
900 wlan_reg_is_sta_connect_allowed(struct wlan_objmgr_pdev *pdev,
901 				enum reg_6g_ap_type root_ap_pwr_mode);
902 #else
903 static inline bool
wlan_reg_is_afc_power_event_received(struct wlan_objmgr_pdev * pdev)904 wlan_reg_is_afc_power_event_received(struct wlan_objmgr_pdev *pdev)
905 {
906 	return false;
907 }
908 
909 static inline bool
wlan_reg_is_afc_done(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq)910 wlan_reg_is_afc_done(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
911 {
912 	return true;
913 }
914 
915 static inline QDF_STATUS
wlan_reg_get_6g_afc_chan_list(struct wlan_objmgr_pdev * pdev,struct regulatory_channel * chan_list)916 wlan_reg_get_6g_afc_chan_list(struct wlan_objmgr_pdev *pdev,
917 			      struct regulatory_channel *chan_list)
918 {
919 	return QDF_STATUS_E_NOSUPPORT;
920 }
921 
922 static inline bool
wlan_reg_is_sta_connect_allowed(struct wlan_objmgr_pdev * pdev,enum reg_6g_ap_type root_ap_pwr_mode)923 wlan_reg_is_sta_connect_allowed(struct wlan_objmgr_pdev *pdev,
924 				enum reg_6g_ap_type root_ap_pwr_mode)
925 {
926 	return true;
927 }
928 #endif
929 
930 #if defined(CONFIG_REG_CLIENT)
931 /**
932  * wlan_reg_get_bonded_channel_state_for_pwrmode() - Get bonded channel freq
933  * state
934  * @pdev: pdev ptr
935  * @freq: channel frequency
936  * @bw: channel band width
937  * @sec_freq: secondary frequency
938  * @in_6g_pwr_mode: 6g power type which decides 6G channel list lookup.
939  *
940  * Return: channel state
941  */
942 enum channel_state
943 wlan_reg_get_bonded_channel_state_for_pwrmode(struct wlan_objmgr_pdev *pdev,
944 					      qdf_freq_t freq,
945 					      enum phy_ch_width bw,
946 					      qdf_freq_t sec_freq,
947 					      enum supported_6g_pwr_types
948 					      in_6g_pwr_mode);
949 #else
950 static inline enum channel_state
wlan_reg_get_bonded_channel_state_for_pwrmode(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq,enum phy_ch_width bw,qdf_freq_t sec_freq,enum supported_6g_pwr_types in_6g_pwr_mode)951 wlan_reg_get_bonded_channel_state_for_pwrmode(struct wlan_objmgr_pdev *pdev,
952 					      qdf_freq_t freq,
953 					      enum phy_ch_width bw,
954 					      qdf_freq_t sec_freq,
955 					      enum supported_6g_pwr_types
956 					      in_6g_pwr_mode)
957 {
958 	return CHANNEL_STATE_INVALID;
959 }
960 #endif
961 
962 /**
963  * wlan_reg_set_dfs_region() - set the dfs region
964  * @pdev: pdev ptr
965  * @dfs_reg: dfs region
966  *
967  * Return: void
968  */
969 void wlan_reg_set_dfs_region(struct wlan_objmgr_pdev *pdev,
970 			     enum dfs_reg dfs_reg);
971 
972 /**
973  * wlan_reg_get_bw_value() - get bandwidth value from enum
974  * @bw: channel width enum
975  *
976  * Return: channel width in MHz
977  */
978 uint16_t wlan_reg_get_bw_value(enum phy_ch_width bw);
979 
980 /**
981  * wlan_reg_get_domain_from_country_code() - provide the channel center freq
982  * @reg_domain_ptr: regulatory domain ptr
983  * @country_alpha2: country alpha2
984  * @source: alpha2 source
985  *
986  * Return: int
987  */
988 QDF_STATUS wlan_reg_get_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr,
989 						 const uint8_t *country_alpha2,
990 						 enum country_src source);
991 
992 /**
993  * wlan_reg_dmn_get_opclass_from_channel() - provide the channel center freq
994  * @country: country alpha2
995  * @channel: channel number
996  * @offset: offset
997  *
998  * Return: int
999  */
1000 uint16_t wlan_reg_dmn_get_opclass_from_channel(uint8_t *country,
1001 					       uint8_t channel,
1002 					       uint8_t offset);
1003 
1004 /**
1005  * wlan_reg_get_opclass_from_freq_width() - Get operating class from frequency
1006  * @country: Country code.
1007  * @freq: Channel center frequency.
1008  * @ch_width: Channel width.
1009  * @behav_limit: Behaviour limit.
1010  *
1011  * Return: Error code.
1012  */
1013 uint8_t wlan_reg_get_opclass_from_freq_width(uint8_t *country,
1014 					     qdf_freq_t freq,
1015 					     uint16_t ch_width,
1016 					     uint16_t behav_limit);
1017 
1018 /**
1019  * wlan_reg_get_band_cap_from_op_class() - Return band capability bitmap
1020  * @country: Pointer to Country code.
1021  * @num_of_opclass: Number of Operating class.
1022  * @opclass: Pointer to opclass.
1023  *
1024  * Return supported band bitmap based on the input operating class list
1025  * provided.
1026  *
1027  * Return: Return supported band capability
1028  */
1029 uint8_t wlan_reg_get_band_cap_from_op_class(const uint8_t *country,
1030 					    uint8_t num_of_opclass,
1031 					    const uint8_t *opclass);
1032 
1033 /**
1034  * wlan_reg_dmn_print_channels_in_opclass() - Print channels in op-class
1035  * @country: country alpha2
1036  * @opclass: oplcass
1037  *
1038  * Return: void
1039  */
1040 void wlan_reg_dmn_print_channels_in_opclass(uint8_t *country,
1041 					    uint8_t opclass);
1042 
1043 
1044 /**
1045  * wlan_reg_dmn_get_chanwidth_from_opclass() - get channel width from
1046  *                                             operating class
1047  * @country: country alpha2
1048  * @channel: channel number
1049  * @opclass: operating class
1050  *
1051  * Return: int
1052  */
1053 uint16_t wlan_reg_dmn_get_chanwidth_from_opclass(uint8_t *country,
1054 						 uint8_t channel,
1055 						 uint8_t opclass);
1056 
1057 /**
1058  * wlan_reg_dmn_get_chanwidth_from_opclass_auto() - get channel width from
1059  * operating class. If opclass not found then search in global opclass.
1060  * @country: country alpha2
1061  * @channel: channel number
1062  * @opclass: operating class
1063  *
1064  * Return: int
1065  */
1066 uint16_t wlan_reg_dmn_get_chanwidth_from_opclass_auto(uint8_t *country,
1067 						      uint8_t channel,
1068 						      uint8_t opclass);
1069 
1070 /**
1071  * wlan_reg_dmn_set_curr_opclasses() - set operating class
1072  * @num_classes: number of classes
1073  * @class: operating class
1074  *
1075  * Return: int
1076  */
1077 uint16_t wlan_reg_dmn_set_curr_opclasses(uint8_t num_classes,
1078 					 uint8_t *class);
1079 
1080 /**
1081  * wlan_reg_dmn_get_curr_opclasses() - get current oper classes
1082  * @num_classes: number of classes
1083  * @class: operating class
1084  *
1085  * Return: int
1086  */
1087 uint16_t wlan_reg_dmn_get_curr_opclasses(uint8_t *num_classes,
1088 					 uint8_t *class);
1089 
1090 
1091 /**
1092  * wlan_reg_get_opclass_details() - Get details about the current opclass table.
1093  * @pdev: Pointer to pdev.
1094  * @reg_ap_cap: Pointer to reg_ap_cap.
1095  * @n_opclasses: Pointer to number of opclasses.
1096  * @max_supp_op_class: Maximum number of operating classes supported.
1097  * @global_tbl_lookup: Whether to lookup global op class tbl.
1098  * @in_6g_pwr_mode: 6g power type which decides 6G channel list lookup.
1099  *
1100  * Return: QDF_STATUS_SUCCESS if success, else return QDF_STATUS_FAILURE.
1101  */
1102 QDF_STATUS
1103 wlan_reg_get_opclass_details(struct wlan_objmgr_pdev *pdev,
1104 			     struct regdmn_ap_cap_opclass_t *reg_ap_cap,
1105 			     uint8_t *n_opclasses,
1106 			     uint8_t max_supp_op_class,
1107 			     bool global_tbl_lookup,
1108 			     enum supported_6g_pwr_types in_6g_pwr_mode);
1109 
1110 /**
1111  * wlan_reg_get_opclass_for_cur_hwmode() - Get details about the
1112  * opclass table for the current hwmode.
1113  * @pdev: Pointer to pdev.
1114  * @reg_ap_cap: Pointer to reg_ap_cap.
1115  * @n_opclasses: Pointer to number of opclasses.
1116  * @max_supp_op_class: Maximum number of operating classes supported.
1117  * @global_tbl_lookup: Whether to lookup global op class tbl.
1118  * @max_chwidth: Maximum channel width supported by cur hwmode
1119  * @is_80p80_supp: Bool to indicate if 80p80 is supported.
1120  * @in_6g_pwr_mode: 6g power type which decides 6G channel list lookup.
1121  *
1122  * Return: QDF_STATUS_SUCCESS if success, else return QDF_STATUS_FAILURE.
1123  */
1124 QDF_STATUS
1125 wlan_reg_get_opclass_for_cur_hwmode(struct wlan_objmgr_pdev *pdev,
1126 				    struct regdmn_ap_cap_opclass_t *reg_ap_cap,
1127 				    uint8_t *n_opclasses,
1128 				    uint8_t max_supp_op_class,
1129 				    bool global_tbl_lookup,
1130 				    enum phy_ch_width max_chwidth,
1131 				    bool is_80p80_supp,
1132 				    enum supported_6g_pwr_types in_6g_pwr_mode);
1133 
1134 /**
1135  * wlan_reg_get_cc_and_src() - get country code and src
1136  * @psoc: psoc ptr
1137  * @alpha: country code alpha2
1138  *
1139  * Return: country_src
1140  */
1141 enum country_src wlan_reg_get_cc_and_src(struct wlan_objmgr_psoc *psoc,
1142 					 uint8_t *alpha);
1143 
1144 /**
1145  * wlan_regulatory_init() - init regulatory component
1146  *
1147  * Return: Success or Failure
1148  */
1149 QDF_STATUS wlan_regulatory_init(void);
1150 
1151 /**
1152  * wlan_regulatory_deinit() - deinit regulatory component
1153  *
1154  * Return: Success or Failure
1155  */
1156 QDF_STATUS wlan_regulatory_deinit(void);
1157 
1158 /**
1159  * regulatory_psoc_open() - open regulatory component
1160  * @psoc: Pointer to psoc structure
1161  *
1162  * Return: Success or Failure
1163  */
1164 QDF_STATUS regulatory_psoc_open(struct wlan_objmgr_psoc *psoc);
1165 
1166 
1167 /**
1168  * regulatory_psoc_close() - close regulatory component
1169  * @psoc: Pointer to psoc structure
1170  *
1171  * Return: Success or Failure
1172  */
1173 QDF_STATUS regulatory_psoc_close(struct wlan_objmgr_psoc *psoc);
1174 
1175 /**
1176  * regulatory_pdev_open() - Open regulatory component
1177  * @pdev: Pointer to pdev structure
1178  *
1179  * Return: Success or Failure
1180  */
1181 QDF_STATUS regulatory_pdev_open(struct wlan_objmgr_pdev *pdev);
1182 
1183 /**
1184  * regulatory_pdev_close() - Close regulatory component
1185  * @pdev: Pointer to pdev structure.
1186  *
1187  * Return: Success or Failure
1188  */
1189 QDF_STATUS regulatory_pdev_close(struct wlan_objmgr_pdev *pdev);
1190 
1191 /**
1192  * wlan_reg_freq_to_chan() - convert channel freq to channel number
1193  * @pdev: The physical dev to set current country for
1194  * @freq: frequency
1195  *
1196  * Return: true or false
1197  */
1198 uint8_t wlan_reg_freq_to_chan(struct wlan_objmgr_pdev *pdev,
1199 			      qdf_freq_t freq);
1200 
1201 /**
1202  * wlan_reg_legacy_chan_to_freq() - convert chan to freq, for 2G and 5G
1203  * @pdev: pdev pointer
1204  * @chan: channel number
1205  *
1206  * Return: frequency
1207  */
1208 qdf_freq_t wlan_reg_legacy_chan_to_freq(struct wlan_objmgr_pdev *pdev,
1209 					uint8_t chan);
1210 
1211 /**
1212  * wlan_reg_is_us() - reg is us country
1213  * @country: The country information
1214  *
1215  * Return: true or false
1216  */
1217 bool wlan_reg_is_us(uint8_t *country);
1218 
1219 /**
1220  * wlan_reg_is_etsi() - reg is a country in EU
1221  * @country: The country information
1222  *
1223  * Return: true or false
1224  */
1225 bool wlan_reg_is_etsi(uint8_t *country);
1226 
1227 
1228 /**
1229  * wlan_reg_ctry_support_vlp() - Country supports VLP or not
1230  * @country: The country information
1231  *
1232  * Return: true or false
1233  */
1234 bool wlan_reg_ctry_support_vlp(uint8_t *country);
1235 
1236 /**
1237  * wlan_reg_set_country() - Set the current regulatory country
1238  * @pdev: The physical dev to set current country for
1239  * @country: The country information to configure
1240  *
1241  * Return: QDF_STATUS
1242  */
1243 QDF_STATUS wlan_reg_set_country(struct wlan_objmgr_pdev *pdev,
1244 				uint8_t *country);
1245 
1246 /**
1247  * wlan_reg_set_11d_country() - Set the 11d regulatory country
1248  * @pdev: The physical dev to set current country for
1249  * @country: The country information to configure
1250  *
1251  * Return: QDF_STATUS
1252  */
1253 QDF_STATUS wlan_reg_set_11d_country(struct wlan_objmgr_pdev *pdev,
1254 				    uint8_t *country);
1255 
1256 /**
1257  * wlan_reg_register_chan_change_callback() - add chan change cbk
1258  * @psoc: psoc ptr
1259  * @cbk: callback
1260  * @arg: argument
1261  *
1262  * Return: true or false
1263  */
1264 void wlan_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc,
1265 					    void *cbk, void *arg);
1266 
1267 /**
1268  * wlan_reg_unregister_chan_change_callback() - remove chan change cbk
1269  * @psoc: psoc ptr
1270  * @cbk:callback
1271  *
1272  * Return: true or false
1273  */
1274 void wlan_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc,
1275 					      void *cbk);
1276 
1277 /**
1278  * wlan_reg_register_ctry_change_callback() - add country change cbk
1279  * @psoc: psoc ptr
1280  * @cbk: callback
1281  *
1282  * Return: None
1283  */
1284 void wlan_reg_register_ctry_change_callback(struct wlan_objmgr_psoc *psoc,
1285 					    void *cbk);
1286 
1287 /**
1288  * wlan_reg_unregister_ctry_change_callback() - remove country change cbk
1289  * @psoc: psoc ptr
1290  * @cbk:callback
1291  *
1292  * Return: None
1293  */
1294 void wlan_reg_unregister_ctry_change_callback(struct wlan_objmgr_psoc *psoc,
1295 					      void *cbk);
1296 
1297 /**
1298  * wlan_reg_is_11d_offloaded() - 11d offloaded supported
1299  * @psoc: psoc ptr
1300  *
1301  * Return: bool
1302  */
1303 bool wlan_reg_is_11d_offloaded(struct wlan_objmgr_psoc *psoc);
1304 
1305 /**
1306  * wlan_reg_11d_enabled_on_host() - 11d enabled don host
1307  * @psoc: psoc ptr
1308  *
1309  * Return: bool
1310  */
1311 bool wlan_reg_11d_enabled_on_host(struct wlan_objmgr_psoc *psoc);
1312 
1313 /**
1314  * wlan_reg_get_chip_mode() - get supported chip mode
1315  * @pdev: pdev pointer
1316  * @chip_mode: chip mode
1317  *
1318  * Return: QDF STATUS
1319  */
1320 QDF_STATUS wlan_reg_get_chip_mode(struct wlan_objmgr_pdev *pdev,
1321 		uint64_t *chip_mode);
1322 
1323 /**
1324  * wlan_reg_is_11d_scan_inprogress() - checks 11d scan status
1325  * @psoc: psoc ptr
1326  *
1327  * Return: bool
1328  */
1329 bool wlan_reg_is_11d_scan_inprogress(struct wlan_objmgr_psoc *psoc);
1330 /**
1331  * wlan_reg_get_freq_range() - Get 2GHz and 5GHz frequency range
1332  * @pdev: pdev pointer
1333  * @low_2g: low 2GHz frequency range
1334  * @high_2g: high 2GHz frequency range
1335  * @low_5g: low 5GHz frequency range
1336  * @high_5g: high 5GHz frequency range
1337  *
1338  * Return: QDF status
1339  */
1340 QDF_STATUS wlan_reg_get_freq_range(struct wlan_objmgr_pdev *pdev,
1341 		qdf_freq_t *low_2g,
1342 		qdf_freq_t *high_2g,
1343 		qdf_freq_t *low_5g,
1344 		qdf_freq_t *high_5g);
1345 /**
1346  * wlan_reg_get_tx_ops() - get regulatory tx ops
1347  * @psoc: psoc ptr
1348  *
1349  */
1350 struct wlan_lmac_if_reg_tx_ops *
1351 wlan_reg_get_tx_ops(struct wlan_objmgr_psoc *psoc);
1352 
1353 /**
1354  * wlan_reg_get_curr_regdomain() - Get current regdomain in use
1355  * @pdev: pdev pointer
1356  * @cur_regdmn: Current regdomain info
1357  *
1358  * Return: QDF status
1359  */
1360 QDF_STATUS wlan_reg_get_curr_regdomain(struct wlan_objmgr_pdev *pdev,
1361 		struct cur_regdmn_info *cur_regdmn);
1362 
1363 #ifdef WLAN_REG_PARTIAL_OFFLOAD
1364 /**
1365  * wlan_reg_is_regdmn_en302502_applicable() - Find if ETSI EN302_502 radar
1366  * pattern is applicable in the current regulatory domain.
1367  * @pdev:    Pdev ptr.
1368  *
1369  * Return: Boolean.
1370  * True:  If EN302_502 is applicable.
1371  * False: otherwise.
1372  */
1373 bool wlan_reg_is_regdmn_en302502_applicable(struct wlan_objmgr_pdev *pdev);
1374 #endif
1375 
1376 /**
1377  * wlan_reg_modify_pdev_chan_range() - Compute current channel list for the
1378  * modified channel range in the regcap.
1379  * @pdev: pointer to wlan_objmgr_pdev.
1380  *
1381  * Return : QDF_STATUS
1382  */
1383 QDF_STATUS wlan_reg_modify_pdev_chan_range(struct wlan_objmgr_pdev *pdev);
1384 
1385 /**
1386  * wlan_reg_get_phybitmap() - Get phybitmap from regulatory pdev_priv_obj
1387  * @pdev: pdev pointer
1388  * @phybitmap: pointer to phybitmap
1389  *
1390  * Return: QDF STATUS
1391  */
1392 QDF_STATUS wlan_reg_get_phybitmap(struct wlan_objmgr_pdev *pdev,
1393 				  uint16_t *phybitmap);
1394 
1395 #ifdef WLAN_FEATURE_11BE
1396 /**
1397  * wlan_reg_phybitmap_support_11be() - API to check if current reg domain
1398  * supports 11be
1399  * @pdev: PDEV object manager pointer
1400  *
1401  * If the max supported phy mode of current reg domain equals 11be then
1402  * return true else return false.
1403  * Return: bool
1404  */
1405 bool wlan_reg_phybitmap_support_11be(struct wlan_objmgr_pdev *pdev);
1406 #else
1407 static inline bool
wlan_reg_phybitmap_support_11be(struct wlan_objmgr_pdev * pdev)1408 wlan_reg_phybitmap_support_11be(struct wlan_objmgr_pdev *pdev)
1409 {
1410 	return false;
1411 }
1412 #endif
1413 
1414 /**
1415  * wlan_reg_update_pdev_wireless_modes() - Update the wireless_modes in the
1416  * pdev_priv_obj with the input wireless_modes
1417  * @pdev: pointer to wlan_objmgr_pdev.
1418  * @wireless_modes: Wireless modes.
1419  *
1420  * Return : QDF_STATUS
1421  */
1422 QDF_STATUS wlan_reg_update_pdev_wireless_modes(struct wlan_objmgr_pdev *pdev,
1423 					       uint64_t wireless_modes);
1424 /**
1425  * wlan_reg_disable_chan_coex() - Disable Coexisting channels based on the input
1426  * bitmask
1427  * @pdev: pointer to wlan_objmgr_pdev.
1428  * @unii_5g_bitmap: UNII 5G bitmap.
1429  *
1430  * Return : QDF_STATUS
1431  */
1432 #ifdef DISABLE_UNII_SHARED_BANDS
1433 QDF_STATUS wlan_reg_disable_chan_coex(struct wlan_objmgr_pdev *pdev,
1434 				      uint8_t unii_5g_bitmap);
1435 #else
1436 static inline QDF_STATUS
wlan_reg_disable_chan_coex(struct wlan_objmgr_pdev * pdev,uint8_t unii_5g_bitmap)1437 wlan_reg_disable_chan_coex(struct wlan_objmgr_pdev *pdev,
1438 			   uint8_t unii_5g_bitmap)
1439 {
1440 	return QDF_STATUS_SUCCESS;
1441 }
1442 #endif
1443 
1444 #ifdef WLAN_FEATURE_GET_USABLE_CHAN_LIST
1445 /**
1446  * wlan_reg_get_usable_channel() - Get usable channels
1447  * @pdev: Pointer to pdev
1448  * @req_msg: Request msg
1449  * @res_msg: Response msg
1450  * @count: no of usable channels
1451  * @in_6g_pwr_mode: Input 6GHz power mode
1452  *
1453  * Return: qdf status
1454  */
1455 QDF_STATUS
1456 wlan_reg_get_usable_channel(struct wlan_objmgr_pdev *pdev,
1457 			    struct get_usable_chan_req_params req_msg,
1458 			    struct get_usable_chan_res_params *res_msg,
1459 			    uint32_t *count,
1460 			    enum supported_6g_pwr_types in_6g_pwr_mode);
1461 #endif
1462 
1463 #ifdef CONFIG_CHAN_FREQ_API
1464 /**
1465  * wlan_reg_is_same_band_freqs() - Check if two channel frequencies
1466  * have same band
1467  * @freq1: Frequency 1
1468  * @freq2: Frequency 2
1469  *
1470  * Return: true if both the channel frequency has the same band.
1471  */
1472 bool wlan_reg_is_same_band_freqs(qdf_freq_t freq1, qdf_freq_t freq2);
1473 
1474 #define WLAN_REG_IS_SAME_BAND_FREQS(freq1, freq2) \
1475 	wlan_reg_is_same_band_freqs(freq1, freq2)
1476 
1477 /**
1478  * wlan_reg_get_chan_enum_for_freq() - Get channel enum for given channel center
1479  * frequency
1480  * @freq: Channel center frequency
1481  *
1482  * Return: Channel enum
1483  */
1484 enum channel_enum wlan_reg_get_chan_enum_for_freq(qdf_freq_t freq);
1485 
1486 /**
1487  * wlan_reg_get_min_max_bw_for_chan_index() - To get min and max BW supported
1488  * by channel enum
1489  * @pdev: pointer to pdev
1490  * @chan_idx: enum channel_enum
1491  * @min_bw: min bw
1492  * @max_bw: max bw
1493  *
1494  * Return: SUCCESS/FAILURE
1495  */
1496 QDF_STATUS
1497 wlan_reg_get_min_max_bw_for_chan_index(struct wlan_objmgr_pdev *pdev,
1498 				       enum channel_enum chan_idx,
1499 				       uint16_t *min_bw, uint16_t *max_bw);
1500 
1501 /**
1502  * wlan_reg_is_freq_present_in_cur_chan_list() - Check if channel is present
1503  * in the current channel list
1504  * @pdev: pdev pointer
1505  * @freq: Channel center frequency
1506  *
1507  * Return: true if channel is present in current channel list
1508  */
1509 bool wlan_reg_is_freq_present_in_cur_chan_list(struct wlan_objmgr_pdev *pdev,
1510 					       qdf_freq_t freq);
1511 
1512 /**
1513  * wlan_reg_update_nol_history_ch_for_freq() - Set nol-history flag for the
1514  * channels in the list.
1515  *
1516  * @pdev: Pdev ptr
1517  * @ch_list: Input channel list.
1518  * @num_ch: Number of channels.
1519  * @nol_history_ch: Nol history value.
1520  *
1521  * Return: void
1522  */
1523 void wlan_reg_update_nol_history_ch_for_freq(struct wlan_objmgr_pdev *pdev,
1524 					     uint16_t *ch_list,
1525 					     uint8_t num_ch,
1526 					     bool nol_history_ch);
1527 
1528 /**
1529  * wlan_reg_chan_has_dfs_attribute_for_freq() - check channel has dfs
1530  * attribute flag
1531  * @pdev: Pointer to pdev
1532  * @freq: channel center frequency.
1533  *
1534  * This API get chan initial dfs attribute from regdomain
1535  *
1536  * Return: true if chan is dfs, otherwise false
1537  */
1538 bool
1539 wlan_reg_chan_has_dfs_attribute_for_freq(struct wlan_objmgr_pdev *pdev,
1540 					 qdf_freq_t freq);
1541 
1542 /**
1543  * wlan_reg_get_channel_list_with_power_for_freq() - Provide the channel list
1544  * with power
1545  * @pdev: Pointer to pdev
1546  * @ch_list: pointer to the channel list.
1547  * @num_chan: return number of channels
1548  *
1549  * Return: QDF_STATUS
1550  */
1551 QDF_STATUS
1552 wlan_reg_get_channel_list_with_power_for_freq(struct wlan_objmgr_pdev *pdev,
1553 					      struct channel_power *ch_list,
1554 					      uint8_t *num_chan);
1555 
1556 #ifdef CONFIG_REG_6G_PWRMODE
1557 /**
1558  * wlan_reg_get_5g_bonded_channel_state_for_pwrmode() - Get 5G bonded channel
1559  * state.
1560  * @pdev: The physical dev to program country code or regdomain
1561  * @freq: channel frequency.
1562  * @ch_params: channel parameters
1563  * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup.
1564  *
1565  * Return: channel state
1566  */
1567 enum channel_state
1568 wlan_reg_get_5g_bonded_channel_state_for_pwrmode(struct wlan_objmgr_pdev *pdev,
1569 						 qdf_freq_t freq,
1570 						 struct ch_params *ch_params,
1571 						 enum supported_6g_pwr_types
1572 						 in_6g_pwr_type);
1573 #endif
1574 
1575 /**
1576  * wlan_reg_get_2g_bonded_channel_state_for_freq() - Get 2G bonded channel state
1577  * @pdev: The physical dev to program country code or regdomain
1578  * @freq: channel center frequency.
1579  * @sec_ch_freq: Secondary channel center frequency.
1580  * @bw: channel band width
1581  *
1582  * Return: channel state
1583  */
1584 enum channel_state
1585 wlan_reg_get_2g_bonded_channel_state_for_freq(struct wlan_objmgr_pdev *pdev,
1586 					      qdf_freq_t freq,
1587 					      qdf_freq_t sec_ch_freq,
1588 					      enum phy_ch_width bw);
1589 
1590 #ifdef CONFIG_REG_6G_PWRMODE
1591 /**
1592  * wlan_reg_get_channel_state_for_pwrmode() - Get channel state from regulatory
1593  * @pdev: Pointer to pdev
1594  * @freq: channel center frequency.
1595  * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup.
1596  *
1597  * Return: channel state
1598  */
1599 enum channel_state
1600 wlan_reg_get_channel_state_for_pwrmode(
1601 				    struct wlan_objmgr_pdev *pdev,
1602 				    qdf_freq_t freq,
1603 				    enum supported_6g_pwr_types in_6g_pwr_type);
1604 #endif
1605 
1606 #ifdef CONFIG_REG_CLIENT
1607 /**
1608  * wlan_reg_get_channel_state_from_secondary_list_for_freq() - Get channel state
1609  * from secondary regulatory current channel list
1610  * @pdev: Pointer to pdev
1611  * @freq: channel center frequency.
1612  *
1613  * Return: channel state
1614  */
1615 enum channel_state wlan_reg_get_channel_state_from_secondary_list_for_freq(
1616 						struct wlan_objmgr_pdev *pdev,
1617 						qdf_freq_t freq);
1618 
1619 /**
1620  * wlan_reg_get_channel_list_with_power() - Provide channel list with tx power
1621  * @pdev: Pointer to pdev
1622  * @ch_list: pointer to the channel list.
1623  * @num_chan: Number of channels which has been filed in ch_list
1624  * @in_6g_pwr_type: 6G power type corresponding to which 6G channels needs to
1625  * be provided
1626  *
1627  * Return: QDF_STATUS
1628  */
1629 QDF_STATUS
1630 wlan_reg_get_channel_list_with_power(
1631 				struct wlan_objmgr_pdev *pdev,
1632 				struct channel_power *ch_list,
1633 				uint8_t *num_chan,
1634 				enum supported_6g_pwr_types in_6g_pwr_type);
1635 #endif
1636 
1637 #ifdef WLAN_FEATURE_11BE
1638 /**
1639  * wlan_reg_is_punc_bitmap_valid() - is puncture bitmap valid or not
1640  * @bw: Input channel width.
1641  * @puncture_bitmap: Input puncture bitmap.
1642  *
1643  * Return: true if given puncture bitmap is valid
1644  */
1645 bool wlan_reg_is_punc_bitmap_valid(enum phy_ch_width bw,
1646 				   uint16_t puncture_bitmap);
1647 
1648 /**
1649  * wlan_reg_find_nearest_puncture_pattern() - is proposed bitmap valid or not
1650  * @bw: Input channel width.
1651  * @proposed_bitmap: Input puncture bitmap.
1652  *
1653  * Return: Radar bitmap if it is valid.
1654  */
1655 uint16_t wlan_reg_find_nearest_puncture_pattern(enum phy_ch_width bw,
1656 						uint16_t proposed_bitmap);
1657 
1658 /**
1659  * wlan_reg_extract_puncture_by_bw() - generate new puncture bitmap from
1660  *                                     original puncture bitmap and bandwidth
1661  *                                     based on new bandwidth
1662  * @ori_bw: original bandwidth
1663  * @ori_puncture_bitmap: original puncture bitmap
1664  * @freq: frequency of primary channel
1665  * @cen320_freq: center frequency of 320 MHZ if channel width is 320
1666  * @new_bw: new bandwidth
1667  * @new_puncture_bitmap: output of puncture bitmap
1668  *
1669  * Return: QDF_STATUS
1670  */
1671 QDF_STATUS wlan_reg_extract_puncture_by_bw(enum phy_ch_width ori_bw,
1672 					   uint16_t ori_puncture_bitmap,
1673 					   qdf_freq_t freq,
1674 					   qdf_freq_t cen320_freq,
1675 					   enum phy_ch_width new_bw,
1676 					   uint16_t *new_puncture_bitmap);
1677 
1678 /**
1679  * wlan_reg_set_create_punc_bitmap() - set is_create_punc_bitmap of ch_params
1680  * @ch_params: ch_params to set
1681  * @is_create_punc_bitmap: is create punc bitmap
1682  *
1683  * Return: NULL
1684  */
1685 void wlan_reg_set_create_punc_bitmap(struct ch_params *ch_params,
1686 				     bool is_create_punc_bitmap);
1687 
1688 #ifdef CONFIG_REG_CLIENT
1689 /**
1690  * wlan_reg_apply_puncture() - apply puncture to regulatory
1691  * @pdev: pdev
1692  * @puncture_bitmap: puncture bitmap
1693  * @freq: sap operation freq
1694  * @bw: band width
1695  * @cen320_freq: 320 MHz center freq
1696  *
1697  * When start ap, apply puncture to regulatory, set static puncture flag
1698  * for all 20 MHz sub channels of current bonded channel in master channel list
1699  * of pdev, and disable 20 MHz sub channel in current channel list if static
1700  * puncture flag is set.
1701  *
1702  * Return: QDF_STATUS
1703  */
1704 QDF_STATUS wlan_reg_apply_puncture(struct wlan_objmgr_pdev *pdev,
1705 				   uint16_t puncture_bitmap,
1706 				   qdf_freq_t freq,
1707 				   enum phy_ch_width bw,
1708 				   qdf_freq_t cen320_freq);
1709 
1710 /**
1711  * wlan_reg_remove_puncture() - Remove puncture from regulatory
1712  * @pdev: pdev
1713  *
1714  * When stop ap, remove puncture from regulatory, clear static puncture flag
1715  * for all 20 MHz sub channels in master channel list of pdev, and don't disable
1716  * 20 MHz sub channel in current channel list if static puncture flag is not
1717  * set.
1718  *
1719  * Return: QDF_STATUS
1720  */
1721 QDF_STATUS wlan_reg_remove_puncture(struct wlan_objmgr_pdev *pdev);
1722 #else
1723 static inline
wlan_reg_apply_puncture(struct wlan_objmgr_pdev * pdev,uint16_t puncture_bitmap,qdf_freq_t freq,enum phy_ch_width bw,qdf_freq_t cen320_freq)1724 QDF_STATUS wlan_reg_apply_puncture(struct wlan_objmgr_pdev *pdev,
1725 				   uint16_t puncture_bitmap,
1726 				   qdf_freq_t freq,
1727 				   enum phy_ch_width bw,
1728 				   qdf_freq_t cen320_freq)
1729 {
1730 	return QDF_STATUS_SUCCESS;
1731 }
1732 
1733 static inline
wlan_reg_remove_puncture(struct wlan_objmgr_pdev * pdev)1734 QDF_STATUS wlan_reg_remove_puncture(struct wlan_objmgr_pdev *pdev)
1735 {
1736 	return QDF_STATUS_SUCCESS;
1737 }
1738 #endif
1739 #ifdef CONFIG_REG_6G_PWRMODE
1740 /**
1741  * wlan_reg_fill_channel_list_for_pwrmode() - Fills the reg_channel_list
1742  * (list of channels)
1743  * @pdev: Pointer to struct wlan_objmgr_pdev.
1744  * @freq: Center frequency of the primary channel in MHz
1745  * @sec_ch_2g_freq: Secondary channel center frequency.
1746  * @ch_width: Channel width of type 'enum phy_ch_width'.
1747  * @band_center_320: Center frequency of 320MHZ channel.
1748  * @chan_list: Pointer to struct reg_channel_list to be filled (Output param).
1749  * @in_6g_pwr_type: 6g power type which decides 6G channel list lookup.
1750  * @treat_nol_chan_as_disabled: bool to treat nol channel as enabled or
1751  * disabled. If set to true, nol chan is considered as disabled in chan search.
1752  *
1753  * Return: None
1754  */
1755 void wlan_reg_fill_channel_list_for_pwrmode(
1756 				struct wlan_objmgr_pdev *pdev,
1757 				qdf_freq_t freq,
1758 				qdf_freq_t sec_ch_2g_freq,
1759 				enum phy_ch_width ch_width,
1760 				qdf_freq_t band_center_320,
1761 				struct reg_channel_list *chan_list,
1762 				enum supported_6g_pwr_types in_6g_pwr_type,
1763 				bool treat_nol_chan_as_disabled);
1764 #endif
1765 #else
1766 static inline
wlan_reg_extract_puncture_by_bw(enum phy_ch_width ori_bw,uint16_t ori_puncture_bitmap,qdf_freq_t freq,qdf_freq_t cen320_freq,enum phy_ch_width new_bw,uint16_t * new_puncture_bitmap)1767 QDF_STATUS wlan_reg_extract_puncture_by_bw(enum phy_ch_width ori_bw,
1768 					   uint16_t ori_puncture_bitmap,
1769 					   qdf_freq_t freq,
1770 					   qdf_freq_t cen320_freq,
1771 					   enum phy_ch_width new_bw,
1772 					   uint16_t *new_puncture_bitmap)
1773 {
1774 	return QDF_STATUS_SUCCESS;
1775 }
1776 
wlan_reg_set_create_punc_bitmap(struct ch_params * ch_params,bool is_create_punc_bitmap)1777 static inline void wlan_reg_set_create_punc_bitmap(struct ch_params *ch_params,
1778 						   bool is_create_punc_bitmap)
1779 {
1780 }
1781 
1782 static inline
wlan_reg_apply_puncture(struct wlan_objmgr_pdev * pdev,uint16_t puncture_bitmap,qdf_freq_t freq,enum phy_ch_width bw,qdf_freq_t cen320_freq)1783 QDF_STATUS wlan_reg_apply_puncture(struct wlan_objmgr_pdev *pdev,
1784 				   uint16_t puncture_bitmap,
1785 				   qdf_freq_t freq,
1786 				   enum phy_ch_width bw,
1787 				   qdf_freq_t cen320_freq)
1788 {
1789 	return QDF_STATUS_SUCCESS;
1790 }
1791 
1792 static inline
wlan_reg_remove_puncture(struct wlan_objmgr_pdev * pdev)1793 QDF_STATUS wlan_reg_remove_puncture(struct wlan_objmgr_pdev *pdev)
1794 {
1795 	return QDF_STATUS_SUCCESS;
1796 }
1797 
1798 static inline
wlan_reg_find_nearest_puncture_pattern(enum phy_ch_width bw,uint16_t proposed_bitmap)1799 uint16_t wlan_reg_find_nearest_puncture_pattern(enum phy_ch_width bw,
1800 						uint16_t proposed_bitmap)
1801 {
1802 	return 0;
1803 }
1804 #endif
1805 
1806 #ifdef CONFIG_REG_6G_PWRMODE
1807 /**
1808  * wlan_reg_set_channel_params_for_pwrmode() - Sets channel parameters for
1809  * given bandwidth
1810  * @pdev: The physical dev to program country code or regdomain
1811  * @freq: channel center frequency.
1812  * @sec_ch_2g_freq: Secondary channel center frequency.
1813  * @ch_params: pointer to the channel parameters.
1814  * @in_6g_pwr_mode: 6g power type which decides 6G channel list lookup.
1815  *
1816  * Return: None
1817  */
1818 void wlan_reg_set_channel_params_for_pwrmode(struct wlan_objmgr_pdev *pdev,
1819 					     qdf_freq_t freq,
1820 					     qdf_freq_t sec_ch_2g_freq,
1821 					     struct ch_params *ch_params,
1822 					     enum supported_6g_pwr_types
1823 					     in_6g_pwr_mode);
1824 #endif
1825 
1826 /**
1827  * wlan_reg_get_channel_reg_power_for_freq() - Provide the channel
1828  * regulatory power
1829  * @pdev: pdev ptr
1830  * @freq: channel center frequency
1831  *
1832  * Return: int
1833  */
1834 uint8_t wlan_reg_get_channel_reg_power_for_freq(struct wlan_objmgr_pdev *pdev,
1835 						qdf_freq_t freq);
1836 
1837 /**
1838  * wlan_reg_get_bonded_chan_entry() - Fetch the bonded channel pointer given a
1839  * frequency and channel width.
1840  * @freq: Input frequency in MHz.
1841  * @chwidth: Input channel width of enum phy_ch_width.
1842  * @cen320_freq: 320 MHz center frequency in MHz. In 6GHz band 320 MHz channel
1843  *               are overlapping. The exact band should be therefore identified
1844  *               by the center frequency of the 320 Mhz channel.
1845  *
1846  * Return: A valid bonded channel pointer if found, else NULL.
1847  */
1848 const struct bonded_channel_freq *
1849 wlan_reg_get_bonded_chan_entry(qdf_freq_t freq, enum phy_ch_width chwidth,
1850 			       qdf_freq_t cen320_freq);
1851 
1852 /**
1853  * wlan_reg_update_nol_ch_for_freq() - set nol channel
1854  * @pdev: pdev ptr
1855  * @chan_freq_list: channel list to be returned
1856  * @num_ch: number of channels
1857  * @nol_ch: nol flag
1858  *
1859  * Return: void
1860  */
1861 void wlan_reg_update_nol_ch_for_freq(struct wlan_objmgr_pdev *pdev,
1862 				     uint16_t *chan_freq_list,
1863 				     uint8_t num_ch,
1864 				     bool nol_ch);
1865 
1866 /**
1867  * wlan_reg_is_dfs_for_freq() - Checks the channel state for DFS
1868  * @pdev: pdev ptr
1869  * @freq: Channel center frequency
1870  *
1871  * Return: true or false
1872  */
1873 bool wlan_reg_is_dfs_for_freq(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq);
1874 
1875 /**
1876  * wlan_reg_is_dsrc_freq() - Checks if the channel is dsrc channel or not
1877  * @freq: Channel center frequency
1878  *
1879  * Return: true or false
1880  */
1881 bool wlan_reg_is_dsrc_freq(qdf_freq_t freq);
1882 
1883 /**
1884  * wlan_reg_is_passive_or_disable_for_pwrmode() - Checks chan state for passive
1885  * and disabled
1886  * @pdev: pdev ptr
1887  * @freq: Channel center frequency
1888  * @in_6g_pwr_mode: Input 6GHz power mode
1889  *
1890  * Return: true or false
1891  */
1892 bool wlan_reg_is_passive_or_disable_for_pwrmode(
1893 				struct wlan_objmgr_pdev *pdev,
1894 				qdf_freq_t freq,
1895 				enum supported_6g_pwr_types in_6g_pwr_mode);
1896 
1897 #ifdef CONFIG_REG_6G_PWRMODE
1898 /**
1899  * wlan_reg_is_disable_for_pwrmode() - Checks chan state for disabled
1900  * @pdev: pdev ptr
1901  * @freq: Channel center frequency
1902  * @in_6g_pwr_mode: 6g power type which decides 6G channel list lookup.
1903  *
1904  * Return: true or false
1905  */
1906 bool wlan_reg_is_disable_for_pwrmode(
1907 				  struct wlan_objmgr_pdev *pdev,
1908 				  qdf_freq_t freq,
1909 				  enum supported_6g_pwr_types in_6g_pwr_mode);
1910 #endif
1911 
1912 #ifdef CONFIG_REG_CLIENT
1913 /**
1914  * wlan_reg_is_disable_in_secondary_list_for_freq() - Checks in the secondary
1915  * channel list to see if chan state is disabled
1916  * @pdev: pdev ptr
1917  * @freq: Channel center frequency
1918  *
1919  * Return: true or false
1920  */
1921 bool wlan_reg_is_disable_in_secondary_list_for_freq(
1922 						struct wlan_objmgr_pdev *pdev,
1923 						qdf_freq_t freq);
1924 
1925 /**
1926  * wlan_reg_is_enable_in_secondary_list_for_freq() - Checks in the secondary
1927  * channel list to see if chan state is enabled
1928  * @pdev: pdev ptr
1929  * @freq: Channel center frequency
1930  *
1931  * Return: true or false
1932  */
1933 bool wlan_reg_is_enable_in_secondary_list_for_freq(
1934 						struct wlan_objmgr_pdev *pdev,
1935 						qdf_freq_t freq);
1936 
1937 /**
1938  * wlan_reg_is_dfs_in_secondary_list_for_freq() - hecks the channel state for
1939  * DFS from the secondary channel list
1940  * @pdev: pdev ptr
1941  * @freq: Channel center frequency
1942  *
1943  * Return: true or false
1944  */
1945 bool wlan_reg_is_dfs_in_secondary_list_for_freq(struct wlan_objmgr_pdev *pdev,
1946 						qdf_freq_t freq);
1947 
1948 /**
1949  * wlan_reg_get_chan_pwr_attr_from_secondary_list_for_freq() - get channel
1950  * power attributions from secondary channel list
1951  * @pdev: pdev ptr
1952  * @freq: channel center frequency
1953  * @is_psd: pointer to retrieve value whether channel power is psd
1954  * @tx_power: pointer to retrieve value of channel eirp tx power
1955  * @psd_eirp: pointer to retrieve value of channel psd eirp power
1956  * @flags: pointer to retrieve value of channel flags
1957  *
1958  * Return: QDF STATUS
1959  */
1960 QDF_STATUS
1961 wlan_reg_get_chan_pwr_attr_from_secondary_list_for_freq(
1962 				struct wlan_objmgr_pdev *pdev, qdf_freq_t freq,
1963 				bool *is_psd, uint16_t *tx_power,
1964 				uint16_t *psd_eirp, uint32_t *flags);
1965 
1966 /**
1967  * wlan_reg_decide_6ghz_power_within_bw_for_freq() - decide minimum tx power in
1968  * bandwidth and 6 GHz power type
1969  * @pdev: pdev ptr
1970  * @freq: channel center frequency
1971  * @bw: channel bandwidth
1972  * @is_psd: pointer to retrieve value whether channel power is psd
1973  * @min_tx_power: pointer to retrieve minimum tx power in bandwidth
1974  * @min_psd_eirp: pointer to retrieve minimum psd eirp in bandwidth
1975  * @power_type: pointer to retrieve 6 GHz power type
1976  * @pwr_mode: 6g power type which decides 6G channel list lookup.
1977  * @input_punc_bitmap: Input  puncture bitmap
1978  *
1979  * Return: QDF STATUS
1980  */
1981 QDF_STATUS
1982 wlan_reg_decide_6ghz_power_within_bw_for_freq(struct wlan_objmgr_pdev *pdev,
1983 					      qdf_freq_t freq,
1984 					      enum phy_ch_width bw,
1985 					      bool *is_psd,
1986 					      uint16_t *min_tx_power,
1987 					      int16_t *min_psd_eirp,
1988 					      enum reg_6g_ap_type *power_type,
1989 					      enum supported_6g_pwr_types pwr_mode,
1990 					      uint16_t input_punc_bitmap);
1991 #endif
1992 
1993 /**
1994  * wlan_reg_is_passive_for_freq() - Check the channel flags to see if the
1995  * passive flag is set
1996  * @pdev: pdev ptr
1997  * @freq: Channel center frequency
1998  *
1999  * Return: true or false
2000  */
2001 bool wlan_reg_is_passive_for_freq(struct wlan_objmgr_pdev *pdev,
2002 				  qdf_freq_t freq);
2003 
2004 /**
2005  * wlan_reg_freq_to_band() - Get band from channel number
2006  * @freq:Channel frequency in MHz
2007  *
2008  * Return: wifi band
2009  */
2010 enum reg_wifi_band wlan_reg_freq_to_band(qdf_freq_t freq);
2011 
2012 /**
2013  * wlan_reg_min_chan_freq() - Minimum channel frequency supported
2014  *
2015  * Return: frequency
2016  */
2017 qdf_freq_t wlan_reg_min_chan_freq(void);
2018 
2019 /**
2020  * wlan_reg_max_chan_freq() - Return max. frequency
2021  *
2022  * Return: frequency
2023  */
2024 qdf_freq_t wlan_reg_max_chan_freq(void);
2025 
2026 /**
2027  * wlan_reg_freq_width_to_chan_op_class() -Get op class from freq
2028  * @pdev: pdev ptr
2029  * @freq: channel frequency
2030  * @chan_width: channel width
2031  * @global_tbl_lookup: whether to look up global table
2032  * @behav_limit: behavior limit
2033  * @op_class: operating class
2034  * @chan_num: channel number
2035  *
2036  * Return: void
2037  */
2038 void wlan_reg_freq_width_to_chan_op_class(struct wlan_objmgr_pdev *pdev,
2039 					  qdf_freq_t freq,
2040 					  uint16_t chan_width,
2041 					  bool global_tbl_lookup,
2042 					  uint16_t behav_limit,
2043 					  uint8_t *op_class,
2044 					  uint8_t *chan_num);
2045 
2046 /**
2047  * wlan_reg_freq_width_to_chan_op_class_auto() - convert frequency to
2048  * operating class,channel
2049  * @pdev: pdev pointer
2050  * @freq: channel frequency in mhz
2051  * @chan_width: channel width
2052  * @global_tbl_lookup: whether to lookup global op class tbl
2053  * @behav_limit: behavior limit
2054  * @op_class: operating class
2055  * @chan_num: channel number
2056  *
2057  * Return: Void.
2058  */
2059 void wlan_reg_freq_width_to_chan_op_class_auto(struct wlan_objmgr_pdev *pdev,
2060 					       qdf_freq_t freq,
2061 					       uint16_t chan_width,
2062 					       bool global_tbl_lookup,
2063 					       uint16_t behav_limit,
2064 					       uint8_t *op_class,
2065 					       uint8_t *chan_num);
2066 
2067 /**
2068  * wlan_reg_freq_to_chan_op_class() - Converts freq to oper class
2069  * @pdev: pdev ptr
2070  * @freq: channel frequency
2071  * @global_tbl_lookup: whether to look up global table
2072  * @behav_limit: behavior limit
2073  * @op_class: operating class
2074  * @chan_num: channel number
2075  *
2076  * Return: void
2077  */
2078 void wlan_reg_freq_to_chan_op_class(struct wlan_objmgr_pdev *pdev,
2079 				    qdf_freq_t freq,
2080 				    bool global_tbl_lookup,
2081 				    uint16_t behav_limit,
2082 				    uint8_t *op_class,
2083 				    uint8_t *chan_num);
2084 
2085 /**
2086  * wlan_reg_is_freq_in_country_opclass() - checks frequency in (ctry, op class)
2087  *                                         pair
2088  * @pdev: pdev ptr
2089  * @country: country information
2090  * @op_class: operating class
2091  * @chan_freq: channel frequency
2092  *
2093  * Return: bool
2094  */
2095 bool wlan_reg_is_freq_in_country_opclass(struct wlan_objmgr_pdev *pdev,
2096 					 const uint8_t country[3],
2097 					 uint8_t op_class,
2098 					 qdf_freq_t chan_freq);
2099 /**
2100  * wlan_reg_get_5g_bonded_channel_and_state_for_pwrmode()- Return the channel
2101  * state for a 5G or 6G channel frequency based on the channel width and
2102  * bonded channel.
2103  * @pdev: Pointer to pdev.
2104  * @freq: Channel center frequency.
2105  * @bw: Channel Width.
2106  * @bonded_chan_ptr_ptr: Pointer to bonded_channel_freq.
2107  * @in_6g_pwr_mode: 6g power type which decides 6G channel list lookup.
2108  * @input_puncture_bitmap: Input puncture bitmap
2109  *
2110  * Return: Channel State
2111  */
2112 enum channel_state
2113 wlan_reg_get_5g_bonded_channel_and_state_for_pwrmode(
2114 					struct wlan_objmgr_pdev *pdev,
2115 					uint16_t freq,
2116 					enum phy_ch_width bw,
2117 					const
2118 					struct bonded_channel_freq
2119 					**bonded_chan_ptr_ptr,
2120 					enum supported_6g_pwr_types
2121 					in_6g_pwr_mode,
2122 					uint16_t input_puncture_bitmap);
2123 #endif /*CONFIG_CHAN_FREQ_API */
2124 
2125 /**
2126  * wlan_reg_get_op_class_width() - Get operating class chan width
2127  * @pdev: pdev ptr
2128  * @op_class: operating class
2129  * @global_tbl_lookup: whether to look up global table
2130  *
2131  * Return: channel width of op class
2132  */
2133 uint16_t wlan_reg_get_op_class_width(struct wlan_objmgr_pdev *pdev,
2134 				     uint8_t op_class,
2135 				     bool global_tbl_lookup);
2136 
2137 /**
2138  * wlan_reg_is_5ghz_op_class() - Check if the input opclass is a 5GHz opclass.
2139  * @country: Country code.
2140  * @op_class: Operating class.
2141  *
2142  * Return: Return true if input the opclass is a 5GHz opclass,
2143  * else return false.
2144  */
2145 bool wlan_reg_is_5ghz_op_class(const uint8_t *country, uint8_t op_class);
2146 
2147 /**
2148  * wlan_reg_is_2ghz_op_class() - Check if the input opclass is a 2.4GHz opclass.
2149  * @country: Country code.
2150  * @op_class: Operating class.
2151  *
2152  * Return: Return true if input the opclass is a 2.4GHz opclass,
2153  * else return false.
2154  */
2155 bool wlan_reg_is_2ghz_op_class(const uint8_t *country, uint8_t op_class);
2156 
2157 /**
2158  * wlan_reg_is_6ghz_op_class() - Whether 6ghz oper class
2159  * @pdev: pdev ptr
2160  * @op_class: operating class
2161  *
2162  * Return: bool
2163  */
2164 bool wlan_reg_is_6ghz_op_class(struct wlan_objmgr_pdev *pdev,
2165 			       uint8_t op_class);
2166 
2167 #ifdef CONFIG_REG_CLIENT
2168 /**
2169  * wlan_reg_is_6ghz_supported() - Whether 6ghz is supported
2170  * @psoc: psoc ptr
2171  *
2172  * Return: bool
2173  */
2174 bool wlan_reg_is_6ghz_supported(struct wlan_objmgr_psoc *psoc);
2175 #endif
2176 
2177 #ifdef HOST_OPCLASS_EXT
2178 /**
2179  * wlan_reg_country_chan_opclass_to_freq() - Convert channel number to
2180  * frequency based on country code and op class
2181  * @pdev: pdev object.
2182  * @country: country code.
2183  * @chan: IEEE Channel Number.
2184  * @op_class: Opclass.
2185  * @strict: flag to find channel from matched operating class code.
2186  *
2187  * Look up (channel, operating class) pair in country operating class tables
2188  * and return the channel frequency.
2189  * If not found and "strict" flag is false, try to get frequency (Mhz) by
2190  * channel number only.
2191  *
2192  * Return: Channel center frequency else return 0.
2193  */
2194 qdf_freq_t
2195 wlan_reg_country_chan_opclass_to_freq(struct wlan_objmgr_pdev *pdev,
2196 				      const uint8_t country[3],
2197 				      uint8_t chan, uint8_t op_class,
2198 				      bool strict);
2199 #endif
2200 
2201 /**
2202  * wlan_reg_chan_opclass_to_freq() - Convert channel number and opclass to frequency
2203  * @chan: IEEE Channel Number.
2204  * @op_class: Opclass.
2205  * @global_tbl_lookup: Global table lookup.
2206  *
2207  * Return: Channel center frequency else return 0.
2208  */
2209 uint16_t wlan_reg_chan_opclass_to_freq(uint8_t chan,
2210 				       uint8_t op_class,
2211 				       bool global_tbl_lookup);
2212 
2213 /**
2214  * wlan_reg_compute_6g_center_freq_from_cfi() - Given the IEEE value of the
2215  * 6 GHz center frequency, find the 6 GHz center frequency.
2216  * @ieee_6g_cfi: IEEE value of 6 GHz cfi
2217  *
2218  * Return: Center frequency in MHz
2219  */
2220 qdf_freq_t wlan_reg_compute_6g_center_freq_from_cfi(uint8_t ieee_6g_cfi);
2221 
2222 /**
2223  * wlan_reg_chan_opclass_to_freq_auto() - Convert channel number and opclass to
2224  * frequency
2225  * @chan: IEEE channel number
2226  * @op_class: Operating class of channel
2227  * @global_tbl_lookup: Flag to determine if global table has to be looked up
2228  *
2229  * Return: Channel center frequency if valid, else zero
2230  */
2231 
2232 qdf_freq_t wlan_reg_chan_opclass_to_freq_auto(uint8_t chan, uint8_t op_class,
2233 					      bool global_tbl_lookup);
2234 
2235 #ifdef CHECK_REG_PHYMODE
2236 /**
2237  * wlan_reg_get_max_phymode() - Find the best possible phymode given a
2238  * phymode, a frequency, and per-country regulations
2239  * @pdev: pdev pointer
2240  * @phy_in: phymode that the user requested
2241  * @freq: current operating center frequency
2242  *
2243  * Return: maximum phymode allowed in current country that is <= phy_in
2244  */
2245 enum reg_phymode wlan_reg_get_max_phymode(struct wlan_objmgr_pdev *pdev,
2246 					  enum reg_phymode phy_in,
2247 					  qdf_freq_t freq);
2248 #else
2249 static inline enum reg_phymode
wlan_reg_get_max_phymode(struct wlan_objmgr_pdev * pdev,enum reg_phymode phy_in,qdf_freq_t freq)2250 wlan_reg_get_max_phymode(struct wlan_objmgr_pdev *pdev,
2251 			 enum reg_phymode phy_in,
2252 			 qdf_freq_t freq)
2253 {
2254 	return REG_PHYMODE_INVALID;
2255 }
2256 #endif /* CHECK_REG_PHYMODE */
2257 
2258 #ifdef CONFIG_REG_CLIENT
2259 /**
2260  * wlan_reg_band_bitmap_to_band_info() - Convert the band_bitmap to a
2261  *	band_info enum
2262  * @band_bitmap: bitmap on top of reg_wifi_band of bands enabled
2263  *
2264  * Return: BAND_ALL if both 2G and 5G band is enabled
2265  *	BAND_2G if 2G is enabled but 5G isn't
2266  *	BAND_5G if 5G is enabled but 2G isn't
2267  */
2268 enum band_info wlan_reg_band_bitmap_to_band_info(uint32_t band_bitmap);
2269 
2270 /**
2271  * wlan_reg_update_tx_power_on_ctry_change() - Update tx power during
2272  * country code change (without channel change) OR if fcc constraint is set
2273  * @pdev: Pointer to pdev
2274  * @vdev_id: vdev ID
2275  *
2276  * Return: QDF_STATUS
2277  */
2278 QDF_STATUS
2279 wlan_reg_update_tx_power_on_ctry_change(struct wlan_objmgr_pdev *pdev,
2280 					uint8_t vdev_id);
2281 
2282 /**
2283  * wlan_reg_modify_indoor_concurrency() - Update the indoor concurrency list
2284  * in regulatory pdev context
2285  *
2286  * @pdev: pointer to pdev
2287  * @vdev_id: vdev id
2288  * @freq: frequency
2289  * @width: channel width
2290  * @add: add or delete entry
2291  *
2292  * Return: QDF_STATUS
2293  */
2294 QDF_STATUS
2295 wlan_reg_modify_indoor_concurrency(struct wlan_objmgr_pdev *pdev,
2296 				   uint8_t vdev_id, uint32_t freq,
2297 				   enum phy_ch_width width, bool add);
2298 #endif
2299 /**
2300  * wlan_reg_recompute_current_chan_list() - Recompute the current channel list
2301  * based on the regulatory change
2302  *
2303  * @psoc: pointer to psoc
2304  * @pdev: pointer to pdev
2305  *
2306  * Return: QDF_STATUS
2307  */
2308 QDF_STATUS
2309 wlan_reg_recompute_current_chan_list(struct wlan_objmgr_psoc *psoc,
2310 				     struct wlan_objmgr_pdev *pdev);
2311 
2312 #if defined(CONFIG_BAND_6GHZ)
2313 /**
2314  * wlan_reg_get_cur_6g_ap_pwr_type() - Get the current 6G regulatory AP power
2315  * type.
2316  * @pdev: Pointer to PDEV object.
2317  * @reg_cur_6g_ap_pwr_type: The current regulatory 6G AP power type ie.
2318  * LPI/SP/VLP.
2319  *
2320  * Return: QDF_STATUS.
2321  */
2322 QDF_STATUS
2323 wlan_reg_get_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev,
2324 				enum reg_6g_ap_type *reg_cur_6g_ap_pwr_type);
2325 
2326 /**
2327  * wlan_reg_get_cur_6g_client_type() - Get the current 6G regulatory client
2328  * type.
2329  * @pdev: Pointer to PDEV object.
2330  * @reg_cur_6g_client_mobility_type: The current regulatory 6G client type ie.
2331  * default/subordinate.
2332  *
2333  * Return: QDF_STATUS.
2334  */
2335 QDF_STATUS
2336 wlan_reg_get_cur_6g_client_type(struct wlan_objmgr_pdev *pdev,
2337 				enum reg_6g_client_type
2338 				*reg_cur_6g_client_mobility_type);
2339 
2340 /**
2341  * wlan_reg_set_cur_6ghz_client_type() - Set the cur 6 GHz regulatory client
2342  * type to the given value.
2343  * @pdev: Pointer to PDEV object.
2344  * @in_6ghz_client_type: Input Client type to be set ie. default/subordinate.
2345  *
2346  * Return: QDF_STATUS.
2347  */
2348 QDF_STATUS
2349 wlan_reg_set_cur_6ghz_client_type(struct wlan_objmgr_pdev *pdev,
2350 				  enum reg_6g_client_type in_6ghz_client_type);
2351 
2352 /**
2353  * wlan_reg_set_6ghz_client_type_from_target() - Set the current 6 GHz
2354  * regulatory client type to the value received from target.
2355  * @pdev: Pointer to PDEV object.
2356  *
2357  * Return: QDF_STATUS.
2358  */
2359 QDF_STATUS
2360 wlan_reg_set_6ghz_client_type_from_target(struct wlan_objmgr_pdev *pdev);
2361 
2362 /**
2363  * wlan_reg_get_rnr_tpe_usable() - Tells if RNR IE is applicable for current
2364  * domain.
2365  * @pdev: Pointer to PDEV object.
2366  * @reg_rnr_tpe_usable: Pointer to hold the bool value, true if RNR IE is
2367  * applicable, else false.
2368  *
2369  * Return: QDF_STATUS.
2370  */
2371 QDF_STATUS wlan_reg_get_rnr_tpe_usable(struct wlan_objmgr_pdev *pdev,
2372 				       bool *reg_rnr_tpe_usable);
2373 
2374 /**
2375  * wlan_reg_get_unspecified_ap_usable() - Tells if AP type unspecified by 802.11
2376  * can be used or not.
2377  * @pdev: Pointer to PDEV object.
2378  * @reg_unspecified_ap_usable: Pointer to hold the bool value, true if
2379  * unspecified AP types can be used in the IE, else false.
2380  *
2381  * Return: QDF_STATUS.
2382  */
2383 QDF_STATUS wlan_reg_get_unspecified_ap_usable(struct wlan_objmgr_pdev *pdev,
2384 					      bool *reg_unspecified_ap_usable);
2385 
2386 /**
2387  * wlan_reg_is_6g_psd_power() - Checks if given pdev is PSD power
2388  * @pdev: pdev ptr
2389  *
2390  * Return: true if pdev is PSD power or false otherwise
2391  */
2392 bool wlan_reg_is_6g_psd_power(struct wlan_objmgr_pdev *pdev);
2393 
2394 /**
2395  * wlan_reg_get_6g_chan_ap_power() - Finds the AP TX power for the given channel
2396  *	frequency
2397  *
2398  * @pdev: pdev ptr
2399  * @chan_freq: channel frequency
2400  * @is_psd: is channel PSD or not
2401  * @tx_power: transmit power to fill for chan_freq
2402  * @eirp_psd_power: EIRP power, will only be filled if is_psd is true
2403  *
2404  * Return: QDF_STATUS
2405  */
2406 QDF_STATUS wlan_reg_get_6g_chan_ap_power(struct wlan_objmgr_pdev *pdev,
2407 					 qdf_freq_t chan_freq, bool *is_psd,
2408 					 uint16_t *tx_power,
2409 					 uint16_t *eirp_psd_power);
2410 
2411 /**
2412  * wlan_reg_get_client_power_for_connecting_ap() - Find the channel information
2413  *	when device is operating as a client
2414  *
2415  * @pdev: pdev ptr
2416  * @ap_type: type of AP that device is connected to
2417  * @chan_freq: channel frequency
2418  * @is_psd: is channel PSD or not
2419  * @tx_power: transmit power to fill for chan_freq
2420  * @eirp_psd_power: EIRP power, will only be filled if is_psd is true
2421  *
2422  * This function is meant to be called to find the channel frequency power
2423  * information for a client when the device is operating as a client. It will
2424  * fill in the parameters tx_power and eirp_psd_power. eirp_psd_power will
2425  * only be filled if the channel is PSD.
2426  *
2427  * Return: QDF_STATUS
2428  */
2429 QDF_STATUS
2430 wlan_reg_get_client_power_for_connecting_ap(struct wlan_objmgr_pdev *pdev,
2431 					    enum reg_6g_ap_type ap_type,
2432 					    qdf_freq_t chan_freq,
2433 					    bool is_psd, uint16_t *tx_power,
2434 					    uint16_t *eirp_psd_power);
2435 
2436 /**
2437  * wlan_reg_get_client_power_for_6ghz_ap() - Find the channel information when
2438  *	device is operating as a 6GHz AP
2439  *
2440  * @pdev: pdev ptr
2441  * @client_type: type of client that is connected to our AP
2442  * @chan_freq: channel frequency
2443  * @is_psd: is channel PSD or not
2444  * @tx_power: transmit power to fill for chan_freq
2445  * @eirp_psd_power: EIRP power, will only be filled if is_psd is true
2446  *
2447  * This function is meant to be called to find the channel frequency power
2448  * information for a client when the device is operating as an AP. It will fill
2449  * in the parameter is_psd, tx_power, and eirp_psd_power. eirp_psd_power will
2450  * only be filled if the channel is PSD.
2451  *
2452  * Return: QDF_STATUS
2453  */
2454 QDF_STATUS
2455 wlan_reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev *pdev,
2456 				      enum reg_6g_client_type client_type,
2457 				      qdf_freq_t chan_freq,
2458 				      bool *is_psd, uint16_t *tx_power,
2459 				      uint16_t *eirp_psd_power);
2460 
2461 /**
2462  * wlan_reg_set_ap_pwr_and_update_chan_list() - Set the AP power mode and
2463  * recompute the current channel list
2464  *
2465  * @pdev: pdev ptr
2466  * @ap_pwr_type: the AP power type to update to
2467  *
2468  * Return: QDF_STATUS
2469  */
2470 QDF_STATUS
2471 wlan_reg_set_ap_pwr_and_update_chan_list(struct wlan_objmgr_pdev *pdev,
2472 					 enum reg_6g_ap_type ap_pwr_type);
2473 
2474 /**
2475  * wlan_reg_get_best_6g_pwr_type() - Returns the best 6g power type supported
2476  * for a given frequency.
2477  * @pdev: pdev pointer
2478  * @freq: input frequency.
2479  *
2480  * Return: supported_6g_pwr_types enum.
2481  */
2482 enum supported_6g_pwr_types
2483 wlan_reg_get_best_6g_pwr_type(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq);
2484 
2485 /**
2486  * wlan_reg_conv_6g_ap_type_to_supported_6g_pwr_types() - Converts the 6G AP
2487  * power type to 6g supported power type enum.
2488  * @ap_pwr_type: input 6G AP power type.
2489  *
2490  * Return: supported_6g_pwr_types enum.
2491  */
2492 enum supported_6g_pwr_types
2493 wlan_reg_conv_6g_ap_type_to_supported_6g_pwr_types(enum reg_6g_ap_type
2494 						   ap_pwr_type);
2495 
2496 /**
2497  * wlan_reg_conv_supported_6g_pwr_type_to_ap_pwr_type() - The supported 6G power
2498  * type is a combination of AP and client power types. This API return the 6G AP
2499  * power type portion of the supported 6G power type.
2500  * @in_6g_pwr_type: input 6G supported power type.
2501  *
2502  * Return: 6G AP power type.
2503  */
2504 enum reg_6g_ap_type
2505 wlan_reg_conv_supported_6g_pwr_type_to_ap_pwr_type(enum supported_6g_pwr_types
2506 						  in_6g_pwr_type);
2507 #else /* !CONFIG_BAND_6GHZ */
2508 static inline QDF_STATUS
wlan_reg_get_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev * pdev,enum reg_6g_ap_type * reg_cur_6g_ap_pwr_type)2509 wlan_reg_get_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev,
2510 				enum reg_6g_ap_type *reg_cur_6g_ap_pwr_type)
2511 {
2512 	*reg_cur_6g_ap_pwr_type = REG_CURRENT_MAX_AP_TYPE;
2513 	return QDF_STATUS_E_NOSUPPORT;
2514 }
2515 
2516 static inline QDF_STATUS
wlan_reg_get_cur_6g_client_type(struct wlan_objmgr_pdev * pdev,enum reg_6g_client_type * reg_cur_6g_client_mobility_type)2517 wlan_reg_get_cur_6g_client_type(struct wlan_objmgr_pdev *pdev,
2518 				enum reg_6g_client_type
2519 				*reg_cur_6g_client_mobility_type)
2520 {
2521 	*reg_cur_6g_client_mobility_type = REG_SUBORDINATE_CLIENT;
2522 	return QDF_STATUS_E_NOSUPPORT;
2523 }
2524 
2525 static inline QDF_STATUS
wlan_reg_set_cur_6ghz_client_type(struct wlan_objmgr_pdev * pdev,enum reg_6g_client_type in_6ghz_client_type)2526 wlan_reg_set_cur_6ghz_client_type(struct wlan_objmgr_pdev *pdev,
2527 				  enum reg_6g_client_type in_6ghz_client_type)
2528 {
2529 	return QDF_STATUS_E_NOSUPPORT;
2530 }
2531 
2532 static inline QDF_STATUS
wlan_reg_set_6ghz_client_type_from_target(struct wlan_objmgr_pdev * pdev)2533 wlan_reg_set_6ghz_client_type_from_target(struct wlan_objmgr_pdev *pdev)
2534 {
2535 	return QDF_STATUS_E_NOSUPPORT;
2536 }
2537 
2538 static inline
wlan_reg_get_rnr_tpe_usable(struct wlan_objmgr_pdev * pdev,bool * reg_rnr_tpe_usable)2539 QDF_STATUS wlan_reg_get_rnr_tpe_usable(struct wlan_objmgr_pdev *pdev,
2540 				       bool *reg_rnr_tpe_usable)
2541 {
2542 	*reg_rnr_tpe_usable = false;
2543 	return QDF_STATUS_E_NOSUPPORT;
2544 }
2545 
2546 static inline
wlan_reg_get_unspecified_ap_usable(struct wlan_objmgr_pdev * pdev,bool * reg_unspecified_ap_usable)2547 QDF_STATUS wlan_reg_get_unspecified_ap_usable(struct wlan_objmgr_pdev *pdev,
2548 					      bool *reg_unspecified_ap_usable)
2549 {
2550 	*reg_unspecified_ap_usable = false;
2551 	return QDF_STATUS_E_NOSUPPORT;
2552 }
2553 
2554 static inline
wlan_reg_is_6g_psd_power(struct wlan_objmgr_pdev * pdev)2555 bool wlan_reg_is_6g_psd_power(struct wlan_objmgr_pdev *pdev)
2556 {
2557 	return false;
2558 }
2559 
2560 static inline
wlan_reg_get_6g_chan_ap_power(struct wlan_objmgr_pdev * pdev,qdf_freq_t chan_freq,bool * is_psd,uint16_t * tx_power,uint16_t * eirp_psd_power)2561 QDF_STATUS wlan_reg_get_6g_chan_ap_power(struct wlan_objmgr_pdev *pdev,
2562 					 qdf_freq_t chan_freq, bool *is_psd,
2563 					 uint16_t *tx_power,
2564 					 uint16_t *eirp_psd_power)
2565 {
2566 	*is_psd = false;
2567 	*tx_power = 0;
2568 	*eirp_psd_power = 0;
2569 	return QDF_STATUS_E_NOSUPPORT;
2570 }
2571 
2572 static inline QDF_STATUS
wlan_reg_get_client_power_for_connecting_ap(struct wlan_objmgr_pdev * pdev,enum reg_6g_ap_type ap_type,qdf_freq_t chan_freq,bool is_psd,uint16_t * tx_power,uint16_t * eirp_psd_power)2573 wlan_reg_get_client_power_for_connecting_ap(struct wlan_objmgr_pdev *pdev,
2574 					    enum reg_6g_ap_type ap_type,
2575 					    qdf_freq_t chan_freq,
2576 					    bool is_psd, uint16_t *tx_power,
2577 					    uint16_t *eirp_psd_power)
2578 {
2579 	*tx_power = 0;
2580 	*eirp_psd_power = 0;
2581 	return QDF_STATUS_E_NOSUPPORT;
2582 }
2583 
2584 static inline QDF_STATUS
wlan_reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev * pdev,enum reg_6g_client_type client_type,qdf_freq_t chan_freq,bool * is_psd,uint16_t * tx_power,uint16_t * eirp_psd_power)2585 wlan_reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev *pdev,
2586 				      enum reg_6g_client_type client_type,
2587 				      qdf_freq_t chan_freq,
2588 				      bool *is_psd, uint16_t *tx_power,
2589 				      uint16_t *eirp_psd_power)
2590 {
2591 	*is_psd = false;
2592 	*tx_power = 0;
2593 	*eirp_psd_power = 0;
2594 	return QDF_STATUS_E_NOSUPPORT;
2595 }
2596 
2597 static inline QDF_STATUS
wlan_reg_set_ap_pwr_and_update_chan_list(struct wlan_objmgr_pdev * pdev,enum reg_6g_ap_type ap_pwr_type)2598 wlan_reg_set_ap_pwr_and_update_chan_list(struct wlan_objmgr_pdev *pdev,
2599 					 enum reg_6g_ap_type ap_pwr_type)
2600 {
2601 	return QDF_STATUS_E_NOSUPPORT;
2602 }
2603 
2604 static inline enum supported_6g_pwr_types
wlan_reg_get_best_6g_pwr_type(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq)2605 wlan_reg_get_best_6g_pwr_type(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
2606 {
2607 	return REG_INVALID_PWR_MODE;
2608 }
2609 
2610 static inline enum supported_6g_pwr_types
wlan_reg_conv_6g_ap_type_to_supported_6g_pwr_types(enum reg_6g_ap_type ap_pwr_type)2611 wlan_reg_conv_6g_ap_type_to_supported_6g_pwr_types(enum reg_6g_ap_type
2612 						   ap_pwr_type)
2613 {
2614 	return REG_INVALID_PWR_MODE;
2615 }
2616 
2617 static inline enum reg_6g_ap_type
wlan_reg_conv_supported_6g_pwr_type_to_ap_pwr_type(enum supported_6g_pwr_types in_6g_pwr_type)2618 wlan_reg_conv_supported_6g_pwr_type_to_ap_pwr_type(enum supported_6g_pwr_types
2619 						   in_6g_pwr_type)
2620 {
2621 	return REG_MAX_AP_TYPE;
2622 }
2623 #endif /* CONFIG_BAND_6GHZ */
2624 
2625 /**
2626  * wlan_reg_is_ext_tpc_supported() - Checks if FW supports new WMI cmd for TPC
2627  *
2628  * @psoc: psoc ptr
2629  *
2630  * Return: true if FW supports new command or false otherwise
2631  */
2632 bool wlan_reg_is_ext_tpc_supported(struct wlan_objmgr_psoc *psoc);
2633 
2634 /**
2635  * wlan_reg_is_chwidth_supported() - Check if given channel width is supported
2636  * on a given pdev
2637  * @pdev: pdev pointer
2638  * @ch_width: channel width.
2639  * @is_supported: whether the channel width is supported
2640  *
2641  * Return QDF_STATUS_SUCCESS of operation
2642  */
2643 QDF_STATUS wlan_reg_is_chwidth_supported(struct wlan_objmgr_pdev *pdev,
2644 					 enum phy_ch_width ch_width,
2645 					 bool *is_supported);
2646 
2647 #ifdef CONFIG_BAND_6GHZ
2648 /**
2649  * wlan_reg_get_thresh_priority_freq() - Get the prioritized frequency value
2650  * @pdev: pdev pointer
2651  */
2652 qdf_freq_t wlan_reg_get_thresh_priority_freq(struct wlan_objmgr_pdev *pdev);
2653 
2654 /**
2655  * wlan_reg_psd_2_eirp() - Calculate EIRP from PSD and bandwidth
2656  * channel list
2657  * @pdev: pdev pointer
2658  * @psd: Power Spectral Density in dBm/MHz
2659  * @ch_bw: Bandwidth of a channel in MHz (20/40/80/160/320 etc)
2660  * @eirp:  EIRP power  in dBm
2661  *
2662  * Return: QDF_STATUS
2663  */
2664 QDF_STATUS wlan_reg_psd_2_eirp(struct wlan_objmgr_pdev *pdev,
2665 			       int16_t psd,
2666 			       uint16_t ch_bw,
2667 			       int16_t *eirp);
2668 
2669 /**
2670  * wlan_reg_eirp_2_psd() - Calculate PSD poewr from EIRP and bandwidth
2671  * @pdev: pdev pointer
2672  * @ch_bw: Bandwidth of a channel in MHz (20/40/80/160/320 etc)
2673  * @eirp:  EIRP power  in dBm
2674  * @psd: Power Spectral Density in dBm/MHz
2675  *
2676  * Return: QDF_STATUS
2677  */
2678 QDF_STATUS wlan_reg_eirp_2_psd(struct wlan_objmgr_pdev *pdev,
2679 			       uint16_t ch_bw,
2680 			       int16_t eirp,
2681 			       int16_t *psd);
2682 
2683 /**
2684  * wlan_reg_get_best_pwr_mode() - Get the best power mode based on input freq
2685  * and bandwidth. The mode that provides the best EIRP is the best power mode.
2686  * @pdev: Pointer to pdev
2687  * @freq: Frequency in MHz
2688  * @cen320: 320 MHz band center frequency. For other BW, this param is
2689  * ignored while processing
2690  * @bw: Bandwidth in MHz
2691  * @in_punc_pattern: input puncture pattern
2692  *
2693  * Return: Best power mode
2694  */
2695 enum reg_6g_ap_type
2696 wlan_reg_get_best_pwr_mode(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq,
2697 			   qdf_freq_t cen320, uint16_t bw,
2698 			   uint16_t in_punc_pattern);
2699 
2700 /**
2701  * wlan_reg_get_eirp_pwr() - Get eirp power based on the AP power mode
2702  * @pdev: Pointer to pdev
2703  * @freq: Frequency in MHz
2704  * @cen320: 320 MHz Band center frequency
2705  * @bw: Bandwidth in MHz
2706  * @ap_pwr_type: AP power type
2707  * @in_punc_pattern: Input puncture pattern
2708  * @is_client_list_lookup_needed: Boolean to indicate if client list lookup is
2709  * needed
2710  * @client_type: Client power type
2711  *
2712  * Return: EIRP power
2713  */
2714 int8_t wlan_reg_get_eirp_pwr(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq,
2715 			     qdf_freq_t cen320, uint16_t bw,
2716 			     enum reg_6g_ap_type ap_pwr_type,
2717 			     uint16_t in_punc_pattern,
2718 			     bool is_client_list_lookup_needed,
2719 			     enum reg_6g_client_type client_type);
2720 #else
2721 static inline
wlan_reg_get_thresh_priority_freq(struct wlan_objmgr_pdev * pdev)2722 qdf_freq_t wlan_reg_get_thresh_priority_freq(struct wlan_objmgr_pdev *pdev)
2723 {
2724 	return 0;
2725 }
2726 
2727 static inline enum reg_6g_ap_type
wlan_reg_get_best_pwr_mode(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq,qdf_freq_t cen320,uint16_t bw,uint16_t in_punc_pattern)2728 wlan_reg_get_best_pwr_mode(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq,
2729 			   qdf_freq_t cen320,
2730 			   uint16_t bw,
2731 			   uint16_t in_punc_pattern)
2732 {
2733 	return REG_MAX_AP_TYPE;
2734 }
2735 
wlan_reg_psd_2_eirp(struct wlan_objmgr_pdev * pdev,int16_t psd,uint16_t ch_bw,int16_t * eirp)2736 static inline QDF_STATUS wlan_reg_psd_2_eirp(struct wlan_objmgr_pdev *pdev,
2737 					     int16_t psd,
2738 					     uint16_t ch_bw,
2739 					     int16_t *eirp)
2740 {
2741 	return QDF_STATUS_E_FAILURE;
2742 }
2743 
wlan_reg_eirp_2_psd(struct wlan_objmgr_pdev * pdev,uint16_t ch_bw,int16_t eirp,int16_t * psd)2744 static inline QDF_STATUS wlan_reg_eirp_2_psd(struct wlan_objmgr_pdev *pdev,
2745 					     uint16_t ch_bw,
2746 					     int16_t eirp,
2747 					     int16_t *psd)
2748 {
2749 	return QDF_STATUS_E_FAILURE;
2750 }
2751 
2752 static inline int8_t
wlan_reg_get_eirp_pwr(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq,qdf_freq_t cen320,uint16_t bw,enum reg_6g_ap_type ap_pwr_type,uint16_t in_punc_pattern,bool is_client_list_lookup_needed,enum reg_6g_client_type client_type)2753 wlan_reg_get_eirp_pwr(struct wlan_objmgr_pdev *pdev,
2754 		      qdf_freq_t freq,
2755 		      qdf_freq_t cen320, uint16_t bw,
2756 		      enum reg_6g_ap_type ap_pwr_type,
2757 		      uint16_t in_punc_pattern,
2758 		      bool is_client_list_lookup_needed,
2759 		      enum reg_6g_client_type client_type)
2760 {
2761 	return 0;
2762 }
2763 #endif /* CONFIG_BAND_6GHZ */
2764 /**
2765  * wlan_reg_find_chwidth_from_bw() - Gets channel width for given
2766  * bandwidth
2767  * @bw: Bandwidth
2768  *
2769  * Return: phy_ch_width
2770  */
2771 enum phy_ch_width wlan_reg_find_chwidth_from_bw(uint16_t bw);
2772 
2773 /**
2774  * wlan_reg_get_chan_state_for_320() - Get the channel state of a 320 MHz
2775  * bonded channel.
2776  * @pdev: Pointer to wlan_objmgr_pdev
2777  * @freq: Primary frequency
2778  * @center_320: Band center of 320 MHz
2779  * @ch_width: Channel width
2780  * @bonded_chan_ptr_ptr: Pointer to bonded channel pointer
2781  * @in_6g_pwr_type: Input 6g power type
2782  * @treat_nol_chan_as_disabled: Bool to treat nol chan as enabled/disabled
2783  * @input_puncture_bitmap: Input puncture bitmap
2784  *
2785  * Return: Channel state
2786  */
2787 #ifdef WLAN_FEATURE_11BE
2788 enum channel_state
2789 wlan_reg_get_chan_state_for_320(struct wlan_objmgr_pdev *pdev,
2790 				uint16_t freq,
2791 				qdf_freq_t center_320,
2792 				enum phy_ch_width ch_width,
2793 				const struct bonded_channel_freq
2794 				**bonded_chan_ptr_ptr,
2795 				enum supported_6g_pwr_types in_6g_pwr_type,
2796 				bool treat_nol_chan_as_disabled,
2797 				uint16_t input_puncture_bitmap);
2798 #else
2799 static inline enum channel_state
wlan_reg_get_chan_state_for_320(struct wlan_objmgr_pdev * pdev,uint16_t freq,qdf_freq_t center_320,enum phy_ch_width ch_width,const struct bonded_channel_freq ** bonded_chan_ptr_ptr,enum supported_6g_pwr_types in_6g_pwr_type,bool treat_nol_chan_as_disabled,uint16_t input_puncture_bitmap)2800 wlan_reg_get_chan_state_for_320(struct wlan_objmgr_pdev *pdev,
2801 				uint16_t freq,
2802 				qdf_freq_t center_320,
2803 				enum phy_ch_width ch_width,
2804 				const struct bonded_channel_freq
2805 				**bonded_chan_ptr_ptr,
2806 				enum supported_6g_pwr_types in_6g_pwr_type,
2807 				bool treat_nol_chan_as_disabled,
2808 				uint16_t input_puncture_bitmap)
2809 {
2810 	return CHANNEL_STATE_INVALID;
2811 }
2812 #endif
2813 
2814 #ifdef CONFIG_BAND_6GHZ
2815 /**
2816  * wlan_is_sup_chan_entry_afc_done() - Checks if the super chan entry of given
2817  * channel idx and power mode has REGULATORY_CHAN_AFC_NOT_DONE flag cleared.
2818  *
2819  * @pdev: pdev pointer
2820  * @chan_idx: input channel idx
2821  * @in_6g_pwr_mode: input power mode
2822  *
2823  * Return: True if REGULATORY_CHAN_AFC_NOT_DONE flag is clear for the super
2824  * chan entry.
2825  */
2826 bool
2827 wlan_is_sup_chan_entry_afc_done(struct wlan_objmgr_pdev *pdev,
2828 				enum channel_enum chan_idx,
2829 				enum supported_6g_pwr_types in_6g_pwr_mode);
2830 
2831 /**
2832  * wlan_reg_display_super_chan_list() - Display super channel list for all modes
2833  * @pdev: Pointer to pdev
2834  *
2835  * Return: QDF_STATUS
2836  */
2837 QDF_STATUS
2838 wlan_reg_display_super_chan_list(struct wlan_objmgr_pdev *pdev);
2839 
2840 #if defined(CONFIG_AFC_SUPPORT) && defined(CONFIG_BAND_6GHZ)
2841 /**
2842  * wlan_reg_get_afc_freq_range_and_psd_limits() - Get freq range and psd
2843  * limits from afc server response.
2844  *
2845  * @pdev: Pointer to pdev
2846  * @num_freq_obj: Number of frequency objects
2847  * @afc_obj: Pointer to struct afc_freq_obj
2848  *
2849  * Return: QDF_STATUS
2850  */
2851 
2852 QDF_STATUS
2853 wlan_reg_get_afc_freq_range_and_psd_limits(struct wlan_objmgr_pdev *pdev,
2854 					   uint8_t num_freq_obj,
2855 					   struct afc_freq_obj *afc_obj);
2856 
2857 /**
2858  * wlan_reg_get_num_afc_freq_obj() - Get number of afc frequency objects
2859  *
2860  * @pdev: Pointer to pdev
2861  * @num_freq_obj: Number of frequency objects
2862  *
2863  * Return: QDF_STATUS
2864  */
2865 QDF_STATUS
2866 wlan_reg_get_num_afc_freq_obj(struct wlan_objmgr_pdev *pdev,
2867 			      uint8_t *num_freq_obj);
2868 
2869 /**
2870  * wlan_reg_set_afc_power_event_received() - Set power event received flag with
2871  * given val.
2872  * @pdev: pdev pointer.
2873  * @val: value to be set
2874  *
2875  * Return: QDF_STATUS
2876  */
2877 QDF_STATUS wlan_reg_set_afc_power_event_received(struct wlan_objmgr_pdev *pdev,
2878 						 bool val);
2879 #endif
2880 #else
2881 static inline bool
wlan_is_sup_chan_entry_afc_done(struct wlan_objmgr_pdev * pdev,enum channel_enum chan_idx,enum supported_6g_pwr_types in_6g_pwr_mode)2882 wlan_is_sup_chan_entry_afc_done(struct wlan_objmgr_pdev *pdev,
2883 				enum channel_enum chan_idx,
2884 				enum supported_6g_pwr_types in_6g_pwr_mode)
2885 {
2886 	return false;
2887 }
2888 
2889 static inline QDF_STATUS
wlan_reg_display_super_chan_list(struct wlan_objmgr_pdev * pdev)2890 wlan_reg_display_super_chan_list(struct wlan_objmgr_pdev *pdev)
2891 {
2892 	return QDF_STATUS_E_NOSUPPORT;
2893 }
2894 #endif
2895 
2896 /**
2897  * wlan_reg_get_num_rules_of_ap_pwr_type() - Get the number of reg rules
2898  * present for a given ap power type
2899  * @pdev: Pointer to pdev
2900  * @ap_pwr_type: AP power type
2901  *
2902  * Return: Return the number of reg rules for a given ap power type
2903  */
2904 uint8_t
2905 wlan_reg_get_num_rules_of_ap_pwr_type(struct wlan_objmgr_pdev *pdev,
2906 				      enum reg_6g_ap_type ap_pwr_type);
2907 
2908 /**
2909  * wlan_reg_register_is_chan_connected_callback() - Register callback to check
2910  *                                                  if channel is connected.
2911  * @psoc: Pointer to global psoc structure.
2912  * @cbk: Pointer to callback function.
2913  *
2914  * Return: None
2915  */
2916 void
2917 wlan_reg_register_is_chan_connected_callback(struct wlan_objmgr_psoc *psoc,
2918 					     void *cbk);
2919 
2920 /**
2921  * wlan_reg_unregister_is_chan_connected_callback() - Unregister callback to
2922  * check if channel is connected.
2923  * @psoc: Pointer to global psoc structure.
2924  * @cbk: Pointer to callback function.
2925  *
2926  * Return: None
2927  */
2928 void
2929 wlan_reg_unregister_is_chan_connected_callback(struct wlan_objmgr_psoc *psoc,
2930 					       void *cbk);
2931 
2932 /**
2933  * wlan_reg_get_endchan_cen_from_bandstart() - Get the end channel frequency
2934  * from the band start frequency.
2935  * @band_start: Band start frequency in MHz
2936  * @bw: Bandwidth in MHz
2937  *
2938  * Return: End frequency in MHz
2939  */
2940 qdf_freq_t
2941 wlan_reg_get_endchan_cen_from_bandstart(qdf_freq_t band_start,
2942 					uint16_t bw);
2943 
2944 /**
2945  * wlan_reg_get_opclass_from_map() - Get op class from map.
2946  * @map: Pointer to reg_dmn_op_class_map_t.
2947  * @is_global_op_table_needed: Whether to lookup global op class tbl.
2948  *
2949  * Return: QDF_STATUS_SUCCESS if success, else return QDF_STATUS_FAILURE.
2950  */
2951 QDF_STATUS
2952 wlan_reg_get_opclass_from_map(const struct reg_dmn_op_class_map_t **map,
2953 			      bool is_global_op_table_needed);
2954 #endif
2955