1 /*
2 * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
3 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4 *
5 *
6 * Permission to use, copy, modify, and/or distribute this software for
7 * any purpose with or without fee is hereby granted, provided that the
8 * above copyright notice and this permission notice appear in all
9 * copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
12 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
13 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
14 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
15 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
16 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
17 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18 * PERFORMANCE OF THIS SOFTWARE.
19 */
20
21 /**
22 * DOC: wlan_reg_ucfg_api.h
23 * This file provides prototypes of the regulatory component user
24 * config interface routines
25 */
26
27 #ifndef __WLAN_REG_UCFG_API_H
28 #define __WLAN_REG_UCFG_API_H
29
30 #ifdef CONFIG_AFC_SUPPORT
31 #include <wlan_reg_afc.h>
32 #endif
33 #include <reg_services_public_struct.h>
34
35 typedef QDF_STATUS (*reg_event_cb)(void *status_struct);
36
37 /**
38 * ucfg_reg_set_band() - Sets the band information for the PDEV
39 * @pdev: The physical pdev to set the band for
40 * @band_bitmap: The band bitmap parameter (over reg_wifi_band) to configure
41 * for the physical device
42 *
43 * Return: QDF_STATUS
44 */
45 QDF_STATUS ucfg_reg_set_band(struct wlan_objmgr_pdev *pdev,
46 uint32_t band_bitmap);
47
48 /**
49 * ucfg_reg_get_band() - Gets the band information for the PDEV
50 * @pdev: The physical pdev to get the band for
51 * @band_bitmap: The band parameter of the physical device
52 *
53 * Return: QDF_STATUS
54 */
55 QDF_STATUS ucfg_reg_get_band(struct wlan_objmgr_pdev *pdev,
56 uint32_t *band_bitmap);
57
58 /**
59 * ucfg_reg_notify_sap_event() - Notify regulatory domain for sap event
60 * @pdev: The physical dev to notify
61 * @sap_state: true for sap start else false
62 *
63 * Return: QDF_STATUS
64 */
65 QDF_STATUS ucfg_reg_notify_sap_event(struct wlan_objmgr_pdev *pdev,
66 bool sap_state);
67
68 /**
69 * ucfg_reg_cache_channel_freq_state() - Cache the current state of the
70 * channels based on the channel center frequency.
71 * @pdev: Pointer to pdev.
72 * @channel_list: List of the channels for which states need to be cached.
73 * @num_channels: Number of channels in the list.
74 *
75 * Return: QDF_STATUS
76 */
77 #if defined(DISABLE_CHANNEL_LIST) && defined(CONFIG_CHAN_FREQ_API)
78 void ucfg_reg_cache_channel_freq_state(struct wlan_objmgr_pdev *pdev,
79 uint32_t *channel_list,
80 uint32_t num_channels);
81 #else
82 static inline
ucfg_reg_cache_channel_freq_state(struct wlan_objmgr_pdev * pdev,uint32_t * channel_list,uint32_t num_channels)83 void ucfg_reg_cache_channel_freq_state(struct wlan_objmgr_pdev *pdev,
84 uint32_t *channel_list,
85 uint32_t num_channels)
86 {
87 }
88 #endif /* CONFIG_CHAN_FREQ_API */
89
90 #ifdef DISABLE_CHANNEL_LIST
91 /**
92 * ucfg_reg_disable_cached_channels() - Disable cached channels
93 * @pdev: The physical dev to cache the channels for
94 *
95 * Return: Void
96 */
97 void ucfg_reg_disable_cached_channels(struct wlan_objmgr_pdev *pdev);
98
99 /**
100 * ucfg_reg_restore_cached_channels() - Restore disabled cached channels
101 * @pdev: The physical dev to cache the channels for
102 *
103 * Return: Void
104 */
105 void ucfg_reg_restore_cached_channels(struct wlan_objmgr_pdev *pdev);
106 #else
107 static inline
ucfg_reg_disable_cached_channels(struct wlan_objmgr_pdev * pdev)108 void ucfg_reg_disable_cached_channels(struct wlan_objmgr_pdev *pdev)
109 {
110 }
111
112 static inline
ucfg_reg_restore_cached_channels(struct wlan_objmgr_pdev * pdev)113 void ucfg_reg_restore_cached_channels(struct wlan_objmgr_pdev *pdev)
114 {
115 }
116 #endif
117
118 /**
119 * ucfg_reg_get_keep_6ghz_sta_cli_connection() - Get keep 6ghz sta cli
120 * connection flag
121 * @pdev: The physical pdev to get keep_6ghz_sta_cli_connection
122 *
123 * Return: Return true if keep 6ghz sta cli connection set else return flase
124 */
125 bool ucfg_reg_get_keep_6ghz_sta_cli_connection(
126 struct wlan_objmgr_pdev *pdev);
127
128 /**
129 * ucfg_reg_set_keep_6ghz_sta_cli_connection() - Set keep 6ghz sta cli
130 * connection flag
131 * @pdev: The physical pdev to get keep_6ghz_sta_cli_connection
132 * @keep_6ghz_sta_cli_connection: Parameter to set
133 *
134 * Return: QDF_STATUS
135 */
136
137 QDF_STATUS ucfg_reg_set_keep_6ghz_sta_cli_connection(
138 struct wlan_objmgr_pdev *pdev,
139 bool keep_6ghz_sta_cli_connection);
140 /**
141 * ucfg_reg_set_fcc_constraint() - apply fcc constraints on channels 12/13
142 * @pdev: The physical pdev to reduce tx power for
143 * @fcc_constraint: true to apply the constraint, false to remove it
144 *
145 * This function adjusts the transmit power on channels 12 and 13, to comply
146 * with FCC regulations in the USA.
147 *
148 * Return: QDF_STATUS
149 */
150 QDF_STATUS ucfg_reg_set_fcc_constraint(struct wlan_objmgr_pdev *pdev,
151 bool fcc_constraint);
152
153 /**
154 * ucfg_reg_get_default_country() - Get the default regulatory country
155 * @psoc: The physical SoC to get default country from
156 * @country_code: the buffer to populate the country code into
157 *
158 * Return: QDF_STATUS
159 */
160 QDF_STATUS ucfg_reg_get_default_country(struct wlan_objmgr_psoc *psoc,
161 uint8_t *country_code);
162
163 /**
164 * ucfg_reg_get_current_country() - Get the current regulatory country
165 * @psoc: The physical SoC to get current country from
166 * @country_code: the buffer to populate the country code into
167 *
168 * Return: QDF_STATUS
169 */
170 QDF_STATUS ucfg_reg_get_current_country(struct wlan_objmgr_psoc *psoc,
171 uint8_t *country_code);
172
173 /**
174 * ucfg_reg_set_default_country() - Set the default regulatory country
175 * @psoc: The physical SoC to set default country for
176 * @country: The country information to configure
177 *
178 * Return: QDF_STATUS
179 */
180 QDF_STATUS ucfg_reg_set_default_country(struct wlan_objmgr_psoc *psoc,
181 uint8_t *country);
182
183 /**
184 * ucfg_reg_set_country() - Set the current regulatory country
185 * @pdev: The physical dev to set current country for
186 * @country: The country information to configure
187 *
188 * Return: QDF_STATUS
189 */
190 QDF_STATUS ucfg_reg_set_country(struct wlan_objmgr_pdev *pdev,
191 uint8_t *country);
192
193 /**
194 * ucfg_reg_reset_country() - Reset the regulatory country to default
195 * @psoc: The physical SoC to reset country for
196 *
197 * Return: QDF_STATUS
198 */
199 QDF_STATUS ucfg_reg_reset_country(struct wlan_objmgr_psoc *psoc);
200
201 /**
202 * ucfg_reg_enable_dfs_channels() - Enable the use of DFS channels
203 * @pdev: The physical dev to enable DFS channels for
204 * @dfs_enable: true to enable DFS channels, false to disable them
205 *
206 * Return: QDF_STATUS
207 */
208 QDF_STATUS ucfg_reg_enable_dfs_channels(struct wlan_objmgr_pdev *pdev,
209 bool dfs_enable);
210
211 QDF_STATUS ucfg_reg_register_event_handler(uint8_t vdev_id, reg_event_cb cb,
212 void *arg);
213 QDF_STATUS ucfg_reg_unregister_event_handler(uint8_t vdev_id, reg_event_cb cb,
214 void *arg);
215 QDF_STATUS ucfg_reg_init_handler(uint8_t pdev_id);
216
217 #ifdef WLAN_REG_PARTIAL_OFFLOAD
218 /**
219 * ucfg_reg_program_default_cc() - Program default country code
220 * @pdev: Pdev pointer
221 * @regdmn: Regdomain value
222 *
223 * Return: QDF_STATUS
224 */
225 QDF_STATUS ucfg_reg_program_default_cc(struct wlan_objmgr_pdev *pdev,
226 uint16_t regdmn);
227 #endif
228
229 /**
230 * ucfg_reg_program_cc() - Program user country code or regdomain
231 * @pdev: The physical dev to program country code or regdomain
232 * @rd: User country code or regdomain
233 *
234 * Return: QDF_STATUS
235 */
236 QDF_STATUS ucfg_reg_program_cc(struct wlan_objmgr_pdev *pdev,
237 struct cc_regdmn_s *rd);
238
239 /**
240 * ucfg_reg_get_current_cc() - get current country code or regdomain
241 * @pdev: The physical dev to program country code or regdomain
242 * @rd: Pointer to country code or regdomain
243 *
244 * Return: QDF_STATUS
245 */
246 QDF_STATUS ucfg_reg_get_current_cc(struct wlan_objmgr_pdev *pdev,
247 struct cc_regdmn_s *rd);
248
249 /**
250 * ucfg_reg_set_config_vars () - Set the config vars in reg component
251 * @psoc: psoc ptr
252 * @config_vars: config variables structure
253 *
254 * Return: QDF_STATUS
255 */
256 QDF_STATUS ucfg_reg_set_config_vars(struct wlan_objmgr_psoc *psoc,
257 struct reg_config_vars config_vars);
258
259 /**
260 * ucfg_reg_get_current_chan_list () - get current channel list
261 * @pdev: pdev ptr
262 * @chan_list: channel list
263 *
264 * Return: QDF_STATUS
265 */
266 QDF_STATUS ucfg_reg_get_current_chan_list(struct wlan_objmgr_pdev *pdev,
267 struct regulatory_channel *chan_list);
268
269 /**
270 * ucfg_reg_modify_chan_144() - Enable/Disable channel 144
271 * @pdev: pdev pointer
272 * @enable_ch_144: flag to disable/enable channel 144
273 *
274 * Return: Success or Failure
275 */
276 QDF_STATUS ucfg_reg_modify_chan_144(struct wlan_objmgr_pdev *pdev,
277 bool enable_ch_144);
278
279 /**
280 * ucfg_reg_get_en_chan_144() - get en_chan_144 flag value
281 * @pdev: pdev pointer
282 *
283 * Return: en_chan_144 flag value
284 */
285 bool ucfg_reg_get_en_chan_144(struct wlan_objmgr_pdev *pdev);
286
287 /**
288 * ucfg_reg_is_regdb_offloaded () - is regulatory database offloaded
289 * @psoc: psoc ptr
290 *
291 * Return: bool
292 */
293 bool ucfg_reg_is_regdb_offloaded(struct wlan_objmgr_psoc *psoc);
294
295 /**
296 * ucfg_reg_program_mas_chan_list () - program master channel list
297 * @psoc: psoc ptr
298 * @reg_channels: regulatory channels
299 * @alpha2: country code
300 * @dfs_region: dfs region
301 *
302 * Return: void
303 */
304 void ucfg_reg_program_mas_chan_list(struct wlan_objmgr_psoc *psoc,
305 struct regulatory_channel *reg_channels,
306 uint8_t *alpha2,
307 enum dfs_reg dfs_region);
308
309 /**
310 * ucfg_reg_get_regd_rules() - provides the reg domain rules info pointer
311 * @pdev: pdev ptr
312 * @reg_rules: regulatory rules
313 *
314 * Return: QDF_STATUS
315 */
316 QDF_STATUS ucfg_reg_get_regd_rules(struct wlan_objmgr_pdev *pdev,
317 struct reg_rule_info *reg_rules);
318
319 /**
320 * ucfg_reg_register_chan_change_callback () - add chan change cbk
321 * @psoc: psoc ptr
322 * @cbk: callback
323 * @arg: argument
324 *
325 * Return: void
326 */
327 void ucfg_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc,
328 void *cbk, void *arg);
329
330 /**
331 * ucfg_reg_unregister_chan_change_callback () - remove chan change cbk
332 * @psoc: psoc ptr
333 * @cbk: callback
334 *
335 * Return: void
336 */
337 void ucfg_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc,
338 void *cbk);
339
340 #ifdef CONFIG_AFC_SUPPORT
341 /**
342 * ucfg_reg_register_afc_req_rx_callback () - add AFC request received callback
343 * @pdev: Pointer to pdev
344 * @cbf: Pointer to callback function
345 * @arg: Pointer to opaque argument
346 *
347 * Return: QDF_STATUS
348 */
349 QDF_STATUS ucfg_reg_register_afc_req_rx_callback(struct wlan_objmgr_pdev *pdev,
350 afc_req_rx_evt_handler cbf,
351 void *arg);
352
353 /**
354 * ucfg_reg_unregister_afc_req_rx_callback () - remove AFC request received
355 * callback
356 * @pdev: Pointer to pdev
357 * @cbf: Pointer to callback function
358 *
359 * Return: QDF_STATUS
360 */
361 QDF_STATUS ucfg_reg_unregister_afc_req_rx_callback(struct wlan_objmgr_pdev *pdev,
362 afc_req_rx_evt_handler cbf);
363
364 /**
365 * ucfg_reg_get_afc_req_info() - Get the the frequency ranges and
366 * opclass + channel ranges. This is partial because in the AFC request there
367 * are a few more parameters: Longitude, Latitude a few other information
368 * @pdev: Pointer to PDEV object.
369 * @afc_req: Address of AFC request pointer.
370 * @req_id: AFC request ID.
371 *
372 * Return: QDF_STATUS_E_INVAL if unable to set and QDF_STATUS_SUCCESS is set.
373 */
374 QDF_STATUS ucfg_reg_get_afc_req_info(struct wlan_objmgr_pdev *pdev,
375 struct wlan_afc_host_request **afc_req,
376 uint64_t req_id);
377
378 /**
379 * ucfg_reg_free_afc_req() - Free the memory allocated for AFC request
380 * structure and its members.
381 * @pdev: Pointer to pdev.
382 * @afc_req: Pointer to AFC request structure.
383 *
384 * Return: void
385 */
386 void
387 ucfg_reg_free_afc_req(struct wlan_objmgr_pdev *pdev,
388 struct wlan_afc_host_request *afc_req);
389
390 /**
391 * ucfg_reg_register_afc_power_event_callback() - add AFC power event received
392 * @pdev: Pointer to pdev
393 * @cbf: Pointer to callback function
394 * @arg: Pointer to opaque argument
395 *
396 * Return: QDF_STATUS
397 */
398 QDF_STATUS
399 ucfg_reg_register_afc_power_event_callback(struct wlan_objmgr_pdev *pdev,
400 afc_power_tx_evt_handler cbf,
401 void *arg);
402
403 /**
404 * ucfg_reg_unregister_afc_power_event_callback() - remove AFC power event
405 * received callback
406 * @pdev: Pointer to pdev
407 * @cbf: Pointer to callback function
408 *
409 * Return: QDF_STATUS
410 */
411 QDF_STATUS
412 ucfg_reg_unregister_afc_power_event_callback(struct wlan_objmgr_pdev *pdev,
413 afc_power_tx_evt_handler cbf);
414
415 /**
416 * ucfg_reg_register_afc_payload_reset_event_callback() - Add AFC payload reset
417 * event received callback
418 * @pdev: Pointer to pdev
419 * @cbf: Pointer to callback function
420 * @arg: Pointer to opaque argument
421 *
422 * Return: QDF_STATUS
423 */
424 QDF_STATUS ucfg_reg_register_afc_payload_reset_event_callback(
425 struct wlan_objmgr_pdev *pdev,
426 afc_payload_reset_tx_evt_handler cbf,
427 void *arg);
428
429 /**
430 * ucfg_reg_unregister_afc_payload_reset_event_callback() - Remove AFC payload
431 * reset event received callback
432 * @pdev: Pointer to pdev
433 * @cbf: Pointer to callback function
434 *
435 * Return: QDF_STATUS
436 */
437 QDF_STATUS ucfg_reg_unregister_afc_payload_reset_event_callback(
438 struct wlan_objmgr_pdev *pdev,
439 afc_payload_reset_tx_evt_handler cbf);
440 #endif
441
442 /**
443 * ucfg_reg_get_cc_and_src () - get country code and src
444 * @psoc: psoc ptr
445 * @alpha2: country code alpha2
446 *
447 * Return: void
448 */
449 enum country_src ucfg_reg_get_cc_and_src(struct wlan_objmgr_psoc *psoc,
450 uint8_t *alpha2);
451
452 /**
453 * ucfg_reg_unit_simulate_ch_avoid () - fake a ch avoid event
454 * @psoc: psoc ptr
455 * @ch_avoid: ch_avoid_ind_type ranges
456 *
457 * This function inject a ch_avoid event for unit test sap chan switch.
458 *
459 * Return: void
460 */
461 void ucfg_reg_unit_simulate_ch_avoid(struct wlan_objmgr_psoc *psoc,
462 struct ch_avoid_ind_type *ch_avoid);
463
464 /**
465 * ucfg_reg_ch_avoid () - Send channel avoid cmd to regulatory
466 * @psoc: psoc ptr
467 * @ch_avoid: ch_avoid_ind_type ranges
468 *
469 * This function send channel avoid cmd to regulatory from os_if/upper layer
470 *
471 * Return: void
472 */
473 void ucfg_reg_ch_avoid(struct wlan_objmgr_psoc *psoc,
474 struct ch_avoid_ind_type *ch_avoid);
475
476 #ifdef FEATURE_WLAN_CH_AVOID_EXT
477 /**
478 * ucfg_reg_ch_avoid_ext () - Send channel avoid extend cmd to regulatory
479 * @psoc: psoc ptr
480 * @ch_avoid: ch_avoid_ind_type ranges
481 *
482 * This function send channel avoid extend cmd to regulatory from
483 * os_if/upper layer
484 *
485 * Return: void
486 */
487 void ucfg_reg_ch_avoid_ext(struct wlan_objmgr_psoc *psoc,
488 struct ch_avoid_ind_type *ch_avoid);
489 #endif
490
491 #if defined(CONFIG_BAND_6GHZ) && defined(CONFIG_AFC_SUPPORT)
492 /**
493 * ucfg_reg_get_enable_6ghz_sp_mode_support() - Get enable 6 GHz SP mode support
494 * @psoc: psoc ptr
495 *
496 * Return: enable 6 GHz SP mode support flag
497 */
498 bool ucfg_reg_get_enable_6ghz_sp_mode_support(struct wlan_objmgr_psoc *psoc);
499
500 /**
501 * ucfg_reg_set_enable_6ghz_sp_mode_support() - Set enable 6 GHz SP mode support
502 * @psoc: psoc ptr
503 * @value: value to be set
504 *
505 * Return: None
506 */
507 void ucfg_reg_set_enable_6ghz_sp_mode_support(struct wlan_objmgr_psoc *psoc,
508 bool value);
509
510 /**
511 * ucfg_reg_get_afc_disable_timer_check() - Get AFC timer check disable flag
512 * @psoc: psoc ptr
513 *
514 * Return: AFC timer check disable flag
515 */
516 bool ucfg_reg_get_afc_disable_timer_check(struct wlan_objmgr_psoc *psoc);
517
518 /**
519 * ucfg_reg_set_afc_disable_timer_check() - Set AFC timer check disable flag
520 * @psoc: psoc ptr
521 * @value: value to be set
522 *
523 * Return: None
524 */
525 void ucfg_reg_set_afc_disable_timer_check(struct wlan_objmgr_psoc *psoc,
526 bool value);
527
528 /**
529 * ucfg_reg_get_afc_disable_request_id_check() - Get AFC request id check flag
530 * @psoc: psoc ptr
531 *
532 * Return: AFC request id check disable flag
533 */
534 bool ucfg_reg_get_afc_disable_request_id_check(struct wlan_objmgr_psoc *psoc);
535
536 /**
537 * ucfg_reg_set_afc_disable_request_id_check() - Set AFC request id check flag
538 * @psoc: psoc ptr
539 * @value: value to be set
540 *
541 * Return: None
542 */
543 void ucfg_reg_set_afc_disable_request_id_check(struct wlan_objmgr_psoc *psoc,
544 bool value);
545
546 /**
547 * ucfg_reg_get_afc_no_action() - Get AFC no action flag
548 * @psoc: psoc ptr
549 *
550 * Return: AFC no action flag
551 */
552 bool ucfg_reg_get_afc_no_action(struct wlan_objmgr_psoc *psoc);
553
554 /**
555 * ucfg_reg_set_afc_no_action() - Set AFC no action flag
556 * @psoc: psoc ptr
557 * @value: value to be set
558 *
559 * Return: None
560 */
561 void ucfg_reg_set_afc_no_action(struct wlan_objmgr_psoc *psoc, bool value);
562 #else
563 static inline
ucfg_reg_get_enable_6ghz_sp_mode_support(struct wlan_objmgr_psoc * psoc)564 bool ucfg_reg_get_enable_6ghz_sp_mode_support(struct wlan_objmgr_psoc *psoc)
565 {
566 return false;
567 }
568
569 static inline
ucfg_reg_set_enable_6ghz_sp_mode_support(struct wlan_objmgr_psoc * psoc,bool value)570 void ucfg_reg_set_enable_6ghz_sp_mode_support(struct wlan_objmgr_psoc *psoc,
571 bool value)
572 {
573 }
574
575 static inline
ucfg_reg_get_afc_disable_timer_check(struct wlan_objmgr_psoc * psoc)576 bool ucfg_reg_get_afc_disable_timer_check(struct wlan_objmgr_psoc *psoc)
577 {
578 return false;
579 }
580
581 static inline
ucfg_reg_set_afc_disable_timer_check(struct wlan_objmgr_psoc * psoc,bool value)582 void ucfg_reg_set_afc_disable_timer_check(struct wlan_objmgr_psoc *psoc,
583 bool value)
584 {
585 }
586
587 static inline
ucfg_reg_get_afc_disable_request_id_check(struct wlan_objmgr_psoc * psoc)588 bool ucfg_reg_get_afc_disable_request_id_check(struct wlan_objmgr_psoc *psoc)
589 {
590 return false;
591 }
592
593 static inline
ucfg_reg_set_afc_disable_request_id_check(struct wlan_objmgr_psoc * psoc,bool value)594 void ucfg_reg_set_afc_disable_request_id_check(struct wlan_objmgr_psoc *psoc,
595 bool value)
596 {
597 }
598
599 static inline
ucfg_reg_get_afc_no_action(struct wlan_objmgr_psoc * psoc)600 bool ucfg_reg_get_afc_no_action(struct wlan_objmgr_psoc *psoc)
601 {
602 return false;
603 }
604
605 static inline
ucfg_reg_set_afc_no_action(struct wlan_objmgr_psoc * psoc,bool value)606 void ucfg_reg_set_afc_no_action(struct wlan_objmgr_psoc *psoc, bool value)
607 {
608 }
609 #endif
610
611 #ifdef TARGET_11D_SCAN
612 /**
613 * ucfg_reg_11d_vdev_delete_update() - update vdev delete to regulatory
614 * @psoc: psoc pointer
615 * @op_mode: Operating mode of the deleted vdev
616 * @vdev_id: Vdev id of the deleted vdev
617 *
618 * Return: QDF_STATUS
619 */
620 QDF_STATUS ucfg_reg_11d_vdev_delete_update(struct wlan_objmgr_psoc *psoc,
621 enum QDF_OPMODE op_mode,
622 uint32_t vdev_id);
623
624 /**
625 * ucfg_reg_11d_vdev_created_update() - update vdev create to regulatory
626 * @vdev: vdev ptr
627 *
628 * Return: QDF_STATUS
629 */
630 QDF_STATUS ucfg_reg_11d_vdev_created_update(struct wlan_objmgr_vdev *vdev);
631 #else
632 static inline
ucfg_reg_11d_vdev_delete_update(struct wlan_objmgr_psoc * psoc,enum QDF_OPMODE op_mode,uint32_t vdev_id)633 QDF_STATUS ucfg_reg_11d_vdev_delete_update(struct wlan_objmgr_psoc *psoc,
634 enum QDF_OPMODE op_mode,
635 uint32_t vdev_id)
636 {
637 return QDF_STATUS_SUCCESS;
638 }
639
640 static inline
ucfg_reg_11d_vdev_created_update(struct wlan_objmgr_vdev * vdev)641 QDF_STATUS ucfg_reg_11d_vdev_created_update(struct wlan_objmgr_vdev *vdev)
642 {
643 return QDF_STATUS_SUCCESS;
644 }
645 #endif
646
647 /**
648 * ucfg_reg_update_hal_cap_wireless_modes() - update wireless modes
649 * @psoc: psoc ptr
650 * @modes: value of modes to update
651 * @phy_id: phy id
652 *
653 * Return: QDF_STATUS
654 */
655 QDF_STATUS ucfg_reg_update_hal_cap_wireless_modes(struct wlan_objmgr_psoc *psoc,
656 uint64_t modes, uint8_t phy_id);
657
658 /**
659 * ucfg_reg_get_hal_reg_cap() - return hal reg cap
660 * @psoc: psoc ptr
661 *
662 * Return: ptr to wlan_psoc_host_hal_reg_capabilities_ext
663 */
664 struct wlan_psoc_host_hal_reg_capabilities_ext *ucfg_reg_get_hal_reg_cap(
665 struct wlan_objmgr_psoc *psoc);
666
667 /**
668 * ucfg_reg_set_hal_reg_cap() - update hal reg cap
669 * @psoc: psoc ptr
670 * @reg_cap: Regulatory cap array
671 * @phy_cnt: Number of phy
672 *
673 * Return: QDF_STATUS
674 */
675 QDF_STATUS ucfg_reg_set_hal_reg_cap(struct wlan_objmgr_psoc *psoc,
676 struct wlan_psoc_host_hal_reg_capabilities_ext *reg_cap,
677 uint16_t phy_cnt);
678
679 /**
680 * ucfg_reg_update_hal_reg_range_caps() - update hal reg frequency range fields
681 * @psoc: psoc ptr
682 * @low_2g_chan: low 2g channel
683 * @high_2g_chan: high 2g channel
684 * @low_5g_chan: low 5g channel
685 * @high_5g_chan: high 2g channel
686 * @phy_id: phy id
687 *
688 * Return: QDF_STATUS
689 */
690 QDF_STATUS ucfg_reg_update_hal_reg_range_caps(struct wlan_objmgr_psoc *psoc,
691 uint32_t low_2g_chan,
692 uint32_t high_2g_chan,
693 uint32_t low_5g_chan,
694 uint32_t high_5g_chan,
695 uint8_t phy_id);
696
697 /**
698 * ucfg_set_ignore_fw_reg_offload_ind() - API to set ignore regdb offload ind
699 * @psoc: psoc ptr
700 *
701 * Return: QDF_STATUS
702 */
703 QDF_STATUS ucfg_set_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc);
704
705 /**
706 * ucfg_reg_get_unii_5g_bitmap() - get unii_5g_bitmap value
707 * @pdev: pdev pointer
708 * @bitmap: Pointer to retrieve unii_5g_bitmap of enum reg_unii_band.
709 *
710 * Return: QDF_STATUS
711 */
712 #ifdef DISABLE_UNII_SHARED_BANDS
713 QDF_STATUS
714 ucfg_reg_get_unii_5g_bitmap(struct wlan_objmgr_pdev *pdev, uint8_t *bitmap);
715 #else
716 static inline QDF_STATUS
ucfg_reg_get_unii_5g_bitmap(struct wlan_objmgr_pdev * pdev,uint8_t * bitmap)717 ucfg_reg_get_unii_5g_bitmap(struct wlan_objmgr_pdev *pdev, uint8_t *bitmap)
718 {
719 *bitmap = 0;
720 return QDF_STATUS_SUCCESS;
721 }
722 #endif
723
724 #if defined(CONFIG_BAND_6GHZ)
725 /**
726 * ucfg_reg_get_cur_6g_ap_pwr_type() - Get the current 6G regulatory AP power
727 * type.
728 * @pdev: Pointer to PDEV object.
729 * @reg_cur_6g_ap_pwr_type: The current regulatory 6G AP type ie VLPI/LPI/SP.
730 *
731 * Return: QDF_STATUS.
732 */
733 QDF_STATUS
734 ucfg_reg_get_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev,
735 enum reg_6g_ap_type *reg_cur_6g_ap_pwr_type);
736
737 /**
738 * ucfg_reg_set_cur_6g_ap_pwr_type() - Set the current 6G regulatory AP power
739 * type.
740 * @pdev: Pointer to PDEV object.
741 * @reg_cur_6g_ap_pwr_type: Regulatory 6G AP type ie VLPI/LPI/SP.
742 *
743 * Return: QDF_STATUS_E_INVAL if unable to set and QDF_STATUS_SUCCESS is set.
744 */
745 QDF_STATUS
746 ucfg_reg_set_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev,
747 enum reg_6g_ap_type reg_cur_6g_ap_pwr_type);
748 #else
749 static inline QDF_STATUS
ucfg_reg_get_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev * pdev,enum reg_6g_ap_type * reg_cur_6g_ap_pwr_type)750 ucfg_reg_get_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev,
751 enum reg_6g_ap_type *reg_cur_6g_ap_pwr_type)
752 {
753 *reg_cur_6g_ap_pwr_type = REG_INDOOR_AP;
754 return QDF_STATUS_E_NOSUPPORT;
755 }
756
757 static inline QDF_STATUS
ucfg_reg_set_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev * pdev,enum reg_6g_ap_type reg_cur_6g_ap_type)758 ucfg_reg_set_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev,
759 enum reg_6g_ap_type reg_cur_6g_ap_type)
760 {
761 return QDF_STATUS_E_NOSUPPORT;
762 }
763 #endif
764
765 #if defined(CONFIG_AFC_SUPPORT) && defined(CONFIG_BAND_6GHZ)
766 /**
767 * ucfg_reg_send_afc_resp_rx_ind() - Send AFC response received indication to
768 * the FW.
769 * @pdev: pdev ptr
770 * @afc_ind_obj: Pointer to hold AFC indication
771 *
772 * Return: QDF_STATUS_SUCCESS if the WMI command is sent or QDF_STATUS_E_FAILURE
773 * otherwise
774 */
775 QDF_STATUS
776 ucfg_reg_send_afc_resp_rx_ind(struct wlan_objmgr_pdev *pdev,
777 struct reg_afc_resp_rx_ind_info *afc_ind_obj);
778
779 /**
780 * ucfg_reg_afc_start() - Start the AFC request from regulatory. This finally
781 * sends the request to registered callbacks
782 * @pdev: Pointer to pdev
783 * @req_id: The AFC request ID
784 *
785 * Return: QDF_STATUS
786 */
787 QDF_STATUS ucfg_reg_afc_start(struct wlan_objmgr_pdev *pdev, uint64_t req_id);
788 #endif
789
790 #ifndef CONFIG_REG_CLIENT
791 /**
792 * ucfg_reg_enable_disable_opclass_chans() - Disable or enable the input 20 MHz
793 * operating channels in the radio's current channel list.
794 * @pdev: Pointer to pdev
795 * @is_disable: Boolean to disable or enable the channels
796 * @opclass: Operating class. Only 20MHz opclasses are supported.
797 * @ieee_chan_list: Pointer to ieee_chan_list
798 * @chan_list_size: Size of ieee_chan_list
799 * @global_tbl_lookup: Whether to lookup global op class table
800 *
801 * Return - Return QDF_STATUS
802 */
803 QDF_STATUS ucfg_reg_enable_disable_opclass_chans(struct wlan_objmgr_pdev *pdev,
804 bool is_disable,
805 uint8_t opclass,
806 uint8_t *ieee_chan_list,
807 uint8_t chan_list_size,
808 bool global_tbl_lookup);
809
810 static inline
ucfg_reg_is_user_country_set_allowed(struct wlan_objmgr_psoc * psoc)811 bool ucfg_reg_is_user_country_set_allowed(struct wlan_objmgr_psoc *psoc)
812 {
813 return true;
814 }
815
816 static inline
ucfg_reg_is_fcc_constraint_set(struct wlan_objmgr_pdev * pdev)817 bool ucfg_reg_is_fcc_constraint_set(struct wlan_objmgr_pdev *pdev)
818 {
819 return false;
820 }
821
822 #else
823 static inline QDF_STATUS
ucfg_reg_enable_disable_opclass_chans(struct wlan_objmgr_pdev * pdev,bool is_disable,uint8_t opclass,uint8_t * ieee_chan_list,uint8_t chan_list_size,bool global_tbl_lookup)824 ucfg_reg_enable_disable_opclass_chans(struct wlan_objmgr_pdev *pdev,
825 bool is_disable,
826 uint8_t opclass,
827 uint8_t *ieee_chan_list,
828 uint8_t chan_list_size,
829 bool global_tbl_lookup)
830 {
831 return QDF_STATUS_E_NOSUPPORT;
832 }
833
834 /**
835 * ucfg_reg_is_user_country_set_allowed() - Checks whether user country is
836 * allowed to set
837 * @psoc: psoc ptr
838 *
839 * Return: bool
840 */
841 bool ucfg_reg_is_user_country_set_allowed(struct wlan_objmgr_psoc *psoc);
842
843 /**
844 * ucfg_reg_is_fcc_constraint_set() - Check if fcc constraint is set
845 * @pdev: pointer to pdev
846 *
847 * Return: Return true if fcc constraint is set
848 */
849 bool ucfg_reg_is_fcc_constraint_set(struct wlan_objmgr_pdev *pdev);
850 #endif
851 #endif
852