xref: /wlan-dirver/qca-wifi-host-cmn/umac/regulatory/dispatcher/inc/reg_services_public_struct.h (revision d0c05845839e5f2ba5a8dcebe0cd3e4cd4e8dfcf)
1 /*
2  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2022 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: reg_services_public_struct.h
22  * This file contains regulatory data structures
23  */
24 
25 #ifndef __REG_SERVICES_PUBLIC_STRUCT_H_
26 #define __REG_SERVICES_PUBLIC_STRUCT_H_
27 
28 #ifdef CONFIG_AFC_SUPPORT
29 #include <wlan_reg_afc.h>
30 #endif
31 
32 #ifdef CONFIG_BAND_6GHZ
33 #define REG_MAX_CHANNELS_PER_OPERATING_CLASS        70
34 /*
35  * These tx-power macros are present till the 6G regdomains are defined to
36  * support tx-power values for various client types.
37  */
38 #define REG_PSD_MAX_TXPOWER_FOR_DEFAULT_CLIENT      (-1) /* dBm */
39 #define REG_PSD_MAX_TXPOWER_FOR_SUBORDINATE_CLIENT  5    /* dBm */
40 #define REG_EIRP_MAX_TXPOWER_FOR_SUBORDINATE_CLIENT 24   /* dBm */
41 #else
42 #define REG_MAX_CHANNELS_PER_OPERATING_CLASS        28
43 #endif
44 
45 #define REG_MAX_SUPP_OPER_CLASSES 32
46 #define REG_MAX_CHAN_CHANGE_CBKS 30
47 #define REG_INVALID_TXPOWER 255
48 #define MAX_STA_VDEV_CNT 4
49 #define INVALID_VDEV_ID 0xFF
50 #define INVALID_CHANNEL_NUM 0x0
51 #define CH_AVOID_MAX_RANGE   (NUM_5GHZ_CHANNELS + NUM_24GHZ_CHANNELS)
52 #define REG_ALPHA2_LEN 2
53 #define MAX_REG_RULES 10
54 #define MAX_6G_REG_RULES 5
55 
56 #define REGULATORY_CHAN_DISABLED     BIT(0)
57 #define REGULATORY_CHAN_NO_IR        BIT(1)
58 #define REGULATORY_CHAN_RADAR        BIT(3)
59 #define REGULATORY_CHAN_NO_OFDM      BIT(6)
60 #define REGULATORY_CHAN_INDOOR_ONLY  BIT(9)
61 #define REGULATORY_CHAN_AFC          BIT(13)
62 #define REGULATORY_CHAN_AFC_NOT_DONE BIT(16)
63 
64 #define REGULATORY_CHAN_NO_HT40      BIT(4)
65 #define REGULATORY_CHAN_NO_80MHZ     BIT(7)
66 #define REGULATORY_CHAN_NO_160MHZ    BIT(8)
67 #define REGULATORY_CHAN_NO_20MHZ     BIT(11)
68 #define REGULATORY_CHAN_NO_10MHZ     BIT(12)
69 #define REGULATORY_CHAN_INVALID      BIT(14)
70 
71 #define REGULATORY_PHYMODE_NO11A     BIT(0)
72 #define REGULATORY_PHYMODE_NO11B     BIT(1)
73 #define REGULATORY_PHYMODE_NO11G     BIT(2)
74 #define REGULATORY_CHAN_NO11N        BIT(3)
75 #define REGULATORY_PHYMODE_NO11AC    BIT(4)
76 #define REGULATORY_PHYMODE_NO11AX    BIT(5)
77 #ifdef WLAN_FEATURE_11BE
78 #define REGULATORY_PHYMODE_NO11BE    BIT(6)
79 #endif
80 
81 #define BW_5_MHZ      5
82 #define BW_10_MHZ     10
83 #define BW_20_MHZ     20
84 #define BW_25_MHZ     25
85 #define BW_40_MHZ     40
86 #define BW_80_MHZ     80
87 #define BW_160_MHZ    160
88 #ifdef WLAN_FEATURE_11BE
89 #define BW_320_MHZ    320
90 #endif
91 #define BW_40_MHZ     40
92 
93 #define MAX_NUM_PWR_LEVEL 16
94 
95 /**
96  * enum dfs_reg - DFS region
97  * @DFS_UNINIT_REGION: un-initialized region
98  * @DFS_FCC_REGION: FCC region
99  * @DFS_ETSI_REGION: ETSI region
100  * @DFS_MKK_REGION: MKK region
101  * @DFS_CN_REGION: China region
102  * @DFS_KR_REGION: Korea region
103  * @DFS_MKK_REGION: MKKN region
104  * that supports updated W53 RADAR pattern
105  * detection.
106  * @DFS_UNDEF_REGION: Undefined region
107  */
108 
109 enum dfs_reg {
110 	DFS_UNINIT_REGION = 0,
111 	DFS_FCC_REGION = 1,
112 	DFS_ETSI_REGION = 2,
113 	DFS_MKK_REGION = 3,
114 	DFS_CN_REGION = 4,
115 	DFS_KR_REGION = 5,
116 	DFS_MKKN_REGION = 6,
117 	DFS_UNDEF_REGION = 0xFFFF,
118 };
119 
120 /** enum op_class_table_num
121  * OP_CLASS_US- Class corresponds to US
122  * OP_CLASS_EU- Class corresponds to EU
123  * OP_CLASS_JAPAN- Class corresponds to JAPAN
124  * OP_CLASS_GLOBAL- Class corresponds to GLOBAL
125  * OP_CLASS_CHINA- Class corresponds to CHINA
126  */
127 enum op_class_table_num {
128 	OP_CLASS_US = 1,
129 	OP_CLASS_EU,
130 	OP_CLASS_JAPAN,
131 	OP_CLASS_GLOBAL,
132 	OP_CLASS_CHINA
133 };
134 
135 /**
136  * enum channel_enum - channel enumeration
137  * @CHAN_ENUM_2412: channel with freq 2412
138  * @CHAN_ENUM_2417: channel with freq 2417
139  * @CHAN_ENUM_2422: channel with freq 2422
140  * @CHAN_ENUM_2427: channel with freq 2427
141  * @CHAN_ENUM_2432: channel with freq 2432
142  * @CHAN_ENUM_2437: channel with freq 2437
143  * @CHAN_ENUM_2442: channel with freq 2442
144  * @CHAN_ENUM_2447: channel with freq 2447
145  * @CHAN_ENUM_2452: channel with freq 2452
146  * @CHAN_ENUM_2457: channel with freq 2457
147  * @CHAN_ENUM_2462: channel with freq 2462
148  * @CHAN_ENUM_2467: channel with freq 2467
149  * @CHAN_ENUM_2472: channel with freq 2472
150  * @CHAN_ENUM_2484: channel with freq 2484
151  * @CHAN_ENUM_4912: channel with freq 4912
152  * @CHAN_ENUM_4915: channel with freq 4915
153  * @CHAN_ENUM_4917: channel with freq 4917
154  * @CHAN_ENUM_4920: channel with freq 4920
155  * @CHAN_ENUM_4922: channel with freq 4922
156  * @CHAN_ENUM_4925: channel with freq 4925
157  * @CHAN_ENUM_4927: channel with freq 4927
158  * @CHAN_ENUM_4932: channel with freq 4932
159  * @CHAN_ENUM_4935: channel with freq 4935
160  * @CHAN_ENUM_4937: channel with freq 4937
161  * @CHAN_ENUM_4940: channel with freq 4940
162  * @CHAN_ENUM_4942: channel with freq 4942
163  * @CHAN_ENUM_4945: channel with freq 4945
164  * @CHAN_ENUM_4947: channel with freq 4947
165  * @CHAN_ENUM_4950: channel with freq 4950
166  * @CHAN_ENUM_4952: channel with freq 4952
167  * @CHAN_ENUM_4955: channel with freq 4955
168  * @CHAN_ENUM_4957: channel with freq 4957
169  * @CHAN_ENUM_4960: channel with freq 4960
170  * @CHAN_ENUM_4962: channel with freq 4962
171  * @CHAN_ENUM_4965: channel with freq 4965
172  * @CHAN_ENUM_4967: channel with freq 4967
173  * @CHAN_ENUM_4970: channel with freq 4970
174  * @CHAN_ENUM_4972: channel with freq 4972
175  * @CHAN_ENUM_4975: channel with freq 4975
176  * @CHAN_ENUM_4977: channel with freq 4977
177  * @CHAN_ENUM_4980: channel with freq 4980
178  * @CHAN_ENUM_4982: channel with freq 4982
179  * @CHAN_ENUM_4985: channel with freq 4985
180  * @CHAN_ENUM_4987: channel with freq 4987
181  * @CHAN_ENUM_5032: channel with freq 5032
182  * @CHAN_ENUM_5035: channel with freq 5035
183  * @CHAN_ENUM_5037: channel with freq 5037
184  * @CHAN_ENUM_5040: channel with freq 5040
185  * @CHAN_ENUM_5042: channel with freq 5042
186  * @CHAN_ENUM_5045: channel with freq 5045
187  * @CHAN_ENUM_5047: channel with freq 5047
188  * @CHAN_ENUM_5052: channel with freq 5052
189  * @CHAN_ENUM_5055: channel with freq 5055
190  * @CHAN_ENUM_5057: channel with freq 5057
191  * @CHAN_ENUM_5060: channel with freq 5060
192  * @CHAN_ENUM_5080: channel with freq 5080
193  * @CHAN_ENUM_5180: channel with freq 5180
194  * @CHAN_ENUM_5200: channel with freq 5200
195  * @CHAN_ENUM_5220: channel with freq 5220
196  * @CHAN_ENUM_5240: channel with freq 5240
197  * @CHAN_ENUM_5260: channel with freq 5260
198  * @CHAN_ENUM_5280: channel with freq 5280
199  * @CHAN_ENUM_5300: channel with freq 5300
200  * @CHAN_ENUM_5320: channel with freq 5320
201  * @CHAN_ENUM_5500: channel with freq 5500
202  * @CHAN_ENUM_5520: channel with freq 5520
203  * @CHAN_ENUM_5540: channel with freq 5540
204  * @CHAN_ENUM_5560: channel with freq 5560
205  * @CHAN_ENUM_5580: channel with freq 5580
206  * @CHAN_ENUM_5600: channel with freq 5600
207  * @CHAN_ENUM_5620: channel with freq 5620
208  * @CHAN_ENUM_5640: channel with freq 5640
209  * @CHAN_ENUM_5660: channel with freq 5660
210  * @CHAN_ENUM_5680: channel with freq 5680
211  * @CHAN_ENUM_5700: channel with freq 5700
212  * @CHAN_ENUM_5720: channel with freq 5720
213  * @CHAN_ENUM_5745: channel with freq 5745
214  * @CHAN_ENUM_5765: channel with freq 5765
215  * @CHAN_ENUM_5785: channel with freq 5785
216  * @CHAN_ENUM_5805: channel with freq 5805
217  * @CHAN_ENUM_5825: channel with freq 5825
218  * @CHAN_ENUM_5845: channel with freq 5845
219  * @CHAN_ENUM_5850: channel with freq 5850
220  * @CHAN_ENUM_5855: channel with freq 5855
221  * @CHAN_ENUM_5860: channel with freq 5860
222  * @CHAN_ENUM_5865: channel with freq 5865
223  * @CHAN_ENUM_5870: channel with freq 5870
224  * @CHAN_ENUM_5875: channel with freq 5875
225  * @CHAN_ENUM_5880: channel with freq 5880
226  * @CHAN_ENUM_5885: channel with freq 5885
227  * @CHAN_ENUM_5890: channel with freq 5890
228  * @CHAN_ENUM_5895: channel with freq 5895
229  * @CHAN_ENUM_5900: channel with freq 5900
230  * @CHAN_ENUM_5905: channel with freq 5905
231  * @CHAN_ENUM_5910: channel with freq 5910
232  * @CHAN_ENUM_5915: channel with freq 5915
233  * @CHAN_ENUM_5920: channel with freq 5920
234  * @CHAN_ENUM_5935: channel with freq 5935
235  * @CHAN_ENUM_5955: channel with freq 5955
236  * @CHAN_ENUM_5975: channel with freq 5975
237  * @CHAN_ENUM_5995: channel with freq 5995
238  * @CHAN_ENUM_6015: channel with freq 6015
239  * @CHAN_ENUM_6035: channel with freq 6035
240  * @CHAN_ENUM_6055: channel with freq 6055
241  * @CHAN_ENUM_6075: channel with freq 6075
242  * @CHAN_ENUM_6095: channel with freq 6095
243  * @CHAN_ENUM_6115: channel with freq 6115
244  * @CHAN_ENUM_6135: channel with freq 6135
245  * @CHAN_ENUM_6155: channel with freq 6155
246  * @CHAN_ENUM_6175: channel with freq 6175
247  * @CHAN_ENUM_6195: channel with freq 6195
248  * @CHAN_ENUM_6215: channel with freq 6215
249  * @CHAN_ENUM_6235: channel with freq 6235
250  * @CHAN_ENUM_6255: channel with freq 6255
251  * @CHAN_ENUM_6275: channel with freq 6275
252  * @CHAN_ENUM_6295: channel with freq 6295
253  * @CHAN_ENUM_6315: channel with freq 6315
254  * @CHAN_ENUM_6335: channel with freq 6335
255  * @CHAN_ENUM_6355: channel with freq 6355
256  * @CHAN_ENUM_6375: channel with freq 6375
257  * @CHAN_ENUM_6395: channel with freq 6395
258  * @CHAN_ENUM_6415: channel with freq 6415
259  * @CHAN_ENUM_6435: channel with freq 6435
260  * @CHAN_ENUM_6455: channel with freq 6455
261  * @CHAN_ENUM_6475: channel with freq 6475
262  * @CHAN_ENUM_6495: channel with freq 6495
263  * @CHAN_ENUM_6515: channel with freq 6515
264  * @CHAN_ENUM_6535: channel with freq 6535
265  * @CHAN_ENUM_6555: channel with freq 6555
266  * @CHAN_ENUM_6575: channel with freq 6575
267  * @CHAN_ENUM_6595: channel with freq 6595
268  * @CHAN_ENUM_6615: channel with freq 6615
269  * @CHAN_ENUM_6635: channel with freq 6635
270  * @CHAN_ENUM_6655: channel with freq 6655
271  * @CHAN_ENUM_6675: channel with freq 6675
272  * @CHAN_ENUM_6695: channel with freq 6695
273  * @CHAN_ENUM_6715: channel with freq 6715
274  * @CHAN_ENUM_6735: channel with freq 6735
275  * @CHAN_ENUM_6755: channel with freq 6755
276  * @CHAN_ENUM_6775: channel with freq 6775
277  * @CHAN_ENUM_6795: channel with freq 6795
278  * @CHAN_ENUM_6815: channel with freq 6815
279  * @CHAN_ENUM_6835: channel with freq 6835
280  * @CHAN_ENUM_6855: channel with freq 6855
281  * @CHAN_ENUM_6875: channel with freq 6875
282  * @CHAN_ENUM_6895: channel with freq 6895
283  * @CHAN_ENUM_6915: channel with freq 6915
284  * @CHAN_ENUM_6935: channel with freq 6935
285  * @CHAN_ENUM_6955: channel with freq 6955
286  * @CHAN_ENUM_6975: channel with freq 6975
287  * @CHAN_ENUM_6995: channel with freq 6995
288  * @CHAN_ENUM_7015: channel with freq 7015
289  * @CHAN_ENUM_7035: channel with freq 7035
290  * @CHAN_ENUM_7055: channel with freq 7055
291  * @CHAN_ENUM_7075: channel with freq 7075
292  * @CHAN_ENUM_7095: channel with freq 7095
293  * @CHAN_ENUM_7115: channel with freq 7115
294  */
295 enum channel_enum {
296 	CHAN_ENUM_2412,
297 	CHAN_ENUM_2417,
298 	CHAN_ENUM_2422,
299 	CHAN_ENUM_2427,
300 	CHAN_ENUM_2432,
301 	CHAN_ENUM_2437,
302 	CHAN_ENUM_2442,
303 	CHAN_ENUM_2447,
304 	CHAN_ENUM_2452,
305 	CHAN_ENUM_2457,
306 	CHAN_ENUM_2462,
307 	CHAN_ENUM_2467,
308 	CHAN_ENUM_2472,
309 	CHAN_ENUM_2484,
310 #ifdef CONFIG_49GHZ_CHAN
311 	CHAN_ENUM_4912,
312 	CHAN_ENUM_4915,
313 	CHAN_ENUM_4917,
314 	CHAN_ENUM_4920,
315 	CHAN_ENUM_4922,
316 	CHAN_ENUM_4925,
317 	CHAN_ENUM_4927,
318 	CHAN_ENUM_4932,
319 	CHAN_ENUM_4935,
320 	CHAN_ENUM_4937,
321 	CHAN_ENUM_4940,
322 	CHAN_ENUM_4942,
323 	CHAN_ENUM_4945,
324 	CHAN_ENUM_4947,
325 	CHAN_ENUM_4950,
326 	CHAN_ENUM_4952,
327 	CHAN_ENUM_4955,
328 	CHAN_ENUM_4957,
329 	CHAN_ENUM_4960,
330 	CHAN_ENUM_4962,
331 	CHAN_ENUM_4965,
332 	CHAN_ENUM_4967,
333 	CHAN_ENUM_4970,
334 	CHAN_ENUM_4972,
335 	CHAN_ENUM_4975,
336 	CHAN_ENUM_4977,
337 	CHAN_ENUM_4980,
338 	CHAN_ENUM_4982,
339 	CHAN_ENUM_4985,
340 	CHAN_ENUM_4987,
341 	CHAN_ENUM_5032,
342 	CHAN_ENUM_5035,
343 	CHAN_ENUM_5037,
344 	CHAN_ENUM_5040,
345 	CHAN_ENUM_5042,
346 	CHAN_ENUM_5045,
347 	CHAN_ENUM_5047,
348 	CHAN_ENUM_5052,
349 	CHAN_ENUM_5055,
350 	CHAN_ENUM_5057,
351 	CHAN_ENUM_5060,
352 	CHAN_ENUM_5080,
353 #endif /* CONFIG_49GHZ_CHAN */
354 	CHAN_ENUM_5180,
355 	CHAN_ENUM_5200,
356 	CHAN_ENUM_5220,
357 	CHAN_ENUM_5240,
358 	CHAN_ENUM_5260,
359 	CHAN_ENUM_5280,
360 	CHAN_ENUM_5300,
361 	CHAN_ENUM_5320,
362 	CHAN_ENUM_5500,
363 	CHAN_ENUM_5520,
364 	CHAN_ENUM_5540,
365 	CHAN_ENUM_5560,
366 	CHAN_ENUM_5580,
367 	CHAN_ENUM_5600,
368 	CHAN_ENUM_5620,
369 	CHAN_ENUM_5640,
370 	CHAN_ENUM_5660,
371 	CHAN_ENUM_5680,
372 	CHAN_ENUM_5700,
373 	CHAN_ENUM_5720,
374 	CHAN_ENUM_5745,
375 	CHAN_ENUM_5765,
376 	CHAN_ENUM_5785,
377 	CHAN_ENUM_5805,
378 	CHAN_ENUM_5825,
379 	CHAN_ENUM_5845,
380 #ifdef WLAN_FEATURE_DSRC
381 	CHAN_ENUM_5850,
382 	CHAN_ENUM_5855,
383 	CHAN_ENUM_5860,
384 #endif
385 	CHAN_ENUM_5865,
386 #ifdef WLAN_FEATURE_DSRC
387 	CHAN_ENUM_5870,
388 	CHAN_ENUM_5875,
389 	CHAN_ENUM_5880,
390 #endif
391 	CHAN_ENUM_5885,
392 #ifdef WLAN_FEATURE_DSRC
393 	CHAN_ENUM_5890,
394 	CHAN_ENUM_5895,
395 	CHAN_ENUM_5900,
396 	CHAN_ENUM_5905,
397 	CHAN_ENUM_5910,
398 	CHAN_ENUM_5915,
399 	CHAN_ENUM_5920,
400 #endif /* WLAN_FEATURE_DSRC */
401 #ifdef CONFIG_BAND_6GHZ
402 	CHAN_ENUM_5935,
403 	CHAN_ENUM_5955,
404 	CHAN_ENUM_5975,
405 	CHAN_ENUM_5995,
406 	CHAN_ENUM_6015,
407 	CHAN_ENUM_6035,
408 	CHAN_ENUM_6055,
409 	CHAN_ENUM_6075,
410 	CHAN_ENUM_6095,
411 	CHAN_ENUM_6115,
412 	CHAN_ENUM_6135,
413 	CHAN_ENUM_6155,
414 	CHAN_ENUM_6175,
415 	CHAN_ENUM_6195,
416 	CHAN_ENUM_6215,
417 	CHAN_ENUM_6235,
418 	CHAN_ENUM_6255,
419 	CHAN_ENUM_6275,
420 	CHAN_ENUM_6295,
421 	CHAN_ENUM_6315,
422 	CHAN_ENUM_6335,
423 	CHAN_ENUM_6355,
424 	CHAN_ENUM_6375,
425 	CHAN_ENUM_6395,
426 	CHAN_ENUM_6415,
427 	CHAN_ENUM_6435,
428 	CHAN_ENUM_6455,
429 	CHAN_ENUM_6475,
430 	CHAN_ENUM_6495,
431 	CHAN_ENUM_6515,
432 	CHAN_ENUM_6535,
433 	CHAN_ENUM_6555,
434 	CHAN_ENUM_6575,
435 	CHAN_ENUM_6595,
436 	CHAN_ENUM_6615,
437 	CHAN_ENUM_6635,
438 	CHAN_ENUM_6655,
439 	CHAN_ENUM_6675,
440 	CHAN_ENUM_6695,
441 	CHAN_ENUM_6715,
442 	CHAN_ENUM_6735,
443 	CHAN_ENUM_6755,
444 	CHAN_ENUM_6775,
445 	CHAN_ENUM_6795,
446 	CHAN_ENUM_6815,
447 	CHAN_ENUM_6835,
448 	CHAN_ENUM_6855,
449 	CHAN_ENUM_6875,
450 	CHAN_ENUM_6895,
451 	CHAN_ENUM_6915,
452 	CHAN_ENUM_6935,
453 	CHAN_ENUM_6955,
454 	CHAN_ENUM_6975,
455 	CHAN_ENUM_6995,
456 	CHAN_ENUM_7015,
457 	CHAN_ENUM_7035,
458 	CHAN_ENUM_7055,
459 	CHAN_ENUM_7075,
460 	CHAN_ENUM_7095,
461 	CHAN_ENUM_7115,
462 #endif /* CONFIG_BAND_6GHZ */
463 
464 	NUM_CHANNELS,
465 
466 	MIN_CHANNEL = CHAN_ENUM_2412,
467 	MAX_CHANNEL = (NUM_CHANNELS - 1),
468 
469 	MIN_24GHZ_CHANNEL = CHAN_ENUM_2412,
470 	MAX_24GHZ_CHANNEL = CHAN_ENUM_2484,
471 	NUM_24GHZ_CHANNELS = (MAX_24GHZ_CHANNEL - MIN_24GHZ_CHANNEL + 1),
472 
473 	INVALID_CHANNEL = 0xBAD,
474 
475 #ifdef CONFIG_49GHZ_CHAN
476 	MIN_49GHZ_CHANNEL = CHAN_ENUM_4912,
477 	MAX_49GHZ_CHANNEL = CHAN_ENUM_5080,
478 	NUM_49GHZ_CHANNELS = (MAX_49GHZ_CHANNEL - MIN_49GHZ_CHANNEL + 1),
479 #else
480 	MIN_49GHZ_CHANNEL = INVALID_CHANNEL,
481 	MAX_49GHZ_CHANNEL = INVALID_CHANNEL,
482 	NUM_49GHZ_CHANNELS = 0,
483 #endif /* CONFIG_49GHZ_CHAN */
484 
485 	MIN_5GHZ_CHANNEL = CHAN_ENUM_5180,
486 #ifdef WLAN_FEATURE_DSRC
487 	MAX_5GHZ_CHANNEL = CHAN_ENUM_5920,
488 #else
489 	MAX_5GHZ_CHANNEL = CHAN_ENUM_5885,
490 #endif
491 	NUM_5GHZ_CHANNELS = (MAX_5GHZ_CHANNEL - MIN_5GHZ_CHANNEL + 1),
492 
493 #ifdef WLAN_FEATURE_DSRC
494 	MIN_DSRC_CHANNEL = CHAN_ENUM_5850,
495 	MAX_DSRC_CHANNEL = CHAN_ENUM_5920,
496 	NUM_DSRC_CHANNELS = (MAX_DSRC_CHANNEL - MIN_DSRC_CHANNEL + 1),
497 #endif
498 
499 	MIN_5DOT9_CHANNEL = CHAN_ENUM_5845,
500 	MAX_5DOT9_CHANNEL = CHAN_ENUM_5885,
501 	NUM_5DOT9_CHANNELS = (MAX_5DOT9_CHANNEL - MIN_5DOT9_CHANNEL + 1),
502 
503 #ifdef CONFIG_49GHZ_CHAN
504 #define BAND_5GHZ_START_CHANNEL MIN_49GHZ_CHANNEL
505 #else
506 #define BAND_5GHZ_START_CHANNEL MIN_5GHZ_CHANNEL
507 #endif /* CONFIG_49GHZ_CHAN */
508 
509 #ifdef DISABLE_UNII_SHARED_BANDS
510 	MIN_UNII_1_BAND_CHANNEL = CHAN_ENUM_5180,
511 	MAX_UNII_1_BAND_CHANNEL = CHAN_ENUM_5240,
512 	NUM_UNII_1_BAND_CHANNELS = (MAX_UNII_1_BAND_CHANNEL -
513 				    MIN_UNII_1_BAND_CHANNEL + 1),
514 
515 	MIN_UNII_2A_BAND_CHANNEL = CHAN_ENUM_5260,
516 	MAX_UNII_2A_BAND_CHANNEL = CHAN_ENUM_5320,
517 	NUM_UNII_2A_BAND_CHANNELS = (MAX_UNII_2A_BAND_CHANNEL -
518 				     MIN_UNII_2A_BAND_CHANNEL + 1),
519 #endif
520 
521 #ifdef CONFIG_BAND_6GHZ
522 	MIN_6GHZ_CHANNEL = CHAN_ENUM_5935,
523 	MAX_6GHZ_CHANNEL = CHAN_ENUM_7115,
524 	NUM_6GHZ_CHANNELS = (MAX_6GHZ_CHANNEL - MIN_6GHZ_CHANNEL + 1),
525 	MIN_6GHZ_NON_ORPHAN_CHANNEL = CHAN_ENUM_5955,
526 #else
527 	MIN_6GHZ_CHANNEL = INVALID_CHANNEL,
528 	MAX_6GHZ_CHANNEL = INVALID_CHANNEL,
529 	NUM_6GHZ_CHANNELS = 0,
530 	MIN_6GHZ_NON_ORPHAN_CHANNEL = INVALID_CHANNEL,
531 #endif /* CONFIG_BAND_6GHZ */
532 };
533 
534 /**
535  * enum channel_state - channel state
536  * @CHANNEL_STATE_DISABLE: disabled state
537  * @CHANNEL_STATE_PASSIVE: passive state
538  * @CHANNEL_STATE_DFS: dfs state
539  * @CHANNEL_STATE_ENABLE: enabled state
540  * @CHANNEL_STATE_INVALID: invalid state
541  */
542 enum channel_state {
543 	CHANNEL_STATE_DISABLE,
544 	CHANNEL_STATE_PASSIVE,
545 	CHANNEL_STATE_DFS,
546 	CHANNEL_STATE_ENABLE,
547 	CHANNEL_STATE_INVALID,
548 };
549 
550 /**
551  * enum reg_6g_ap_type - Regulatory AP type for regulatory info subfield.
552  * @REG_INDOOR_AP: Indoor AP
553  * @REG_STANDARD_POWER_AP: Standard Power AP
554  * @REG_VERY_LOW_POWER_AP: Very low power AP
555  * @REG_CURRENT_MAX_AP_TYPE: current maximum, used to determine array size
556  * @REG_MAX_SUPP_AP_TYPE: Current maximum AP power typer supported in the IEEE
557  * standard.
558  * @REG_MAX_AP_TYPE: Maximum value possible for (3 bits) regulatory info
559  * sub-field in the 6G HE Operation IE
560  */
561 enum reg_6g_ap_type {
562 	REG_INDOOR_AP = 0,
563 	REG_STANDARD_POWER_AP = 1,
564 	REG_VERY_LOW_POWER_AP = 2,
565 	REG_CURRENT_MAX_AP_TYPE,
566 	REG_MAX_SUPP_AP_TYPE = REG_VERY_LOW_POWER_AP,
567 	REG_MAX_AP_TYPE = 7,
568 };
569 
570 /**
571  * enum reg_6g_client_type - Regulatory client type for max tx-power category
572  * @REG_DEFAULT_CLIENT: Default client
573  * @REG_SUBORDINATE_CLIENT: Subordinate client
574  * @REG_MAX_CLIENT_TYPE: Maximum value possible for max tx-power category
575  * (2 bits) sub-field in the TPE (Transmit Power Envelope) IE
576  * REG_INVALID_CLIENT_TYPE: Invalid client type
577  */
578 enum reg_6g_client_type {
579 	REG_DEFAULT_CLIENT = 0,
580 	REG_SUBORDINATE_CLIENT = 1,
581 	REG_MAX_CLIENT_TYPE = 2,
582 	REG_INVALID_CLIENT_TYPE = REG_MAX_CLIENT_TYPE,
583 };
584 
585 /**
586  * enum reg_domain: reg domain
587  * @REGDOMAIN_FCC: FCC domain
588  * @REGDOMAIN_ETSI: ETSI domain
589  * @REGDOMAIN_JAPAN: JAPAN domain
590  * @REGDOMAIN_WORLD: WORLD domain
591  * @REGDOMAIN_COUNT: Max domain
592  */
593 typedef enum {
594 	REGDOMAIN_FCC,
595 	REGDOMAIN_ETSI,
596 	REGDOMAIN_JAPAN,
597 	REGDOMAIN_WORLD,
598 	REGDOMAIN_COUNT
599 } v_REGDOMAIN_t;
600 
601 /**
602  * enum ctl_value - CTL value
603  * @CTL_FCC: CTL FCC
604  * @CTL_MKK: CTL MKK
605  * @CTL_ETSI: CTL ETSI
606  * @CTL_KOR: CTL KOR
607  * @CTL_CHN: CTL CHINA
608  * @CTL_USER_DEF: CTL USER_DEF
609  * @CTL_NONE: CTL NONE
610  */
611 enum ctl_value {
612 	CTL_FCC = 0x10,
613 	CTL_ETSI = 0x30,
614 	CTL_MKK = 0x40,
615 	CTL_KOR = 0x50,
616 	CTL_CHN = 0x60,
617 	CTL_USER_DEF = 0x70,
618 	CTL_NONE = 0xff
619 };
620 
621 /**
622  * struct freq_range: The range/band of frequencies, indicated by left and right
623  * edge frequencies.
624  * @left: Left edge freqency(inclusive)
625  * @right: Right edge freqency(inclusive)
626  */
627 struct freq_range {
628 	qdf_freq_t left;
629 	qdf_freq_t right;
630 };
631 
632 /**
633  * struct ch_params
634  * @ch_width: channel width
635  * @sec_ch_offset: secondary channel offset
636  * @center_freq_seg0: channel number for segment 0
637  * @center_freq_seg1: channel number segment 1
638  * @mhz_freq_seg0: Center frequency for segment 0
639  * @mhz_freq_seg1: Center frequency for segment 1
640  * @reg_punc_bitmap: Output puncturing bitmap
641  * @is_create_punc_bitmap: Whether puncturing bitmap is to be created or not
642  *                         Parameter 'reg_punc_bitmap' is valid only if
643  *                         is_create_punc_bitmap is true
644  */
645 struct ch_params {
646 	enum phy_ch_width ch_width;
647 	uint8_t sec_ch_offset;
648 	uint8_t center_freq_seg0;
649 	uint8_t center_freq_seg1;
650 	qdf_freq_t mhz_freq_seg0;
651 	qdf_freq_t mhz_freq_seg1;
652 #ifdef WLAN_FEATURE_11BE
653 	uint16_t reg_punc_bitmap;
654 	bool is_create_punc_bitmap;
655 #endif
656 };
657 
658 /**
659  * struct reg_channel_list
660  * @num_ch_params: Number of chan_param elements
661  * @chan_param: Object of type struct ch_params to hold channel params
662  * Currently chan_param is an array of 2 because maximum possible 320
663  * channels for a given primary channel is 2. This may be dynamically
664  * allocated in the future by the caller if num_ch_params is greater than 2.
665  *
666  */
667 #ifdef WLAN_FEATURE_11BE
668 #define MAX_NUM_CHAN_PARAM 2
669 struct reg_channel_list {
670 	uint8_t num_ch_params;
671 	struct ch_params chan_param[MAX_NUM_CHAN_PARAM];
672 };
673 #endif
674 
675 /**
676  * struct channel_power
677  * @center_freq: Channel Center Frequency
678  * @chan_num: channel number
679  * @tx_power: TX power
680  */
681 struct channel_power {
682 	qdf_freq_t center_freq;
683 	uint8_t chan_num;
684 	uint32_t tx_power;
685 };
686 
687 /**
688  * enum offset_t: channel offset
689  * @BW20: 20 mhz channel
690  * @BW40_LOW_PRIMARY: lower channel in 40 mhz
691  * @BW40_HIGH_PRIMARY: higher channel in 40 mhz
692  * @BW80: 80 mhz channel
693  * @BWALL: unknown bandwidth
694  */
695 enum offset_t {
696 	BW20 = 0,
697 	BW40_LOW_PRIMARY = 1,
698 	BW40_HIGH_PRIMARY = 3,
699 	BW80,
700 	BWALL,
701 	BW_INVALID = 0xFF
702 };
703 
704 /**
705  * enum behav_limit - behavior limit
706  * @BEHAV_NONE: none
707  * @BEHAV_BW40_LOW_PRIMARY: BW40 low primary
708  * @BEHAV_BW40_HIGH_PRIMARY: BW40 high primary
709  * @BEHAV_BW80_PLUS: BW 80 plus
710  * @BEHAV_INVALID: invalid behavior
711  */
712 enum behav_limit {
713 	BEHAV_NONE,
714 	BEHAV_BW40_LOW_PRIMARY,
715 	BEHAV_BW40_HIGH_PRIMARY,
716 	BEHAV_BW80_PLUS,
717 	BEHAV_INVALID = 0xFF
718 };
719 
720 /**
721  * struct c_freq_lst: The list data strucuture for the center frequencies
722  * @num_cfis: Number of center frequencies
723  * @p_cfis_arr: Start address of the array of center frequency indices. Center
724  *              for 40/80/160/320MHz band channel opclasses. For 20MHz the list
725  *              is empty as it is already available in @channels variable.
726  */
727 struct c_freq_lst {
728 	uint8_t num_cfis;
729 	const uint8_t *p_cfis_arr;
730 };
731 
732 /**
733  * struct reg_dmn_op_class_map_t: operating class
734  * @op_class: operating class number
735  * @chan_spacing: channel spacing
736  * @offset: offset
737  * @behav_limit: OR of bitmaps of enum behav_limit
738  * @start_freq: starting frequency
739  * @channels: channel set
740  * @p_cfi_lst_obj: Pointer to center frequency indices list
741  */
742 struct reg_dmn_op_class_map_t {
743 	uint8_t op_class;
744 	uint16_t chan_spacing;
745 	enum offset_t offset;
746 	uint16_t behav_limit;
747 	qdf_freq_t start_freq;
748 	uint8_t channels[REG_MAX_CHANNELS_PER_OPERATING_CLASS];
749 	const struct c_freq_lst *p_cfi_lst_obj;
750 };
751 
752 /**
753  * enum opclass_config: Opclass configuration
754  * @OPCLASSES_SUPPORTED_BY_CUR_HWMODE: Retrieve opclasses that is supported
755  * by the current hw mode.
756  * @OPCLASSES_NOT_SUPPORTED_BY_CUR_HWMODE: Retrieve opclasses that are not
757  * supported by the current hw mode.
758  * OPCLASSES_SUPPORTED_BY_DOMAIN: Populate the opclass supported by the radio
759  * without considering the capability of current hwmode.
760  */
761 enum opclass_config {
762 	OPCLASSES_SUPPORTED_BY_CUR_HWMODE = 1,
763 	OPCLASSES_NOT_SUPPORTED_BY_CUR_HWMODE = 2,
764 	OPCLASSES_SUPPORTED_BY_DOMAIN = 3
765 };
766 
767 /**
768  * struct regdmn_ap_cap_opclass_t: AP Cap operation class table
769  * @op_class: operating class number
770  * @ch_width: channel width in MHz
771  * @start_freq: Starting Frequency in MHz
772  * @behav_limit: OR of bitmaps of enum behav_limit
773  * @max_tx_pwr_dbm: Maximum tx power in dbm
774  * @num_supported_chan: Number of supported channels
775  * @num_non_supported_chan: Number of non-supported channels
776  * @sup_chan_list: Array of supported channel numbers
777  * @non_sup_chan_list: Array of non supported channel numbers
778  */
779 struct regdmn_ap_cap_opclass_t {
780 	uint8_t op_class;
781 	uint16_t ch_width;
782 	qdf_freq_t start_freq;
783 	uint16_t behav_limit;
784 	uint8_t max_tx_pwr_dbm;
785 	uint8_t num_supported_chan;
786 	uint8_t num_non_supported_chan;
787 	uint8_t sup_chan_list[REG_MAX_CHANNELS_PER_OPERATING_CLASS];
788 	uint8_t non_sup_chan_list[REG_MAX_CHANNELS_PER_OPERATING_CLASS];
789 };
790 
791 /**
792  * struct reg_dmn_supp_op_classes: operating classes
793  * @num_classes: number of classes
794  * @classes: classes
795  */
796 struct reg_dmn_supp_op_classes {
797 	uint8_t num_classes;
798 	uint8_t classes[REG_MAX_SUPP_OPER_CLASSES];
799 };
800 
801 /**
802  * struct reg_start_11d_scan_req: start 11d scan request
803  * @vdev_id: vdev id
804  * @scan_period_msec: scan duration in milli-seconds
805  * @start_interval_msec: offset duration to start the scan in milli-seconds
806  */
807 struct reg_start_11d_scan_req {
808 	uint8_t vdev_id;
809 	uint32_t scan_period_msec;
810 	uint32_t start_interval_msec;
811 };
812 
813 /**
814  * struct reg_11d_scan_msg: 11d scan message structure
815  * @psoc: pointer to psoc object
816  * @enable_11d_supp: enable 11d scan or disable 11d scan
817  */
818 struct reg_11d_scan_msg {
819 	struct wlan_objmgr_psoc *psoc;
820 	bool enable_11d_supp;
821 };
822 /**
823  * struct reg_stop_11d_scan_req: stop 11d scan request
824  * @vdev_id: vdev id
825  */
826 struct reg_stop_11d_scan_req {
827 	uint8_t vdev_id;
828 };
829 
830 /**
831  * struct reg_11d_new_country: regulatory 11d new coutry code
832  * @alpha2: new 11d alpha2
833  */
834 struct reg_11d_new_country {
835 	uint8_t alpha2[REG_ALPHA2_LEN + 1];
836 };
837 
838 /**
839  * enum country_src: country source
840  * @SOURCE_QUERY: source query
841  * @SOURCE_CORE: source regulatory core
842  * @SOURCE_DRIVER: source driver
843  * @SOURCE_USERSPACE: source userspace
844  * @SOURCE_11D: source 11D
845  */
846 enum country_src {
847 	SOURCE_UNKNOWN,
848 	SOURCE_QUERY,
849 	SOURCE_CORE,
850 	SOURCE_DRIVER,
851 	SOURCE_USERSPACE,
852 	SOURCE_11D
853 };
854 
855 #ifdef WLAN_FEATURE_GET_USABLE_CHAN_LIST
856 /**
857  * enum iftype - (virtual) interface types
858  *
859  * @IFTYPE_UNSPECIFIED: unspecified type, driver decides
860  * @IFTYPE_ADHOC: independent BSS member
861  * @IFTYPE_STATION: managed BSS member
862  * @IFTYPE_AP: access point
863  * @IFTYPE_AP_VLAN: VLAN interface for access points; VLAN interfaces
864  *      are a bit special in that they must always be tied to a pre-existing
865  *      AP type interface.
866  * @IFTYPE_WDS: wireless distribution interface
867  * @IFTYPE_MONITOR: monitor interface receiving all frames
868  * @IFTYPE_MESH_POINT: mesh point
869  * @IFTYPE_P2P_CLIENT: P2P client
870  * @IFTYPE_P2P_GO: P2P group owner
871  * @IFTYPE_P2P_DEVICE: P2P device interface type, this is not a netdev
872  *      and therefore can't be created in the normal ways, use the
873  *      %NL80211_CMD_START_P2P_DEVICE and %NL80211_CMD_STOP_P2P_DEVICE
874  *      commands to create and destroy one
875  * @IF_TYPE_OCB: Outside Context of a BSS
876  *      This mode corresponds to the MIB variable dot11OCBActivated=true
877  * @IF_TYPE_NAN: NAN mode
878  * @IFTYPE_MAX: highest interface type number currently defined
879  * @NUM_IFTYPES: number of defined interface types
880  *
881  * These values are used with the %NL80211_ATTR_IFTYPE
882  * to set the type of an interface.
883  *
884  */
885 enum iftype {
886 	IFTYPE_UNSPECIFIED,
887 	IFTYPE_ADHOC,
888 	IFTYPE_STATION,
889 	IFTYPE_AP,
890 	IFTYPE_AP_VLAN,
891 	IFTYPE_WDS,
892 	IFTYPE_MONITOR,
893 	IFTYPE_MESH_POINT,
894 	IFTYPE_P2P_CLIENT,
895 	IFTYPE_P2P_GO,
896 	IFTYPE_P2P_DEVICE,
897 	IFTYPE_OCB,
898 	IFTYPE_NAN,
899 
900 	/* keep last */
901 	NUM_IFTYPES,
902 	IFTYPE_MAX = NUM_IFTYPES - 1
903 };
904 
905 /**
906  * usable_channels_filter - Filters to get usable channels
907  * FILTER_CELLULAR_COEX: Avoid lte coex channels
908  * FILTER_WLAN_CONCURRENCY: Avoid con channels
909  **/
910 enum usable_channels_filter {
911 	FILTER_CELLULAR_COEX = 0,
912 	FILTER_WLAN_CONCURRENCY = 1,
913 };
914 
915 /**
916  * get_usable_chan_res_params - Usable channels resp params
917  * freq : center freq
918  * seg0_freq : seg0 freq
919  * seg1_freq: seg1 freq
920  * bw : bandwidth
921  * state: channel state
922  * iface_mode_mask: interface mode mask
923  **/
924 struct get_usable_chan_res_params {
925 	qdf_freq_t freq;
926 	uint32_t seg0_freq;
927 	uint32_t seg1_freq;
928 	enum phy_ch_width bw;
929 	uint32_t iface_mode_mask;
930 	enum channel_state state;
931 };
932 
933 /**
934  * get_usable_chan_req_params - Usable channels req params
935  * band_mask : band mask
936  * iface_mode_mask: interface mode mask
937  * filter_mask: filter mask
938  **/
939 struct get_usable_chan_req_params {
940 	uint32_t band_mask;
941 	uint32_t iface_mode_mask;
942 	uint32_t filter_mask;
943 };
944 #endif
945 
946 /**
947  * struct regulatory_channel
948  * @center_freq: center frequency
949  * @chan_num: channel number
950  * @state: channel state
951  * @chan_flags: channel flags
952  * @tx_power: TX powers
953  * @min_bw: min bandwidth
954  * @max_bw: max bandwidth
955  * @nol_chan: whether channel is nol
956  * @nol_history: Set NOL-History when STA vap detects RADAR.
957  * @is_chan_hop_blocked: Whether channel is blocked for ACS hopping.
958  * @ht40intol_flags: Contains Flags to indicate whether the 40PLUS/40MINUS
959  *                   version of the channel is blocked by ACS due to
960  *                   intolerance.
961  * @psd_flag: is PSD channel or not
962  * @psd_eirp: PSD power level
963  */
964 struct regulatory_channel {
965 	qdf_freq_t center_freq;
966 	uint8_t chan_num;
967 	enum channel_state state;
968 	uint32_t chan_flags;
969 	uint32_t tx_power;
970 	uint16_t min_bw;
971 	uint16_t max_bw;
972 	uint8_t ant_gain;
973 	bool nol_chan;
974 	bool nol_history;
975 #ifdef CONFIG_HOST_FIND_CHAN
976 	bool is_chan_hop_blocked;
977 	uint8_t ht40intol_flags;
978 #endif
979 #ifdef CONFIG_BAND_6GHZ
980 	bool psd_flag;
981 	uint16_t psd_eirp;
982 #endif
983 };
984 
985 /** struct ap_cli_pwr_mode_info: AP and client power mode information
986  * @is_mode_ap: Is it AP or CLIENT
987  * @cli_type:  Is the client a default or subordinate
988  * @ap_pwr_mode: LPI, SP or VLP
989  */
990 struct ap_cli_pwr_mode_info {
991 	bool is_mode_ap;
992 	enum reg_6g_client_type cli_type;
993 	enum reg_6g_ap_type ap_pwr_mode;
994 };
995 
996 /**
997  * enum supported_6g_pwr_types: 6G supported AP and Client power types
998  * @REG_BEST_PWR_MODE: Best power mode
999  * @REG_CURRENT_PWR_MODE: Current power mode
1000  * @REG_AP_LPI: LPI AP power mode
1001  * @REG_AP_SP: SP AP power mode
1002  * @REG_AP_VLP: VLP AP power mode
1003  * @REG_CLI_DEF_LPI: LPI default client mode
1004  * @REG_CLI_DEF_SP: SP default client mode
1005  * @REG_CLI_DEF_VLP: VLP default client mode
1006  * @REG_CLI_SUB_LPI: LPI subordinate client mode
1007  * @REG_CLI_SUB_SP: SP subordinate client mode
1008  * @REG_CLI_SUB_VLP: VLP subordinate client mode
1009  * @REG_INVALID_PWR_MODE: Invalid power mode
1010  */
1011 enum supported_6g_pwr_types {
1012 	REG_BEST_PWR_MODE    = -1,
1013 	REG_CURRENT_PWR_MODE = 0,
1014 	REG_AP_LPI           = 1,
1015 	REG_AP_SP            = 2,
1016 	REG_AP_VLP           = 3,
1017 	REG_CLI_DEF_LPI      = 4,
1018 	REG_CLI_DEF_SP       = 5,
1019 	REG_CLI_DEF_VLP      = 6,
1020 	REG_CLI_SUB_LPI      = 7,
1021 	REG_CLI_SUB_SP       = 8,
1022 	REG_CLI_SUB_VLP      = 9,
1023 	REG_INVALID_PWR_MODE = 10,
1024 };
1025 
1026 #define MAX_PWR_TYPES 10
1027 /**
1028  * struct psd_val: Regulatory power information
1029  * @psd_flag: Boolean to indicate if PSD is supported or not
1030  * @psd_eirp: PSD power
1031  * @tx_power: Maximum EIRP
1032  */
1033 struct psd_val {
1034 	bool psd_flag;
1035 	uint16_t psd_eirp;
1036 	uint32_t tx_power;
1037 };
1038 
1039 /**
1040  * struct super_chan_info: Information of a 6G channel for every power
1041  * mode
1042  * @power_types: Bitmap whose bit positions indicate the power modes supported
1043  * by a channel
1044  * @best_power_mode: Best power mode of a channel
1045  * @min_bw: Array of minimum bandwidths per power mode
1046  * @max_bw: Array of maximum bandwidths per power mode
1047  * @chan_flags_arr: Array of channel flags
1048  * @reg_chan_pwr: Array of powers
1049  * @state_arr: Array of states
1050  */
1051 struct super_chan_info {
1052 	uint16_t power_types;
1053 	enum supported_6g_pwr_types best_power_mode;
1054 	uint16_t min_bw[MAX_PWR_TYPES];
1055 	uint16_t max_bw[MAX_PWR_TYPES];
1056 	uint32_t chan_flags_arr[MAX_PWR_TYPES];
1057 	struct psd_val reg_chan_pwr[MAX_PWR_TYPES];
1058 	enum channel_state state_arr[MAX_PWR_TYPES];
1059 };
1060 
1061 /**
1062  * struct regulatory: regulatory information
1063  * @reg_domain: regulatory domain pair
1064  * @eeprom_rd_ext: eeprom value
1065  * @country_code: current country in integer
1066  * @alpha2: current alpha2
1067  * @def_country: default country alpha2
1068  * @def_region: DFS region
1069  * @ctl_2g: 2G CTL value
1070  * @ctl_5g: 5G CTL value
1071  * @reg_pair: pointer to regulatory pair
1072  * @cc_src: country code src
1073  * @reg_flags: kernel regulatory flags
1074  */
1075 struct regulatory {
1076 	uint32_t reg_domain;
1077 	uint32_t eeprom_rd_ext;
1078 	uint16_t country_code;
1079 	uint8_t alpha2[REG_ALPHA2_LEN + 1];
1080 	uint8_t ctl_2g;
1081 	uint8_t ctl_5g;
1082 	const void *regpair;
1083 	enum country_src cc_src;
1084 	uint32_t reg_flags;
1085 };
1086 
1087 /**
1088  * struct chan_map
1089  * @center_freq: center freq in mhz
1090  * @chan_num: channel number
1091  * @min_bw: min bw
1092  * @max_bw: max bw
1093  */
1094 struct chan_map {
1095 	qdf_freq_t center_freq;
1096 	uint8_t chan_num;
1097 	uint16_t min_bw;
1098 	uint16_t max_bw;
1099 };
1100 
1101 /**
1102  * struct bonded_channel
1103  * @start_ch: start channel
1104  * @end_ch: end channel
1105  */
1106 struct bonded_channel {
1107 	uint8_t start_ch;
1108 	uint8_t end_ch;
1109 };
1110 
1111 /**
1112  * struct bonded_channel_freq
1113  * @start_freq: start channel frequency
1114  * @end_freq: end channel frequency
1115  */
1116 struct bonded_channel_freq {
1117 	uint16_t start_freq;
1118 	uint16_t end_freq;
1119 };
1120 
1121 struct set_country {
1122 	uint8_t country[REG_ALPHA2_LEN + 1];
1123 	uint8_t pdev_id;
1124 };
1125 /**
1126  * enum ht_sec_ch_offset
1127  * @NO_SEC_CH: no secondary
1128  * @LOW_PRIMARY_CH: low primary
1129  * @HIGH_PRIMARY_CH: high primary
1130  */
1131 enum ht_sec_ch_offset {
1132 	NO_SEC_CH = 0,
1133 	LOW_PRIMARY_CH = 1,
1134 	HIGH_PRIMARY_CH = 3,
1135 };
1136 
1137 enum cc_setting_code {
1138 	REG_SET_CC_STATUS_PASS = 0,
1139 	REG_CURRENT_ALPHA2_NOT_FOUND = 1,
1140 	REG_INIT_ALPHA2_NOT_FOUND = 2,
1141 	REG_SET_CC_CHANGE_NOT_ALLOWED = 3,
1142 	REG_SET_CC_STATUS_NO_MEMORY = 4,
1143 	REG_SET_CC_STATUS_FAIL = 5,
1144 };
1145 
1146 /**
1147  * struct cur_reg_rule
1148  * @start_freq: start frequency
1149  * @end_freq: end frequency
1150  * @max_bw: maximum bandwidth
1151  * @reg_power: regulatory power
1152  * @ant_gain: antenna gain
1153  * @flags: regulatory flags
1154  * @psd_flag: is PSD power used
1155  * @psd_eirp: maximum PSD EIRP value
1156  */
1157 struct cur_reg_rule {
1158 	uint16_t start_freq;
1159 	uint16_t end_freq;
1160 	uint16_t max_bw;
1161 	uint8_t reg_power;
1162 	uint8_t ant_gain;
1163 	uint16_t flags;
1164 	bool psd_flag;
1165 	uint16_t psd_eirp;
1166 };
1167 
1168 /**
1169  * struct cur_regulatory_info
1170  * @psoc: psoc ptr
1171  * @status_code: status value
1172  * @num_phy: number of phy
1173  * @phy_id: phy id
1174  * @reg_dmn_pair: reg domain pair
1175  * @ctry_code: country code
1176  * @alpha2: country alpha2
1177  * @offload_enabled: offload enabled
1178  * @dfs_reg: dfs region
1179  * @phybitmap: phy bit map
1180  * @min_bw_2g: minimum 2G bw
1181  * @max_bw_2g: maximum 2G bw
1182  * @min_bw_5g: minimum 5G bw
1183  * @max_bw_5g: maximum 5G bw
1184  * @num_2g_reg_rules: number 2G reg rules
1185  * @num_5g_reg_rules: number 5G  and 6G reg rules
1186  * @reg_6g_thresh_priority_freq: All frequencies greater or equal will be given
1187  * priority during channel selection by upper layer
1188  * @reg_rules_2g_ptr: ptr to 2G reg rules
1189  * @reg_rules_5g_ptr: ptr to 5G reg rules
1190  * @client_type: type of client
1191  * @rnr_tpe_usable: if RNR TPE octet is usable for country
1192  * @unspecified_ap_usable: if not set, AP usable for country
1193  * @domain_code_6g_ap: domain code for 6G AP
1194  * @domain_code_6g_client: domain code for 6G client in SP mode
1195  * @domain_code_6g_super_id: 6G super domain ID
1196  * @min_bw_6g_ap: minimum 6G bw for AP
1197  * @max_bw_6g_ap: maximum 6G bw for AP
1198  * @min_bw_6g_client: list of minimum 6G bw for clients
1199  * @max_bw_6g_client: list of maximum 6G bw for clients
1200  * @num_6g_reg_rules_ap: number of 6G reg rules for AP
1201  * @num_6g_reg_rules_client: list of number of 6G reg rules for client
1202  * @reg_rules_6g_ap_ptr: ptr to 6G AP reg rules
1203  * @reg_rules_6g_client_ptr: list of ptr to 6G client reg rules
1204  */
1205 struct cur_regulatory_info {
1206 	struct wlan_objmgr_psoc *psoc;
1207 	enum cc_setting_code status_code;
1208 	uint8_t num_phy;
1209 	uint8_t phy_id;
1210 	uint16_t reg_dmn_pair;
1211 	uint16_t ctry_code;
1212 	uint8_t alpha2[REG_ALPHA2_LEN + 1];
1213 	bool offload_enabled;
1214 	enum dfs_reg dfs_region;
1215 	uint32_t phybitmap;
1216 	uint32_t min_bw_2g;
1217 	uint32_t max_bw_2g;
1218 	uint32_t min_bw_5g;
1219 	uint32_t max_bw_5g;
1220 	uint32_t num_2g_reg_rules;
1221 	uint32_t num_5g_reg_rules;
1222 	qdf_freq_t reg_6g_thresh_priority_freq;
1223 	struct cur_reg_rule *reg_rules_2g_ptr;
1224 	struct cur_reg_rule *reg_rules_5g_ptr;
1225 	enum reg_6g_client_type client_type;
1226 	bool rnr_tpe_usable;
1227 	bool unspecified_ap_usable;
1228 	uint8_t domain_code_6g_ap[REG_CURRENT_MAX_AP_TYPE];
1229 	uint8_t domain_code_6g_client[REG_CURRENT_MAX_AP_TYPE][REG_MAX_CLIENT_TYPE];
1230 	uint32_t domain_code_6g_super_id;
1231 	uint32_t min_bw_6g_ap[REG_CURRENT_MAX_AP_TYPE];
1232 	uint32_t max_bw_6g_ap[REG_CURRENT_MAX_AP_TYPE];
1233 	uint32_t min_bw_6g_client[REG_CURRENT_MAX_AP_TYPE][REG_MAX_CLIENT_TYPE];
1234 	uint32_t max_bw_6g_client[REG_CURRENT_MAX_AP_TYPE][REG_MAX_CLIENT_TYPE];
1235 	uint32_t num_6g_reg_rules_ap[REG_CURRENT_MAX_AP_TYPE];
1236 	uint32_t num_6g_reg_rules_client[REG_CURRENT_MAX_AP_TYPE][REG_MAX_CLIENT_TYPE];
1237 	struct cur_reg_rule *reg_rules_6g_ap_ptr[REG_CURRENT_MAX_AP_TYPE];
1238 	struct cur_reg_rule *reg_rules_6g_client_ptr[REG_CURRENT_MAX_AP_TYPE][REG_MAX_CLIENT_TYPE];
1239 };
1240 
1241 #if defined(CONFIG_AFC_SUPPORT) && defined(CONFIG_BAND_6GHZ)
1242 
1243 /**
1244  * reg_afc_event_type indicates the type of AFC event sent from FW to host.
1245  * 1. For sending Power Info REG_AFC_EVENT_POWER_INFO event is used.
1246  * 2. For sending AFC expiry use REG_AFC_EVENT_TIMER_EXPIRY
1247  * This type can be expanded in future as per requirements.
1248  */
1249 enum reg_afc_event_type {
1250 	REG_AFC_EVENT_POWER_INFO = 1,
1251 	REG_AFC_EVENT_TIMER_EXPIRY = 2,
1252 };
1253 
1254 /**
1255  * reg_afc_expiry_event_subtype indicates the subtype.
1256  * 1. At boot up AFC expiry will contain AFC start.
1257  * 2. If AFC timer expires AFC_RENEW status code will be sent to host
1258  *    with expiry event.
1259  * 3. If AFC server is not responding to FW in specified time, FW will
1260  *    indicate host to switch to LPI.
1261  */
1262 enum reg_afc_expiry_event_subtype {
1263 	REG_AFC_EXPIRY_EVENT_START = 1,
1264 	REG_AFC_EXPIRY_EVENT_RENEW = 2,
1265 	REG_AFC_EXPIRY_EVENT_SWITCH_TO_LPI = 3,
1266 	REG_AFC_EXPIRY_EVENT_STOP_TX = 4,
1267 };
1268 
1269 /**
1270  * The following fw_status_code is mutually exclusive
1271  * and is used in power event.
1272  * 0. AFC power event is success.
1273  * 1. If Host does not indicate AFC indication cmd within certain time
1274  *    of AFC expiry, REG_FW_AFC_POWER_EVENT_RESP_NOT_RECEIVED will be used.
1275  * 2. If FW is not able to parse afc_info, parsing_failure will be
1276  *    indicated using REG_FW_AFC_POWER_EVENT_RESP_NOT_RECEIVED.
1277  * 3. If due to some local reason AFC event is failed, AFC event failure
1278  *    is indicated using REG_FW_AFC_POWER_EVENT_FAILURE.
1279  */
1280 enum reg_fw_afc_power_event_status_code {
1281 	REG_FW_AFC_POWER_EVENT_SUCCESS = 0,
1282 	REG_FW_AFC_POWER_EVENT_RESP_NOT_RECEIVED = 1,
1283 	REG_FW_AFC_POWER_EVENT_RESP_PARSING_FAILURE = 2,
1284 	REG_FW_AFC_POWER_EVENT_FAILURE = 3,
1285 };
1286 
1287 /**
1288  * The following reg_afc_server_resp_code is mutually exclusive.
1289  * This response code will be indicated to AFC server.
1290  * These codes are defined in WIFI spec doc for AFC as follows
1291  * -1: General Failure
1292  * 0:  Success
1293  * 100 - 199: General errors related to the protocol
1294  * 300 - 399: Error events specific to message exchange for the
1295  *            Available Spectrum Inquiry
1296  */
1297 enum reg_afc_serv_resp_code {
1298 	REG_AFC_SERV_RESP_GENERAL_FAILURE = -1,
1299 	REG_AFC_SERV_RESP_SUCCESS = 0,
1300 	REG_AFC_SERV_RESP_VERSION_NOT_SUPPORTED = 100,
1301 	REG_AFC_SERV_RESP_DEVICE_UNALLOWED = 101,
1302 	REG_AFC_SERV_RESP_MISSING_PARAM = 102,
1303 	REG_AFC_SERV_RESP_INVALID_VALUE = 103,
1304 	REG_AFC_SERV_RESP_UNEXPECTED_PARAM = 106,
1305 	REG_AFC_SERV_RESP_UNSUPPORTED_SPECTRUM = 300,
1306 };
1307 
1308 /**
1309  * struct afc_freq_obj
1310  * @low_freq: Lower edge frequency
1311  * @high_freq: Upper edge frequency
1312  * @max_psd: Max PSD in 0.01 dBm/MHz units
1313  */
1314 struct afc_freq_obj {
1315 	qdf_freq_t low_freq;
1316 	qdf_freq_t high_freq;
1317 	int16_t max_psd;
1318 };
1319 
1320 /**
1321  * struct chan_eirp_obj
1322  * @cfi: Channel frequency index
1323  * @eirp_power: Max EIRP power in 0.01 dBm units
1324  */
1325 struct chan_eirp_obj {
1326 	uint8_t cfi;
1327 	uint16_t eirp_power;
1328 };
1329 
1330 /**
1331  * struct afc_chan_obj
1332  * @global_opclass: Global Operating class
1333  * @num_chans: Number of channels
1334  * @chan_eirp_info: Pointer to afc channel EIRP object
1335  */
1336 struct afc_chan_obj {
1337 	uint8_t global_opclass;
1338 	uint8_t num_chans;
1339 	struct chan_eirp_obj *chan_eirp_info;
1340 };
1341 
1342 /**
1343  * struct reg_afc_expiry_event
1344  * @request_id: AFC request id generated by the firmware
1345  * @event_subtype: AFC expiry event subtype
1346  */
1347 struct reg_afc_expiry_event {
1348 	uint32_t request_id;
1349 	enum reg_afc_expiry_event_subtype event_subtype;
1350 };
1351 
1352 /**
1353  * struct reg_fw_afc_power_event
1354  * @resp_id: AFC server response id
1355  * @fw_status_code: firmware status code
1356  * @serv_resp_code: AFC server response code
1357  * @afc_wfa_version: AFC version
1358  * @avail_exp_time_d: Expiry date of the AFC power info
1359  * @avail_exp_time_t: Time left for expiry of the AFC power info
1360  * @num_freq_objs: Number of freq objects
1361  * @num_chan_objs: Number of channel objects
1362  * @afc_freq_info: Pointer to AFC freq object
1363  * @afc_chan_info: Pointer to AFC channel object
1364  */
1365 struct reg_fw_afc_power_event {
1366 	uint32_t resp_id;
1367 	enum reg_fw_afc_power_event_status_code fw_status_code;
1368 	enum reg_afc_serv_resp_code serv_resp_code;
1369 	uint32_t afc_wfa_version;
1370 	uint32_t avail_exp_time_d;
1371 	uint32_t avail_exp_time_t;
1372 	uint8_t num_freq_objs;
1373 	uint8_t num_chan_objs;
1374 	struct afc_freq_obj *afc_freq_info;
1375 	struct afc_chan_obj *afc_chan_info;
1376 };
1377 
1378 /**
1379  * struct afc_regulatory_info
1380  * @psoc: psoc ptr
1381  * @phy_id: phy id
1382  * @event_type: AFC event type
1383  * @expiry_info: pointer to information present in the AFC expiry event
1384  * @power_info: pointer to information present in the AFC power event
1385  */
1386 struct afc_regulatory_info {
1387 	struct wlan_objmgr_psoc *psoc;
1388 	uint8_t phy_id;
1389 	enum reg_afc_event_type event_type;
1390 	union {
1391 		struct reg_afc_expiry_event *expiry_info;
1392 		struct reg_fw_afc_power_event *power_info;
1393 	};
1394 };
1395 #endif
1396 
1397 /**
1398  * struct reg_rule_info
1399  * @alpha2: alpha2 of reg rules
1400  * @dfs_region: dfs region
1401  * @num_of_reg_rules: number of reg rules
1402  * @reg_rules: regulatory rules array
1403  * @num_of_6g_client_reg_rules: number of 6g reg rules
1404  * @reg_rules_6g_client: reg rules for all 6g clients
1405  */
1406 struct reg_rule_info {
1407 	uint8_t alpha2[REG_ALPHA2_LEN + 1];
1408 	enum dfs_reg dfs_region;
1409 	uint8_t num_of_reg_rules;
1410 	struct cur_reg_rule reg_rules[MAX_REG_RULES];
1411 #ifdef CONFIG_BAND_6GHZ
1412 	uint8_t num_of_6g_ap_reg_rules[REG_CURRENT_MAX_AP_TYPE];
1413 	struct cur_reg_rule reg_rules_6g_ap[REG_CURRENT_MAX_AP_TYPE][MAX_6G_REG_RULES];
1414 	uint8_t num_of_6g_client_reg_rules[REG_CURRENT_MAX_AP_TYPE];
1415 	struct cur_reg_rule reg_rules_6g_client[REG_CURRENT_MAX_AP_TYPE][MAX_6G_REG_RULES];
1416 #endif
1417 };
1418 
1419 /**
1420  * enum reg_reg_wifi_band
1421  * @REG_BAND_2G: 2G band
1422  * @REG_BAND_5G: 5G band
1423  * @REG_BAND_6G: 6G band
1424  * @REG_BAND_UNKNOWN: Unsupported band
1425  */
1426 enum reg_wifi_band {
1427 	REG_BAND_2G,
1428 	REG_BAND_5G,
1429 	REG_BAND_6G,
1430 	REG_BAND_UNKNOWN
1431 };
1432 
1433 #ifdef DISABLE_UNII_SHARED_BANDS
1434 /**
1435  * enum reg_unii_band
1436  * @REG_UNII_BAND_1: Disable UNII-1 band channels
1437  * @REG_UNII_BAND_2A: Disable UNII-2A band channels
1438  */
1439 enum reg_unii_band {
1440 	REG_UNII_BAND_1 = 0x0,
1441 	REG_UNII_BAND_2A = 0x1,
1442 };
1443 #endif
1444 
1445 #define REG_BAND_MASK_ALL (BIT(REG_BAND_2G) | BIT(REG_BAND_5G) \
1446 			  | BIT(REG_BAND_6G))
1447 
1448 /* Avoid the use of band_info as it does not support 6GHz band. Use
1449  * reg_wifi_band, as it supports the 6GHz band
1450  */
1451 /**
1452  * enum band_info
1453  * @BAND_ALL:all bands
1454  * @BAND_2G: 2G band
1455  * @BAND_5G: 5G band
1456  * @BAND_UNKNOWN: Unsupported band
1457  */
1458 enum band_info {
1459 	BAND_ALL,
1460 	BAND_2G,
1461 	BAND_5G,
1462 	BAND_UNKNOWN
1463 };
1464 
1465 /**
1466  * enum restart_beaconing_on_ch_avoid_rule: control the beaconing entity to
1467  * move away from active LTE channels
1468  * @CH_AVOID_RULE_DO_NOT_RESTART: Do not move from active LTE
1469  *                              channels
1470  * @CH_AVOID_RULE_RESTART: Move from active LTE channels
1471  * @CH_AVOID_RULE_RESTART_24G_ONLY: move from 2.4G active LTE
1472  *                                channels only
1473  */
1474 enum restart_beaconing_on_ch_avoid_rule {
1475 	CH_AVOID_RULE_DO_NOT_RESTART,
1476 	CH_AVOID_RULE_RESTART,
1477 	CH_AVOID_RULE_RESTART_24G_ONLY,
1478 };
1479 
1480 /**
1481  * struct reg_config_vars
1482  * @enable_11d_support: enable 11d support
1483  * @scan_11d_interval: 11d scan interval in ms
1484  * @userspace_ctry_priority: user priority
1485  * @band_capability: band capability
1486  * @dfs_disable: dfs disabled
1487  * @indoor_channel_support: indoor channel support
1488  * @force_ssc_disable_indoor_channel: Disable indoor channel on sap start
1489  * @restart_beaconing: control the beaconing entity to move
1490  * away from active LTE channels
1491  * @enable_srd_chan_in_master_mode: SRD channel support in master mode
1492  * @enable_11d_in_world_mode: enable 11d in world mode
1493  * @enable_5dot9_ghz_chan_in_master_mode: 5.9 GHz channel support in
1494  * master mode
1495  * @retain_nol_across_regdmn_update: Retain the NOL list across the regdomain.
1496  * @coex_unsafe_chan_nb_user_prefer: Honor coex unsafe chan cmd from firmware or
1497  * userspace
1498  * @coex_unsafe_chan_reg_disable: To disable reg channels for received coex
1499  * unsafe channels list
1500  * @sta_sap_scc_on_indoor_channel: Value of sap+sta scc on indoor support
1501  */
1502 struct reg_config_vars {
1503 	uint32_t enable_11d_support;
1504 	uint32_t scan_11d_interval;
1505 	uint32_t userspace_ctry_priority;
1506 	uint32_t band_capability;
1507 	uint32_t dfs_enabled;
1508 	uint32_t indoor_chan_enabled;
1509 	uint32_t force_ssc_disable_indoor_channel;
1510 	enum restart_beaconing_on_ch_avoid_rule restart_beaconing;
1511 	uint8_t enable_srd_chan_in_master_mode;
1512 	bool enable_11d_in_world_mode;
1513 	bool enable_5dot9_ghz_chan_in_master_mode;
1514 	bool retain_nol_across_regdmn_update;
1515 #ifdef FEATURE_WLAN_CH_AVOID_EXT
1516 	bool coex_unsafe_chan_nb_user_prefer;
1517 	bool coex_unsafe_chan_reg_disable;
1518 #endif
1519 	bool sta_sap_scc_on_indoor_channel;
1520 };
1521 
1522 /**
1523  * struct reg_freq_range
1524  * @low_freq: low frequency
1525  * @high_freq: high frequency
1526  */
1527 struct reg_freq_range {
1528 	uint32_t low_freq;
1529 	uint32_t high_freq;
1530 };
1531 
1532 /**
1533  * enum direction
1534  * @NORTHBOUND: northbound
1535  * @SOUTHBOUND: southbound
1536  */
1537 enum direction {
1538 	NORTHBOUND,
1539 	SOUTHBOUND,
1540 };
1541 
1542 /**
1543  * struct mas_chan_params
1544  * @dfs_region: dfs region
1545  * @phybitmap: phybitmap
1546  * @mas_chan_list: master chan list for 2GHz and 5GHz channels
1547  * @is_6g_channel_list_populated: indicates the channel lists are populated
1548  * @mas_chan_list_6g_ap: master chan list for 6GHz AP channels
1549  * @mas_chan_list_6g_client: master chan list for 6GHz client
1550  * @is_6g_afc_power_event_received: indicates if the AFC event is received.
1551  * @mas_chan_list_6g_afc: master chan list for 6GHz AFC
1552  * @default_country: default country
1553  * @current_country: current country
1554  * @def_region_domain: default reg domain
1555  * @def_country_code: default country code
1556  * @reg_dmn_pair: reg domain pair
1557  * @reg_6g_superid: 6G super domain ID
1558  * @ctry_code: country code
1559  * @reg_rules: regulatory rules
1560  * @client_type: type of client
1561  * @rnr_tpe_usable: if RNR TPE octet is usable for country
1562  * @unspecified_ap_usable: if not set, AP usable for country
1563  * @max_bw_5g: Maximum 5g Bandwidth
1564  * @reg_6g_thresh_priority_freq: All frequencies greater or equal will be given
1565  * priority during channel selection by upper layer
1566  */
1567 struct mas_chan_params {
1568 	enum dfs_reg dfs_region;
1569 	uint32_t phybitmap;
1570 	struct regulatory_channel mas_chan_list[NUM_CHANNELS];
1571 #ifdef CONFIG_BAND_6GHZ
1572 	bool is_6g_channel_list_populated;
1573 	struct regulatory_channel mas_chan_list_6g_ap[REG_CURRENT_MAX_AP_TYPE][NUM_6GHZ_CHANNELS];
1574 	struct regulatory_channel mas_chan_list_6g_client[REG_CURRENT_MAX_AP_TYPE][REG_MAX_CLIENT_TYPE][NUM_6GHZ_CHANNELS];
1575 #ifdef CONFIG_AFC_SUPPORT
1576 	bool is_6g_afc_power_event_received;
1577 	struct regulatory_channel mas_chan_list_6g_afc[NUM_6GHZ_CHANNELS];
1578 #endif
1579 #endif
1580 	char default_country[REG_ALPHA2_LEN + 1];
1581 	char current_country[REG_ALPHA2_LEN + 1];
1582 	uint16_t def_region_domain;
1583 	uint16_t def_country_code;
1584 	uint32_t reg_dmn_pair;
1585 	uint16_t reg_6g_superid;
1586 	uint16_t ctry_code;
1587 	struct reg_rule_info reg_rules;
1588 #ifdef CONFIG_BAND_6GHZ
1589 	enum reg_6g_ap_type ap_pwr_type;
1590 	enum reg_6g_client_type client_type;
1591 	bool rnr_tpe_usable;
1592 	bool unspecified_ap_usable;
1593 	qdf_freq_t reg_6g_thresh_priority_freq;
1594 #endif
1595 	uint16_t max_bw_5g;
1596 };
1597 
1598 /**
1599  * enum cc_regdmn_flag: Regdomain flags
1600  * @INVALID:       Invalid flag
1601  * @CC_IS_SET:     Country code is set
1602  * @REGDMN_IS_SET: Regdomain ID is set
1603  * @ALPHA_IS_SET:  Country ISO is set
1604  */
1605 enum cc_regdmn_flag {
1606 	INVALID_CC,
1607 	CC_IS_SET,
1608 	REGDMN_IS_SET,
1609 	ALPHA_IS_SET,
1610 };
1611 
1612 /**
1613  * struct cc_regdmn_s: User country code or regdomain
1614  * @country_code:     Country code
1615  * @reg_2g_5g_pair_id:  Regdomain pair ID (2Ghz + 5Ghz domain pair)
1616  * @sixg_superdmn_id: 6Ghz super domain id
1617  * @alpha:            Country ISO
1618  * @flags:            Regdomain flags
1619  */
1620 struct cc_regdmn_s {
1621 	union {
1622 		uint16_t country_code;
1623 		struct {
1624 			uint16_t reg_2g_5g_pair_id;
1625 			uint16_t sixg_superdmn_id;
1626 		} regdmn;
1627 		uint8_t alpha[REG_ALPHA2_LEN + 1];
1628 	} cc;
1629 	uint8_t flags;
1630 };
1631 
1632 /**
1633  * struct cur_regdmn_info: Current regulatory info
1634  * @regdmn_pair_id: Current regdomain pair ID
1635  * @dmn_id_2g: 2GHz regdomain ID
1636  * @dmn_id_5g: 5GHz regdomain ID
1637  * @ctl_2g: 2GHz CTL value
1638  * @ctl_5g: 5GHzCTL value
1639  * @dfs_region: dfs region
1640  */
1641 struct cur_regdmn_info {
1642 	uint16_t regdmn_pair_id;
1643 	uint16_t dmn_id_2g;
1644 	uint16_t dmn_id_5g;
1645 	uint8_t ctl_2g;
1646 	uint8_t ctl_5g;
1647 	uint8_t dfs_region;
1648 };
1649 
1650 /**
1651  * struct ch_avoid_freq_type
1652  * @start_freq: start freq
1653  * @end_freq: end freq
1654  * @txpower: txpower
1655  */
1656 struct ch_avoid_freq_type {
1657 	qdf_freq_t start_freq;
1658 	qdf_freq_t end_freq;
1659 	int32_t txpower;
1660 	bool is_valid_txpower;
1661 };
1662 
1663 /**
1664  * struct ch_avoid_ind_type
1665  * @ch_avoid_range_cnt: count
1666  * @avoid_freq_range: avoid freq range array
1667  * @restriction_mask: restriction mask to apply txpower
1668  */
1669 struct ch_avoid_ind_type {
1670 	uint32_t ch_avoid_range_cnt;
1671 	struct ch_avoid_freq_type avoid_freq_range[CH_AVOID_MAX_RANGE];
1672 	uint32_t restriction_mask;
1673 };
1674 
1675 /**
1676  * struct unsafe_ch_list
1677  * @chan_cnt: no.of channels
1678  * @chan_freq_list: channel frequency list
1679  */
1680 struct unsafe_ch_list {
1681 	uint16_t chan_cnt;
1682 	uint16_t chan_freq_list[NUM_CHANNELS];
1683 	int32_t txpower[NUM_CHANNELS];
1684 	bool is_valid_txpower[NUM_CHANNELS];
1685 };
1686 
1687 /**
1688  * struct avoid_freq_ind_data
1689  * @freq_list: frequency list
1690  * @chan_list: channel list
1691  */
1692 struct avoid_freq_ind_data {
1693 	struct ch_avoid_ind_type freq_list;
1694 	struct unsafe_ch_list chan_list;
1695 };
1696 
1697 /**
1698  * struct reg_sched_payload
1699  * @psoc: psoc ptr
1700  * @pdev: pdev ptr
1701  * @ch_avoid_ind: if avoidance event indicated
1702  * @avoid_info: chan avoid info if @ch_avoid_ind is true
1703  */
1704 struct reg_sched_payload {
1705 	struct wlan_objmgr_psoc *psoc;
1706 	struct wlan_objmgr_pdev *pdev;
1707 	bool ch_avoid_ind;
1708 	struct avoid_freq_ind_data avoid_info;
1709 };
1710 
1711 #define FIVEG_STARTING_FREQ        5000
1712 #define TWOG_STARTING_FREQ         2407
1713 #define TWOG_CHAN_14_IN_MHZ        2484
1714 #define TWOG_CHAN_1_IN_MHZ         2412
1715 #define TWOG_CHAN_5_IN_MHZ         2432
1716 #define TWOG_CHAN_6_IN_MHZ         2437
1717 #define TWOG_CHAN_9_IN_MHZ         2452
1718 #define TWOG_CHAN_13_IN_MHZ        2472
1719 #define FIVEG_CHAN_36_IN_MHZ       5180
1720 #define FIVEG_CHAN_177_IN_MHZ      5885
1721 #define SIXG_CHAN_2_IN_MHZ         5935
1722 #define SIXG_CHAN_1_IN_MHZ         5955
1723 #define SIXG_CHAN_233_IN_MHZ       7115
1724 
1725 #define HT40_SEC_OFFSET              20
1726 
1727 #define IEEE_2GHZ_CH1                 1
1728 #define IEEE_2GHZ_CH14               14
1729 #define IEEE_5GHZ_CH36               36
1730 #define IEEE_6GHZ_CH1                 1
1731 #define IEEE_6GHZ_CH2                 2
1732 #define IEEE_CH_SEP                   5
1733 
1734 /**
1735  * struct reg_ctl_params - reg ctl and regd info
1736  * @regd: regdomain pair
1737  * @regd_2g: 2g sub domain code
1738  * @regd_5g: 5g sub domain code
1739  * @ctl_2g: 2g ctl info
1740  * @ctl_5g: 5g ctl info
1741  */
1742 struct reg_ctl_params {
1743 	uint32_t regd;
1744 	uint16_t regd_2g;
1745 	uint16_t regd_5g;
1746 	uint8_t ctl_2g;
1747 	uint8_t ctl_5g;
1748 };
1749 
1750 /**
1751  * enum reg_phymode - Regulatory phymode
1752  * @REG_PHYMODE_INVALID: Invalid phymode
1753  * @REG_PHYMODE_11B: 802.11b phymode
1754  * @REG_PHYMODE_11G: 802.11g phymode
1755  * @REG_PHYMODE_11A: 802.11a phymode
1756  * @REG_PHYMODE_11N: 802.11n phymode
1757  * @REG_PHYMODE_11AC: 802.11ac phymode
1758  * @REG_PHYMODE_11AX: 802.11ax phymode
1759  * @REG_PHYMODE_11BE: 802.11be phymode
1760  * @REG_PHYMODE_MAX: placeholder for future phymodes
1761  */
1762 enum reg_phymode {
1763 	REG_PHYMODE_INVALID,
1764 	REG_PHYMODE_11B,
1765 	REG_PHYMODE_11G,
1766 	REG_PHYMODE_11A,
1767 	REG_PHYMODE_11N,
1768 	REG_PHYMODE_11AC,
1769 	REG_PHYMODE_11AX,
1770 #ifdef WLAN_FEATURE_11BE
1771 	REG_PHYMODE_11BE,
1772 #endif
1773 	REG_PHYMODE_MAX,
1774 };
1775 
1776 /**
1777  * struct chan_power_info - TPE containing power info per channel chunk
1778  * @chan_cfreq: channel center freq (MHz)
1779  * @tx_power: transmit power (dBm)
1780  */
1781 struct chan_power_info {
1782 	qdf_freq_t chan_cfreq;
1783 	uint8_t tx_power;
1784 };
1785 
1786 /**
1787  * struct reg_tpc_power_info - regulatory TPC power info
1788  * @is_psd_power: is PSD power or not
1789  * @eirp_power: Maximum EIRP power (dBm), valid only if power is PSD
1790  * @power_type_6g: type of power (SP/LPI/VLP)
1791  * @num_pwr_levels: number of power levels
1792  * @reg_max: Array of maximum TX power (dBm) per PSD value
1793  * @ap_constraint_power: AP constraint power (dBm)
1794  * @frequency: Array of operating frequency
1795  * @tpe: TPE values processed from TPE IE
1796  * @chan_power_info: power info to send to FW
1797  */
1798 struct reg_tpc_power_info {
1799 	bool is_psd_power;
1800 	uint8_t eirp_power;
1801 	uint8_t power_type_6g;
1802 	uint8_t num_pwr_levels;
1803 	uint8_t reg_max[MAX_NUM_PWR_LEVEL];
1804 	uint8_t ap_constraint_power;
1805 	qdf_freq_t frequency[MAX_NUM_PWR_LEVEL];
1806 	uint8_t tpe[MAX_NUM_PWR_LEVEL];
1807 	struct chan_power_info chan_power_info[MAX_NUM_PWR_LEVEL];
1808 };
1809 
1810 #ifdef FEATURE_WLAN_CH_AVOID_EXT
1811 typedef struct unsafe_ch_list avoid_ch_ext_list;
1812 /**
1813  * struct chan_5g_center_freq
1814  * @center_freq_20: center frequency of max 200Mhz
1815  * @center_freq_40: center frequency of max 40Mhz
1816  * @center_freq_80: center frequency of max 80Mhz
1817  * @center_freq_160: center frequency of max 160Mhz
1818  */
1819 struct chan_5g_center_freq {
1820 	qdf_freq_t center_freq_20;
1821 	qdf_freq_t center_freq_40;
1822 	qdf_freq_t center_freq_80;
1823 	qdf_freq_t center_freq_160;
1824 };
1825 
1826 #define INVALID_CENTER_FREQ 0
1827 /*MAX 5g channel numbers, not include dsrc*/
1828 #define MAX_5G_CHAN_NUM 28
1829 
1830 #endif
1831 
1832 /**
1833  * enum HOST_REGDMN_MODE:
1834  * @HOST_REGDMN_MODE_11A: 11a channels
1835  * @HOST_REGDMN_MODE_TURBO: 11a turbo-only channels
1836  * @HOST_REGDMN_MODE_11B: 11b channels
1837  * @HOST_REGDMN_MODE_PUREG: 11g channels (OFDM only)
1838  * @HOST_REGDMN_MODE_11G: historical
1839  * @HOST_REGDMN_MODE_108G: 11g+Turbo channels
1840  * @HOST_REGDMN_MODE_108A: 11a+Turbo channels
1841  * @HOST_REGDMN_MODE_11AC_VHT20_2G: 2GHz, VHT20
1842  * @HOST_REGDMN_MODE_XR: XR channels
1843  * @HOST_REGDMN_MODE_11A_HALF_RATE: 11a half rate channels
1844  * @HOST_REGDMN_MODE_11A_QUARTER_RATE: 11a quarter rate channels
1845  * @HOST_REGDMN_MODE_11NG_HT20: 11ng HT20 channels
1846  * @HOST_REGDMN_MODE_11NA_HT20: 11na HT20 channels
1847  * @HOST_REGDMN_MODE_11NG_HT40PLUS: 11ng HT40+ channels
1848  * @HOST_REGDMN_MODE_11NG_HT40MINUS: 11ng HT40- channels
1849  * @HOST_REGDMN_MODE_11NA_HT40PLUS: 11na HT40+ channels
1850  * @HOST_REGDMN_MODE_11NA_HT40MINUS: 11na HT40- channels
1851  * @HOST_REGDMN_MODE_11AC_VHT20: 5GHz, VHT20
1852  * @HOST_REGDMN_MODE_11AC_VHT40PLUS: 5GHz, VHT40+ channels
1853  * @HOST_REGDMN_MODE_11AC_VHT40MINUS: 5GHz, VHT40- channels
1854  * @HOST_REGDMN_MODE_11AC_VHT80: 5GHz, VHT80 channels
1855  * @HOST_REGDMN_MODE_11AC_VHT160: 5GHz, VHT160 channels
1856  * @HOST_REGDMN_MODE_11AC_VHT80_80: 5GHz, VHT80+80 channels
1857  * @HOST_REGDMN_MODE_11AXG_HE20: 11ax 2.4GHz, HE20 channels
1858  * @HOST_REGDMN_MODE_11AXA_HE20: 11ax 5GHz, HE20 channels
1859  * @HOST_REGDMN_MODE_11AXG_HE40PLUS: 11ax 2.4GHz, HE40+ channels
1860  * @HOST_REGDMN_MODE_11AXG_HE40MINUS: 11ax 2.4GHz, HE40- channels
1861  * @HOST_REGDMN_MODE_11AXA_HE40PLUS: 11ax 5GHz, HE40+ channels
1862  * @HOST_REGDMN_MODE_11AXA_HE40MINUS: 11ax 5GHz, HE40- channels
1863  * @HOST_REGDMN_MODE_11AXA_HE80: 11ax 5GHz, HE80 channels
1864  * @HOST_REGDMN_MODE_11AXA_HE160: 11ax 5GHz, HE160 channels
1865  * @HOST_REGDMN_MODE_11AXA_HE80_80: 11ax 5GHz, HE80+80 channels
1866  * @HOST_REGDMN_MODE_11BEG_EHT20: 11be 2.4GHz, EHT20 channels
1867  * @HOST_REGDMN_MODE_11BEA_EHT20: 11be 5GHz, EHT20 channels
1868  * @HOST_REGDMN_MODE_11BEG_EHT40PLUS: 11be 2.4GHz, EHT40+ channels
1869  * @HOST_REGDMN_MODE_11BEG_EHT40MINUS: 11be 2.4GHz, EHT40- channels
1870  * @HOST_REGDMN_MODE_11BEA_EHT40PLUS: 11be 5GHz, EHT40+ channels
1871  * @HOST_REGDMN_MODE_11BEA_EHT40MINUS: 11be 5GHz, EHT40- channels
1872  * @HOST_REGDMN_MODE_11BEA_EHT80: 11be 5GHz, EHT80 channels
1873  * @HOST_REGDMN_MODE_11BEA_EHT160: 11be 5GHz, EHT160 channels
1874  * @HOST_REGDMN_MODE_11BEA_EHT320: 11be 5GHz, EHT320 channels
1875  */
1876 enum {
1877 	HOST_REGDMN_MODE_11A = 0x00000001,
1878 	HOST_REGDMN_MODE_TURBO = 0x00000002,
1879 	HOST_REGDMN_MODE_11B = 0x00000004,
1880 	HOST_REGDMN_MODE_PUREG = 0x00000008,
1881 	HOST_REGDMN_MODE_11G = 0x00000008,
1882 	HOST_REGDMN_MODE_108G = 0x00000020,
1883 	HOST_REGDMN_MODE_108A = 0x00000040,
1884 	HOST_REGDMN_MODE_11AC_VHT20_2G = 0x00000080,
1885 	HOST_REGDMN_MODE_XR = 0x00000100,
1886 	HOST_REGDMN_MODE_11A_HALF_RATE = 0x00000200,
1887 	HOST_REGDMN_MODE_11A_QUARTER_RATE = 0x00000400,
1888 	HOST_REGDMN_MODE_11NG_HT20 = 0x00000800,
1889 	HOST_REGDMN_MODE_11NA_HT20 = 0x00001000,
1890 	HOST_REGDMN_MODE_11NG_HT40PLUS = 0x00002000,
1891 	HOST_REGDMN_MODE_11NG_HT40MINUS = 0x00004000,
1892 	HOST_REGDMN_MODE_11NA_HT40PLUS = 0x00008000,
1893 	HOST_REGDMN_MODE_11NA_HT40MINUS = 0x00010000,
1894 	HOST_REGDMN_MODE_11AC_VHT20 = 0x00020000,
1895 	HOST_REGDMN_MODE_11AC_VHT40PLUS = 0x00040000,
1896 	HOST_REGDMN_MODE_11AC_VHT40MINUS = 0x00080000,
1897 	HOST_REGDMN_MODE_11AC_VHT80 = 0x00100000,
1898 	HOST_REGDMN_MODE_11AC_VHT160 = 0x00200000,
1899 	HOST_REGDMN_MODE_11AC_VHT80_80 = 0x00400000,
1900 	HOST_REGDMN_MODE_11AXG_HE20 = 0x00800000,
1901 	HOST_REGDMN_MODE_11AXA_HE20 = 0x01000000,
1902 	HOST_REGDMN_MODE_11AXG_HE40PLUS = 0x02000000,
1903 	HOST_REGDMN_MODE_11AXG_HE40MINUS = 0x04000000,
1904 	HOST_REGDMN_MODE_11AXA_HE40PLUS = 0x08000000,
1905 	HOST_REGDMN_MODE_11AXA_HE40MINUS = 0x10000000,
1906 	HOST_REGDMN_MODE_11AXA_HE80 = 0x20000000,
1907 	HOST_REGDMN_MODE_11AXA_HE160 = 0x40000000,
1908 	HOST_REGDMN_MODE_11AXA_HE80_80 = 0x80000000,
1909 #ifdef WLAN_FEATURE_11BE
1910 	HOST_REGDMN_MODE_11BEG_EHT20 = 0x0000000100000000,
1911 	HOST_REGDMN_MODE_11BEA_EHT20 = 0x0000000200000000,
1912 	HOST_REGDMN_MODE_11BEG_EHT40PLUS = 0x0000000400000000,
1913 	HOST_REGDMN_MODE_11BEG_EHT40MINUS = 0x0000000800000000,
1914 	HOST_REGDMN_MODE_11BEA_EHT40PLUS = 0x0000001000000000,
1915 	HOST_REGDMN_MODE_11BEA_EHT40MINUS = 0x0000002000000000,
1916 	HOST_REGDMN_MODE_11BEA_EHT80 = 0x0000004000000000,
1917 	HOST_REGDMN_MODE_11BEA_EHT160 = 0x0000008000000000,
1918 	HOST_REGDMN_MODE_11BEA_EHT320 = 0x0000010000000000,
1919 #endif
1920 	HOST_REGDMN_MODE_ALL = 0xffffffffffffffff
1921 };
1922 
1923 #define WIRELESS_11AX_MODES  (HOST_REGDMN_MODE_11AXG_HE20 \
1924 			      | HOST_REGDMN_MODE_11AXG_HE40PLUS \
1925 			      | HOST_REGDMN_MODE_11AXG_HE40MINUS \
1926 			      | HOST_REGDMN_MODE_11AXA_HE20 \
1927 			      | HOST_REGDMN_MODE_11AXA_HE40PLUS \
1928 			      | HOST_REGDMN_MODE_11AXA_HE40MINUS \
1929 			      | HOST_REGDMN_MODE_11AXA_HE80 \
1930 			      | HOST_REGDMN_MODE_11AXA_HE160 \
1931 			      | HOST_REGDMN_MODE_11AXA_HE80_80)
1932 
1933 #ifdef WLAN_FEATURE_11BE
1934 #define WIRELESS_11BE_MODES  (HOST_REGDMN_MODE_11BEG_EHT20 \
1935 			      | HOST_REGDMN_MODE_11BEA_EHT20 \
1936 			      | HOST_REGDMN_MODE_11BEG_EHT40PLUS \
1937 			      | HOST_REGDMN_MODE_11BEG_EHT40MINUS \
1938 			      | HOST_REGDMN_MODE_11BEA_EHT40PLUS \
1939 			      | HOST_REGDMN_MODE_11BEA_EHT40MINUS \
1940 			      | HOST_REGDMN_MODE_11BEA_EHT80 \
1941 			      | HOST_REGDMN_MODE_11BEA_EHT160 \
1942 			      | HOST_REGDMN_MODE_11BEA_EHT320)
1943 #endif
1944 
1945 #define WIRELESS_11AC_MODES  (HOST_REGDMN_MODE_11AC_VHT20 \
1946 			      | HOST_REGDMN_MODE_11AC_VHT40PLUS \
1947 			      | HOST_REGDMN_MODE_11AC_VHT40MINUS \
1948 			      | HOST_REGDMN_MODE_11AC_VHT80 \
1949 			      | HOST_REGDMN_MODE_11AC_VHT160 \
1950 			      | HOST_REGDMN_MODE_11AC_VHT80_80)
1951 
1952 #define WIRELESS_11N_MODES   (HOST_REGDMN_MODE_11NG_HT20 \
1953 			      | HOST_REGDMN_MODE_11NA_HT20 \
1954 			      | HOST_REGDMN_MODE_11NG_HT40PLUS \
1955 			      | HOST_REGDMN_MODE_11NG_HT40MINUS \
1956 			      | HOST_REGDMN_MODE_11NA_HT40PLUS \
1957 			      | HOST_REGDMN_MODE_11NA_HT40MINUS)
1958 
1959 #define WIRELESS_11G_MODES   (HOST_REGDMN_MODE_PUREG \
1960 			      | HOST_REGDMN_MODE_11G \
1961 			      | HOST_REGDMN_MODE_108G)
1962 
1963 #define WIRELESS_11B_MODES   (HOST_REGDMN_MODE_11B)
1964 
1965 #define WIRELESS_11A_MODES   (HOST_REGDMN_MODE_11A \
1966 			      | HOST_REGDMN_MODE_TURBO \
1967 			      | HOST_REGDMN_MODE_108A \
1968 			      | HOST_REGDMN_MODE_11A_HALF_RATE \
1969 			      | HOST_REGDMN_MODE_11A_QUARTER_RATE)
1970 
1971 #ifdef WLAN_FEATURE_11BE
1972 #define WIRELESS_20_MODES    (HOST_REGDMN_MODE_11A \
1973 			      | HOST_REGDMN_MODE_TURBO \
1974 			      | HOST_REGDMN_MODE_11B \
1975 			      | HOST_REGDMN_MODE_PUREG \
1976 			      | HOST_REGDMN_MODE_11G \
1977 			      | HOST_REGDMN_MODE_11AC_VHT20_2G \
1978 			      | HOST_REGDMN_MODE_11NG_HT20 \
1979 			      | HOST_REGDMN_MODE_11NA_HT20 \
1980 			      | HOST_REGDMN_MODE_11AC_VHT20 \
1981 			      | HOST_REGDMN_MODE_11AXG_HE20 \
1982 			      | HOST_REGDMN_MODE_11AXA_HE20 \
1983 			      | HOST_REGDMN_MODE_11BEA_EHT20 \
1984 			      | HOST_REGDMN_MODE_11BEG_EHT20)
1985 #else
1986 #define WIRELESS_20_MODES    (HOST_REGDMN_MODE_11A \
1987 			      | HOST_REGDMN_MODE_TURBO \
1988 			      | HOST_REGDMN_MODE_11B \
1989 			      | HOST_REGDMN_MODE_PUREG \
1990 			      | HOST_REGDMN_MODE_11G \
1991 			      | HOST_REGDMN_MODE_11AC_VHT20_2G \
1992 			      | HOST_REGDMN_MODE_11NG_HT20 \
1993 			      | HOST_REGDMN_MODE_11NA_HT20 \
1994 			      | HOST_REGDMN_MODE_11AC_VHT20 \
1995 			      | HOST_REGDMN_MODE_11AXG_HE20 \
1996 			      | HOST_REGDMN_MODE_11AXA_HE20)
1997 #endif
1998 
1999 #define WIRELESS_10_MODES   (HOST_REGDMN_MODE_11A_HALF_RATE)
2000 #define WIRELESS_5_MODES    (HOST_REGDMN_MODE_11A_QUARTER_RATE)
2001 
2002 #ifdef WLAN_FEATURE_11BE
2003 #define WIRELESS_40_MODES    (HOST_REGDMN_MODE_11NG_HT40PLUS \
2004 			      | HOST_REGDMN_MODE_11NG_HT40MINUS \
2005 			      | HOST_REGDMN_MODE_11NA_HT40PLUS \
2006 			      | HOST_REGDMN_MODE_11NA_HT40MINUS \
2007 			      | HOST_REGDMN_MODE_11AC_VHT40PLUS \
2008 			      | HOST_REGDMN_MODE_11AC_VHT40MINUS \
2009 			      | HOST_REGDMN_MODE_11AXG_HE40PLUS \
2010 			      | HOST_REGDMN_MODE_11AXG_HE40MINUS \
2011 			      | HOST_REGDMN_MODE_11AXA_HE40PLUS \
2012 			      | HOST_REGDMN_MODE_11AXA_HE40MINUS \
2013 			      | HOST_REGDMN_MODE_11BEA_EHT40PLUS \
2014 			      | HOST_REGDMN_MODE_11BEA_EHT40MINUS \
2015 			      | HOST_REGDMN_MODE_11BEG_EHT40PLUS \
2016 			      | HOST_REGDMN_MODE_11BEG_EHT40MINUS)
2017 #else
2018 #define WIRELESS_40_MODES    (HOST_REGDMN_MODE_11NG_HT40PLUS \
2019 			      | HOST_REGDMN_MODE_11NG_HT40MINUS \
2020 			      | HOST_REGDMN_MODE_11NA_HT40PLUS \
2021 			      | HOST_REGDMN_MODE_11NA_HT40MINUS \
2022 			      | HOST_REGDMN_MODE_11AC_VHT40PLUS \
2023 			      | HOST_REGDMN_MODE_11AC_VHT40MINUS \
2024 			      | HOST_REGDMN_MODE_11AXG_HE40PLUS \
2025 			      | HOST_REGDMN_MODE_11AXG_HE40MINUS \
2026 			      | HOST_REGDMN_MODE_11AXA_HE40PLUS \
2027 			      | HOST_REGDMN_MODE_11AXA_HE40MINUS)
2028 #endif
2029 
2030 #ifdef WLAN_FEATURE_11BE
2031 #define WIRELESS_80_MODES    (HOST_REGDMN_MODE_11AC_VHT80 \
2032 			      | HOST_REGDMN_MODE_11AXA_HE80 \
2033 			      | HOST_REGDMN_MODE_11BEA_EHT80)
2034 #else
2035 #define WIRELESS_80_MODES    (HOST_REGDMN_MODE_11AC_VHT80 \
2036 			      | HOST_REGDMN_MODE_11AXA_HE80)
2037 #endif
2038 
2039 #ifdef WLAN_FEATURE_11BE
2040 #define WIRELESS_160_MODES   (HOST_REGDMN_MODE_11AC_VHT160 \
2041 			      | HOST_REGDMN_MODE_11AXA_HE160 \
2042 			      | HOST_REGDMN_MODE_11BEA_EHT160)
2043 #else
2044 #define WIRELESS_160_MODES   (HOST_REGDMN_MODE_11AC_VHT160 \
2045 			      | HOST_REGDMN_MODE_11AXA_HE160)
2046 #endif
2047 
2048 #define WIRELESS_80P80_MODES (HOST_REGDMN_MODE_11AC_VHT80_80 \
2049 			      | HOST_REGDMN_MODE_11AXA_HE80_80)
2050 
2051 #ifdef WLAN_FEATURE_11BE
2052 #define WIRELESS_320_MODES (HOST_REGDMN_MODE_11BEA_EHT320)
2053 #endif
2054 
2055 #ifdef WLAN_FEATURE_11BE
2056 #define WIRELESS_6G_MODES_11BE (HOST_REGDMN_MODE_11BEA_EHT20 \
2057 				| HOST_REGDMN_MODE_11BEA_EHT40PLUS \
2058 				| HOST_REGDMN_MODE_11BEA_EHT40MINUS \
2059 				| HOST_REGDMN_MODE_11BEA_EHT80 \
2060 				| HOST_REGDMN_MODE_11BEA_EHT160 \
2061 				| HOST_REGDMN_MODE_11BEA_EHT320)
2062 #else
2063 #define WIRELESS_6G_MODES_11BE 0
2064 #endif /* WLAN_FEATURE_11BE*/
2065 
2066 #ifdef WLAN_FEATURE_11BE
2067 #define WIRELESS_6G_MODES (HOST_REGDMN_MODE_11AXA_HE20 \
2068 			   | HOST_REGDMN_MODE_11AXA_HE40PLUS \
2069 			   | HOST_REGDMN_MODE_11AXA_HE40MINUS \
2070 			   | HOST_REGDMN_MODE_11AXA_HE80 \
2071 			   | HOST_REGDMN_MODE_11AXA_HE160 \
2072 			   | HOST_REGDMN_MODE_11AXA_HE80_80 \
2073 			   | HOST_REGDMN_MODE_11BEA_EHT20 \
2074 			   | HOST_REGDMN_MODE_11BEA_EHT40PLUS \
2075 			   | HOST_REGDMN_MODE_11BEA_EHT40MINUS \
2076 			   | HOST_REGDMN_MODE_11BEA_EHT80 \
2077 			   | HOST_REGDMN_MODE_11BEA_EHT160 \
2078 			   | HOST_REGDMN_MODE_11BEA_EHT320)
2079 #else
2080 #define WIRELESS_6G_MODES (HOST_REGDMN_MODE_11AXA_HE20 \
2081 			   | HOST_REGDMN_MODE_11AXA_HE40PLUS \
2082 			   | HOST_REGDMN_MODE_11AXA_HE40MINUS \
2083 			   | HOST_REGDMN_MODE_11AXA_HE80 \
2084 			   | HOST_REGDMN_MODE_11AXA_HE160 \
2085 			   | HOST_REGDMN_MODE_11AXA_HE80_80)
2086 #endif
2087 
2088 #ifdef WLAN_FEATURE_11BE
2089 #define WIRELESS_5G_MODES_11BE (HOST_REGDMN_MODE_11BEA_EHT20 \
2090 				| HOST_REGDMN_MODE_11BEA_EHT40PLUS \
2091 				| HOST_REGDMN_MODE_11BEA_EHT40MINUS \
2092 				| HOST_REGDMN_MODE_11BEA_EHT80 \
2093 				| HOST_REGDMN_MODE_11BEA_EHT160 \
2094 				| HOST_REGDMN_MODE_11BEA_EHT320)
2095 #else
2096 #define WIRELESS_5G_MODES_11BE 0
2097 #endif /* WLAN_FEATURE_11BE*/
2098 
2099 #ifdef WLAN_FEATURE_11BE
2100 #define WIRELESS_5G_MODES (HOST_REGDMN_MODE_11BEA_EHT20 \
2101 			   | HOST_REGDMN_MODE_11BEA_EHT40PLUS \
2102 			   | HOST_REGDMN_MODE_11BEA_EHT40MINUS \
2103 			   | HOST_REGDMN_MODE_11BEA_EHT80 \
2104 			   | HOST_REGDMN_MODE_11BEA_EHT160 \
2105 			   | HOST_REGDMN_MODE_11BEA_EHT320 \
2106 			   | HOST_REGDMN_MODE_11AXA_HE20 \
2107 			   | HOST_REGDMN_MODE_11AXA_HE40PLUS \
2108 			   | HOST_REGDMN_MODE_11AXA_HE40MINUS \
2109 			   | HOST_REGDMN_MODE_11AXA_HE80 \
2110 			   | HOST_REGDMN_MODE_11AXA_HE160 \
2111 			   | HOST_REGDMN_MODE_11AXA_HE80_80 \
2112 			   | HOST_REGDMN_MODE_11AC_VHT20 \
2113 			   | HOST_REGDMN_MODE_11AC_VHT40PLUS \
2114 			   | HOST_REGDMN_MODE_11AC_VHT40MINUS \
2115 			   | HOST_REGDMN_MODE_11AC_VHT80 \
2116 			   | HOST_REGDMN_MODE_11AC_VHT160 \
2117 			   | HOST_REGDMN_MODE_11AC_VHT80_80 \
2118 			   | HOST_REGDMN_MODE_11NA_HT20 \
2119 			   | HOST_REGDMN_MODE_11NA_HT40PLUS \
2120 			   | HOST_REGDMN_MODE_11NA_HT40MINUS \
2121 			   | HOST_REGDMN_MODE_11A \
2122 			   | HOST_REGDMN_MODE_TURBO \
2123 			   | HOST_REGDMN_MODE_108A \
2124 			   | HOST_REGDMN_MODE_11A_HALF_RATE \
2125 			   | HOST_REGDMN_MODE_11A_QUARTER_RATE)
2126 #else
2127 #define WIRELESS_5G_MODES (HOST_REGDMN_MODE_11AXA_HE20 \
2128 			   | HOST_REGDMN_MODE_11AXA_HE40PLUS \
2129 			   | HOST_REGDMN_MODE_11AXA_HE40MINUS \
2130 			   | HOST_REGDMN_MODE_11AXA_HE80 \
2131 			   | HOST_REGDMN_MODE_11AXA_HE160 \
2132 			   | HOST_REGDMN_MODE_11AXA_HE80_80 \
2133 			   | HOST_REGDMN_MODE_11AC_VHT20 \
2134 			   | HOST_REGDMN_MODE_11AC_VHT40PLUS \
2135 			   | HOST_REGDMN_MODE_11AC_VHT40MINUS \
2136 			   | HOST_REGDMN_MODE_11AC_VHT80 \
2137 			   | HOST_REGDMN_MODE_11AC_VHT160 \
2138 			   | HOST_REGDMN_MODE_11AC_VHT80_80 \
2139 			   | HOST_REGDMN_MODE_11NA_HT20 \
2140 			   | HOST_REGDMN_MODE_11NA_HT40PLUS \
2141 			   | HOST_REGDMN_MODE_11NA_HT40MINUS \
2142 			   | HOST_REGDMN_MODE_11A \
2143 			   | HOST_REGDMN_MODE_TURBO \
2144 			   | HOST_REGDMN_MODE_108A \
2145 			   | HOST_REGDMN_MODE_11A_HALF_RATE \
2146 			   | HOST_REGDMN_MODE_11A_QUARTER_RATE)
2147 #endif
2148 
2149 #define WIRELESS_49G_MODES (HOST_REGDMN_MODE_11A \
2150 			    | HOST_REGDMN_MODE_11A_HALF_RATE \
2151 			    | HOST_REGDMN_MODE_11A_QUARTER_RATE)
2152 #ifdef WLAN_FEATURE_11BE
2153 #define WIRELESS_2G_MODES_11BE (HOST_REGDMN_MODE_11BEG_EHT20 \
2154 				| HOST_REGDMN_MODE_11BEG_EHT40PLUS \
2155 				| HOST_REGDMN_MODE_11BEG_EHT40MINUS)
2156 #else
2157 #define WIRELESS_2G_MODES_11BE 0
2158 #endif /* WLAN_FEATURE_11BE*/
2159 
2160 #ifdef WLAN_FEATURE_11BE
2161 #define WIRELESS_2G_MODES (HOST_REGDMN_MODE_11BEG_EHT20 \
2162 			   | HOST_REGDMN_MODE_11BEG_EHT40PLUS \
2163 			   | HOST_REGDMN_MODE_11BEG_EHT40MINUS \
2164 			   | HOST_REGDMN_MODE_11AXG_HE20 \
2165 			   | HOST_REGDMN_MODE_11AXG_HE40PLUS \
2166 			   | HOST_REGDMN_MODE_11AXG_HE40MINUS \
2167 			   | HOST_REGDMN_MODE_11NG_HT20 \
2168 			   | HOST_REGDMN_MODE_11NG_HT40PLUS \
2169 			   | HOST_REGDMN_MODE_11NG_HT40MINUS \
2170 			   | HOST_REGDMN_MODE_PUREG \
2171 			   | HOST_REGDMN_MODE_11G \
2172 			   | HOST_REGDMN_MODE_108G \
2173 			   | HOST_REGDMN_MODE_11B)
2174 #else
2175 #define WIRELESS_2G_MODES (HOST_REGDMN_MODE_11AXG_HE20 \
2176 			   | HOST_REGDMN_MODE_11AXG_HE40PLUS \
2177 			   | HOST_REGDMN_MODE_11AXG_HE40MINUS \
2178 			   | HOST_REGDMN_MODE_11NG_HT20 \
2179 			   | HOST_REGDMN_MODE_11NG_HT40PLUS \
2180 			   | HOST_REGDMN_MODE_11NG_HT40MINUS \
2181 			   | HOST_REGDMN_MODE_PUREG \
2182 			   | HOST_REGDMN_MODE_11G \
2183 			   | HOST_REGDMN_MODE_108G \
2184 			   | HOST_REGDMN_MODE_11B)
2185 #endif
2186 
2187 #ifdef CONFIG_AFC_SUPPORT
2188 /* enum reg_afc_cmd_type - Type of AFC command sent to FW
2189  * @REG_AFC_CMD_SERV_RESP_READY : Server response is ready
2190  * @REG_AFC_CMD_RESET_AFC: Indicate the target to reset AFC
2191  */
2192 enum reg_afc_cmd_type {
2193 	REG_AFC_CMD_SERV_RESP_READY = 1,
2194 	REG_AFC_CMD_RESET_AFC = 2,
2195 };
2196 
2197 /* enum reg_afc_serv_resp_format - Indicate the format in which afc_serv_format
2198  * is written in FW memory
2199  * @REG_AFC_SERV_RESP_FORMAT_JSON - Server response in JSON format
2200  * @REG_AFC_SERV_RESP_FORMAT_BINARY - Server response in BINARY format
2201  */
2202 enum reg_afc_serv_resp_format {
2203 	REG_AFC_SERV_RESP_FORMAT_JSON = 0,
2204 	REG_AFC_SERV_RESP_FORMAT_BINARY = 1,
2205 };
2206 
2207 /**
2208  * struct reg_afc_resp_rx_ind_info - regulatory AFC indication info
2209  * @cmd_type: Type of AFC command send to FW
2210  * @serv_resp_format: AFC server response format
2211  */
2212 struct reg_afc_resp_rx_ind_info {
2213 	enum reg_afc_cmd_type cmd_type;
2214 	enum reg_afc_serv_resp_format serv_resp_format;
2215 };
2216 
2217 /**
2218  * afc_req_rx_evt_handler() - Function prototype of AFC request received event
2219  * handler
2220  * @pdev: Pointer to pdev
2221  * @afc_par_req: Pointer to AFC partial request
2222  * @arg: Pointer to void (opaque) argument object
2223  *
2224  * Return: void
2225  */
2226 typedef void (*afc_req_rx_evt_handler)(struct wlan_objmgr_pdev *pdev,
2227 				       struct wlan_afc_host_partial_request *afc_par_req,
2228 				       void *arg);
2229 
2230 /**
2231  * afc_power_tx_evt_handler() - Function prototype of AFC power event sent
2232  * handler
2233  * @pdev: Pointer to pdev
2234  * @power_info: Pointer to AFC power event data
2235  * @arg: Pointer to void (opaque) argument object
2236  *
2237  * Return: void
2238  */
2239 typedef void
2240 (*afc_power_tx_evt_handler)(struct wlan_objmgr_pdev *pdev,
2241 			    struct reg_fw_afc_power_event *power_info,
2242 			    void *arg);
2243 #endif
2244 #endif
2245