xref: /wlan-dirver/qca-wifi-host-cmn/init_deinit/dispatcher/src/dispatcher_init_deinit.c (revision 503663c6daafffe652fa360bde17243568cd6d2a)
1 /*
2  * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 #include "cfg_dispatcher.h"
18 #include <qdf_types.h>
19 #include <qdf_trace.h>
20 #include <qdf_threads.h>
21 #include <qdf_module.h>
22 #include <dispatcher_init_deinit.h>
23 #include <scheduler_api.h>
24 #include <wlan_scan_ucfg_api.h>
25 #include <wlan_ftm_init_deinit_api.h>
26 #include <wlan_mgmt_txrx_utils_api.h>
27 #include <wlan_serialization_api.h>
28 #include <include/wlan_mlme_cmn.h>
29 #ifdef WLAN_ATF_ENABLE
30 #include <wlan_atf_utils_api.h>
31 #endif
32 #ifdef QCA_SUPPORT_SON
33 #include <wlan_son_pub.h>
34 #endif
35 #ifdef WLAN_SA_API_ENABLE
36 #include <wlan_sa_api_utils_api.h>
37 #endif
38 #ifdef WIFI_POS_CONVERGED
39 #include "wifi_pos_api.h"
40 #endif /* WIFI_POS_CONVERGED */
41 #include <wlan_reg_services_api.h>
42 #ifdef WLAN_CONV_CRYPTO_SUPPORTED
43 #include "wlan_crypto_main.h"
44 #endif
45 #ifdef DFS_COMPONENT_ENABLE
46 #include <wlan_dfs_init_deinit_api.h>
47 #endif
48 
49 #ifdef WLAN_OFFCHAN_TXRX_ENABLE
50 #include <wlan_offchan_txrx_api.h>
51 #endif
52 
53 #ifdef WLAN_SUPPORT_SPLITMAC
54 #include <wlan_splitmac.h>
55 #endif
56 #ifdef WLAN_CONV_SPECTRAL_ENABLE
57 #include <wlan_spectral_utils_api.h>
58 #endif
59 #ifdef WLAN_SUPPORT_FILS
60 #include <wlan_fd_utils_api.h>
61 #endif
62 
63 #ifdef WLAN_SUPPORT_GREEN_AP
64 #include <wlan_green_ap_api.h>
65 #endif
66 
67 #ifdef QCA_SUPPORT_CP_STATS
68 #include <wlan_cp_stats_utils_api.h>
69 #endif
70 
71 #ifdef WLAN_CFR_ENABLE
72 #include <wlan_cfr_utils_api.h>
73 #endif
74 
75 #ifdef FEATURE_COEX
76 #include <wlan_coex_utils_api.h>
77 #endif
78 
79 /**
80  * DOC: This file provides various init/deinit trigger point for new
81  * components.
82  */
83 
84 /* All new components needs to replace their dummy init/deinit
85  * psoc_open, psco_close, psoc_enable and psoc_disable APIs once
86  * their actual handlers are ready
87  */
88 
89 spectral_pdev_open_handler dispatcher_spectral_pdev_open_handler_cb;
90 
91 #ifdef WLAN_CFR_ENABLE
92 static QDF_STATUS dispatcher_init_cfr(void)
93 {
94 	return wlan_cfr_init();
95 }
96 
97 static QDF_STATUS dispatcher_deinit_cfr(void)
98 {
99 	return wlan_cfr_deinit();
100 }
101 
102 static QDF_STATUS dispatcher_cfr_pdev_open(struct wlan_objmgr_pdev *pdev)
103 {
104 	return wlan_cfr_pdev_open(pdev);
105 }
106 
107 static QDF_STATUS dispatcher_cfr_pdev_close(struct wlan_objmgr_pdev *pdev)
108 {
109 	return wlan_cfr_pdev_close(pdev);
110 }
111 #else
112 static QDF_STATUS dispatcher_init_cfr(void)
113 {
114 	return QDF_STATUS_SUCCESS;
115 }
116 
117 static QDF_STATUS dispatcher_deinit_cfr(void)
118 {
119 	return QDF_STATUS_SUCCESS;
120 }
121 
122 static QDF_STATUS dispatcher_cfr_pdev_open(struct wlan_objmgr_pdev *pdev)
123 {
124 	return QDF_STATUS_SUCCESS;
125 }
126 
127 static QDF_STATUS dispatcher_cfr_pdev_close(struct wlan_objmgr_pdev *pdev)
128 {
129 	return QDF_STATUS_SUCCESS;
130 }
131 
132 #endif
133 
134 #ifdef QCA_SUPPORT_CP_STATS
135 static QDF_STATUS dispatcher_init_cp_stats(void)
136 {
137 	return wlan_cp_stats_init();
138 }
139 
140 static QDF_STATUS dispatcher_deinit_cp_stats(void)
141 {
142 	return wlan_cp_stats_deinit();
143 }
144 
145 static QDF_STATUS cp_stats_psoc_open(struct wlan_objmgr_psoc *psoc)
146 {
147 	return wlan_cp_stats_open(psoc);
148 }
149 
150 static QDF_STATUS cp_stats_psoc_close(struct wlan_objmgr_psoc *psoc)
151 {
152 	return wlan_cp_stats_close(psoc);
153 }
154 
155 static QDF_STATUS cp_stats_psoc_enable(struct wlan_objmgr_psoc *psoc)
156 {
157 	return wlan_cp_stats_enable(psoc);
158 }
159 
160 static QDF_STATUS cp_stats_psoc_disable(struct wlan_objmgr_psoc *psoc)
161 {
162 	return wlan_cp_stats_disable(psoc);
163 }
164 #else
165 static QDF_STATUS dispatcher_init_cp_stats(void)
166 {
167 	return QDF_STATUS_SUCCESS;
168 }
169 
170 static QDF_STATUS dispatcher_deinit_cp_stats(void)
171 {
172 	return QDF_STATUS_SUCCESS;
173 }
174 
175 static QDF_STATUS cp_stats_psoc_open(struct wlan_objmgr_psoc *psoc)
176 {
177 	return QDF_STATUS_SUCCESS;
178 }
179 
180 static QDF_STATUS cp_stats_psoc_close(struct wlan_objmgr_psoc *psoc)
181 {
182 	return QDF_STATUS_SUCCESS;
183 }
184 
185 static QDF_STATUS cp_stats_psoc_enable(struct wlan_objmgr_psoc *psoc)
186 {
187 	return QDF_STATUS_SUCCESS;
188 }
189 
190 static QDF_STATUS cp_stats_psoc_disable(struct wlan_objmgr_psoc *psoc)
191 {
192 	return QDF_STATUS_SUCCESS;
193 }
194 #endif
195 
196 #if defined QCA_SUPPORT_SON && QCA_SUPPORT_SON >= 1
197 static QDF_STATUS dispatcher_init_son(void)
198 {
199 	return wlan_son_init();
200 }
201 static QDF_STATUS son_psoc_open(struct wlan_objmgr_psoc *psoc)
202 {
203 	return wlan_son_psoc_open(psoc);
204 }
205 static QDF_STATUS dispatcher_deinit_son(void)
206 {
207 	return wlan_son_deinit();
208 }
209 
210 static QDF_STATUS son_psoc_close(struct wlan_objmgr_psoc *psoc)
211 {
212 	return wlan_son_psoc_close(psoc);
213 }
214 #else
215 static QDF_STATUS dispatcher_init_son(void)
216 {
217 	return QDF_STATUS_SUCCESS;
218 }
219 
220 static QDF_STATUS dispatcher_deinit_son(void)
221 {
222 	return QDF_STATUS_SUCCESS;
223 }
224 
225 static QDF_STATUS son_psoc_open(struct wlan_objmgr_psoc *psoc)
226 {
227 	return QDF_STATUS_SUCCESS;
228 }
229 
230 static QDF_STATUS son_psoc_close(struct wlan_objmgr_psoc *psoc)
231 {
232 	return QDF_STATUS_SUCCESS;
233 }
234 
235 #endif /* END of QCA_SUPPORT_SON */
236 
237 static QDF_STATUS dispatcher_regulatory_init(void)
238 {
239 	return wlan_regulatory_init();
240 }
241 
242 static QDF_STATUS dispatcher_regulatory_deinit(void)
243 {
244 	return wlan_regulatory_deinit();
245 }
246 
247 static QDF_STATUS dispatcher_regulatory_psoc_open(struct wlan_objmgr_psoc
248 						  *psoc)
249 {
250 	return regulatory_psoc_open(psoc);
251 }
252 
253 static QDF_STATUS dispatcher_regulatory_psoc_close(struct wlan_objmgr_psoc
254 						   *psoc)
255 {
256 	return regulatory_psoc_close(psoc);
257 }
258 
259 #if defined(WLAN_CONV_SPECTRAL_ENABLE) && defined(SPECTRAL_MODULIZED_ENABLE)
260 QDF_STATUS dispatcher_register_spectral_pdev_open_handler(
261 			spectral_pdev_open_handler handler)
262 {
263 	dispatcher_spectral_pdev_open_handler_cb = handler;
264 
265 	return QDF_STATUS_SUCCESS;
266 }
267 qdf_export_symbol(dispatcher_register_spectral_pdev_open_handler);
268 
269 static QDF_STATUS dispatcher_spectral_pdev_open(struct wlan_objmgr_pdev
270 						  *pdev)
271 {
272 	return dispatcher_spectral_pdev_open_handler_cb(pdev);
273 }
274 
275 static QDF_STATUS dispatcher_spectral_pdev_close(struct wlan_objmgr_pdev *pdev)
276 {
277 	return QDF_STATUS_SUCCESS;
278 }
279 #else
280 static QDF_STATUS dispatcher_spectral_pdev_open(struct wlan_objmgr_pdev
281 						  *pdev)
282 {
283 	return QDF_STATUS_SUCCESS;
284 }
285 
286 static QDF_STATUS dispatcher_spectral_pdev_close(struct wlan_objmgr_pdev *pdev)
287 {
288 	return QDF_STATUS_SUCCESS;
289 }
290 #endif
291 
292 static QDF_STATUS dispatcher_regulatory_pdev_open(struct wlan_objmgr_pdev
293 						  *pdev)
294 {
295 	return regulatory_pdev_open(pdev);
296 }
297 
298 static QDF_STATUS dispatcher_regulatory_pdev_close(struct wlan_objmgr_pdev
299 						  *pdev)
300 {
301 	return regulatory_pdev_close(pdev);
302 }
303 
304 #ifdef WLAN_SA_API_ENABLE
305 static QDF_STATUS dispatcher_init_sa_api(void)
306 {
307 	return wlan_sa_api_init();
308 }
309 
310 static QDF_STATUS dispatcher_deinit_sa_api(void)
311 {
312 	return wlan_sa_api_deinit();
313 }
314 
315 static QDF_STATUS sa_api_psoc_enable(struct wlan_objmgr_psoc *psoc)
316 {
317 	return wlan_sa_api_enable(psoc);
318 }
319 
320 static QDF_STATUS sa_api_psoc_disable(struct wlan_objmgr_psoc *psoc)
321 {
322 	return wlan_sa_api_disable(psoc);
323 }
324 #else
325 static QDF_STATUS dispatcher_init_sa_api(void)
326 {
327 	return QDF_STATUS_SUCCESS;
328 }
329 
330 static QDF_STATUS dispatcher_deinit_sa_api(void)
331 {
332 	return QDF_STATUS_SUCCESS;
333 }
334 
335 static QDF_STATUS sa_api_psoc_enable(struct wlan_objmgr_psoc *psoc)
336 {
337 	return QDF_STATUS_SUCCESS;
338 }
339 
340 static QDF_STATUS sa_api_psoc_disable(struct wlan_objmgr_psoc *psoc)
341 {
342 	return QDF_STATUS_SUCCESS;
343 }
344 #endif /* END of WLAN_SA_API_ENABLE */
345 
346 
347 #ifdef WLAN_ATF_ENABLE
348 static QDF_STATUS dispatcher_init_atf(void)
349 {
350 	return wlan_atf_init();
351 }
352 
353 static QDF_STATUS dispatcher_deinit_atf(void)
354 {
355 	return wlan_atf_deinit();
356 }
357 
358 static QDF_STATUS atf_psoc_open(struct wlan_objmgr_psoc *psoc)
359 {
360 	return wlan_atf_open(psoc);
361 }
362 
363 static QDF_STATUS atf_psoc_close(struct wlan_objmgr_psoc *psoc)
364 {
365 	return wlan_atf_close(psoc);
366 }
367 
368 static QDF_STATUS atf_psoc_enable(struct wlan_objmgr_psoc *psoc)
369 {
370 	return wlan_atf_enable(psoc);
371 }
372 
373 static QDF_STATUS atf_psoc_disable(struct wlan_objmgr_psoc *psoc)
374 {
375 	return wlan_atf_disable(psoc);
376 }
377 #else
378 static QDF_STATUS dispatcher_init_atf(void)
379 {
380 	return QDF_STATUS_SUCCESS;
381 }
382 
383 static QDF_STATUS dispatcher_deinit_atf(void)
384 {
385 	return QDF_STATUS_SUCCESS;
386 }
387 
388 static QDF_STATUS atf_psoc_open(struct wlan_objmgr_psoc *psoc)
389 {
390 	return QDF_STATUS_SUCCESS;
391 }
392 
393 static QDF_STATUS atf_psoc_close(struct wlan_objmgr_psoc *psoc)
394 {
395 	return QDF_STATUS_SUCCESS;
396 }
397 
398 static QDF_STATUS atf_psoc_enable(struct wlan_objmgr_psoc *psoc)
399 {
400 	return QDF_STATUS_SUCCESS;
401 }
402 
403 static QDF_STATUS atf_psoc_disable(struct wlan_objmgr_psoc *psoc)
404 {
405 	return QDF_STATUS_SUCCESS;
406 }
407 #endif /* END of WLAN_ATF_ENABLE */
408 
409 #ifdef WLAN_CONV_CRYPTO_SUPPORTED
410 static QDF_STATUS dispatcher_init_crypto(void)
411 {
412 	return wlan_crypto_init();
413 }
414 
415 static QDF_STATUS dispatcher_deinit_crypto(void)
416 {
417 	return wlan_crypto_deinit();
418 }
419 #else
420 static QDF_STATUS dispatcher_init_crypto(void)
421 {
422 	return QDF_STATUS_SUCCESS;
423 }
424 
425 static QDF_STATUS dispatcher_deinit_crypto(void)
426 {
427 	return QDF_STATUS_SUCCESS;
428 }
429 #endif /* END of WLAN_CONV_CRYPTO_SUPPORTED */
430 
431 #ifdef WIFI_POS_CONVERGED
432 static QDF_STATUS dispatcher_init_wifi_pos(void)
433 {
434 	return wifi_pos_init();
435 }
436 
437 static QDF_STATUS dispatcher_deinit_wifi_pos(void)
438 {
439 	return wifi_pos_deinit();
440 }
441 
442 static QDF_STATUS dispatcher_wifi_pos_enable(struct wlan_objmgr_psoc *psoc)
443 {
444 	return wifi_pos_psoc_enable(psoc);
445 }
446 
447 static QDF_STATUS dispatcher_wifi_pos_disable(struct wlan_objmgr_psoc *psoc)
448 {
449 	return wifi_pos_psoc_disable(psoc);
450 }
451 #else
452 static QDF_STATUS dispatcher_init_wifi_pos(void)
453 {
454 	return QDF_STATUS_SUCCESS;
455 }
456 
457 static QDF_STATUS dispatcher_deinit_wifi_pos(void)
458 {
459 	return QDF_STATUS_SUCCESS;
460 }
461 
462 static QDF_STATUS dispatcher_wifi_pos_enable(struct wlan_objmgr_psoc *psoc)
463 {
464 	return QDF_STATUS_SUCCESS;
465 }
466 
467 static QDF_STATUS dispatcher_wifi_pos_disable(struct wlan_objmgr_psoc *psoc)
468 {
469 	return QDF_STATUS_SUCCESS;
470 }
471 #endif
472 
473 #ifdef DFS_COMPONENT_ENABLE
474 static QDF_STATUS dispatcher_init_dfs(void)
475 {
476 	return dfs_init();
477 }
478 
479 static QDF_STATUS dispatcher_deinit_dfs(void)
480 {
481 	return dfs_deinit();
482 }
483 
484 static QDF_STATUS dispatcher_dfs_psoc_enable(struct wlan_objmgr_psoc *psoc)
485 {
486 	return wifi_dfs_psoc_enable(psoc);
487 }
488 
489 static QDF_STATUS dispatcher_dfs_psoc_disable(struct wlan_objmgr_psoc *psoc)
490 {
491 	return wifi_dfs_psoc_disable(psoc);
492 }
493 #else
494 static QDF_STATUS dispatcher_init_dfs(void)
495 {
496 	return QDF_STATUS_SUCCESS;
497 }
498 
499 static QDF_STATUS dispatcher_deinit_dfs(void)
500 {
501 	return QDF_STATUS_SUCCESS;
502 }
503 
504 static QDF_STATUS dispatcher_dfs_psoc_enable(struct wlan_objmgr_psoc *psoc)
505 {
506 	return QDF_STATUS_SUCCESS;
507 }
508 
509 static QDF_STATUS dispatcher_dfs_psoc_disable(struct wlan_objmgr_psoc *psoc)
510 {
511 	return QDF_STATUS_SUCCESS;
512 }
513 #endif
514 
515 #ifdef WLAN_OFFCHAN_TXRX_ENABLE
516 static QDF_STATUS dispatcher_offchan_txrx_init(void)
517 {
518 	return wlan_offchan_txrx_init();
519 }
520 
521 static QDF_STATUS dispatcher_offchan_txrx_deinit(void)
522 {
523 	return wlan_offchan_txrx_deinit();
524 }
525 #else
526 static QDF_STATUS dispatcher_offchan_txrx_init(void)
527 {
528 	return QDF_STATUS_SUCCESS;
529 }
530 
531 static QDF_STATUS dispatcher_offchan_txrx_deinit(void)
532 {
533 	return QDF_STATUS_SUCCESS;
534 }
535 #endif /*WLAN_OFFCHAN_TXRX_ENABLE*/
536 
537 #ifdef WLAN_SUPPORT_SPLITMAC
538 static QDF_STATUS dispatcher_splitmac_init(void)
539 {
540 	return wlan_splitmac_init();
541 }
542 
543 static QDF_STATUS dispatcher_splitmac_deinit(void)
544 {
545 	return wlan_splitmac_deinit();
546 }
547 #else
548 static QDF_STATUS dispatcher_splitmac_init(void)
549 {
550 	return QDF_STATUS_SUCCESS;
551 }
552 
553 static QDF_STATUS dispatcher_splitmac_deinit(void)
554 {
555 	return QDF_STATUS_SUCCESS;
556 }
557 #endif  /* WLAN_SUPPORT_SPLITMAC */
558 
559 #ifdef WLAN_CONV_SPECTRAL_ENABLE
560 #ifndef SPECTRAL_MODULIZED_ENABLE
561 static QDF_STATUS dispatcher_spectral_init(void)
562 {
563 	return wlan_spectral_init();
564 }
565 
566 static QDF_STATUS dispatcher_spectral_deinit(void)
567 {
568 	return wlan_spectral_deinit();
569 }
570 #else
571 static QDF_STATUS dispatcher_spectral_init(void)
572 {
573 	return QDF_STATUS_SUCCESS;
574 }
575 
576 static QDF_STATUS dispatcher_spectral_deinit(void)
577 {
578 	return QDF_STATUS_SUCCESS;
579 }
580 #endif
581 #else
582 static QDF_STATUS dispatcher_spectral_init(void)
583 {
584 	return QDF_STATUS_SUCCESS;
585 }
586 
587 static QDF_STATUS dispatcher_spectral_deinit(void)
588 {
589 	return QDF_STATUS_SUCCESS;
590 }
591 #endif
592 
593 #ifdef DIRECT_BUF_RX_ENABLE
594 static QDF_STATUS dispatcher_dbr_psoc_enable(struct wlan_objmgr_psoc *psoc)
595 {
596 	struct wlan_lmac_if_tx_ops *tx_ops;
597 
598 	tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
599 	if (tx_ops->dbr_tx_ops.direct_buf_rx_register_events)
600 		return tx_ops->dbr_tx_ops.direct_buf_rx_register_events(psoc);
601 
602 	return QDF_STATUS_SUCCESS;
603 }
604 
605 static QDF_STATUS dispatcher_dbr_psoc_disable(struct wlan_objmgr_psoc *psoc)
606 {
607 	struct wlan_lmac_if_tx_ops *tx_ops;
608 
609 	tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
610 	if (tx_ops->dbr_tx_ops.direct_buf_rx_unregister_events)
611 		return tx_ops->dbr_tx_ops.direct_buf_rx_unregister_events(psoc);
612 
613 	return QDF_STATUS_SUCCESS;
614 }
615 #else
616 static QDF_STATUS dispatcher_dbr_psoc_enable(struct wlan_objmgr_psoc *psoc)
617 {
618 	return QDF_STATUS_SUCCESS;
619 }
620 
621 static QDF_STATUS dispatcher_dbr_psoc_disable(struct wlan_objmgr_psoc *psoc)
622 {
623 	return QDF_STATUS_SUCCESS;
624 }
625 #endif /* DIRECT_BUF_RX_ENABLE */
626 
627 #ifdef WLAN_SUPPORT_GREEN_AP
628 static QDF_STATUS dispatcher_green_ap_init(void)
629 {
630 	return wlan_green_ap_init();
631 }
632 
633 static QDF_STATUS dispatcher_green_ap_pdev_open(
634 				struct wlan_objmgr_pdev *pdev)
635 {
636 	return wlan_green_ap_pdev_open(pdev);
637 }
638 
639 /* Only added this for symmetry */
640 static QDF_STATUS dispatcher_green_ap_pdev_close(struct wlan_objmgr_pdev *pdev)
641 {
642 	return QDF_STATUS_SUCCESS;
643 }
644 
645 static QDF_STATUS dispatcher_green_ap_deinit(void)
646 {
647 	return wlan_green_ap_deinit();
648 }
649 #else
650 static QDF_STATUS dispatcher_green_ap_init(void)
651 {
652 	return QDF_STATUS_SUCCESS;
653 }
654 static QDF_STATUS dispatcher_green_ap_pdev_open(
655 				struct wlan_objmgr_pdev *pdev)
656 {
657 	return QDF_STATUS_SUCCESS;
658 }
659 
660 /* Only added this for symmetry */
661 static QDF_STATUS dispatcher_green_ap_pdev_close(struct wlan_objmgr_pdev *pdev)
662 {
663 	return QDF_STATUS_SUCCESS;
664 }
665 
666 static QDF_STATUS dispatcher_green_ap_deinit(void)
667 {
668 	return QDF_STATUS_SUCCESS;
669 }
670 #endif
671 
672 #ifdef WLAN_SUPPORT_FILS
673 static QDF_STATUS dispatcher_fd_init(void)
674 {
675 	return wlan_fd_init();
676 }
677 
678 static QDF_STATUS dispatcher_fd_deinit(void)
679 {
680 	return wlan_fd_deinit();
681 }
682 
683 static QDF_STATUS fd_psoc_enable(struct wlan_objmgr_psoc *psoc)
684 {
685 	return wlan_fd_enable(psoc);
686 }
687 
688 static QDF_STATUS fd_psoc_disable(struct wlan_objmgr_psoc *psoc)
689 {
690 	return wlan_fd_disable(psoc);
691 }
692 #else
693 static QDF_STATUS dispatcher_fd_init(void)
694 {
695 	return QDF_STATUS_SUCCESS;
696 }
697 
698 static QDF_STATUS dispatcher_fd_deinit(void)
699 {
700 	return QDF_STATUS_SUCCESS;
701 }
702 
703 static QDF_STATUS fd_psoc_enable(struct wlan_objmgr_psoc *psoc)
704 {
705 	return QDF_STATUS_SUCCESS;
706 }
707 
708 static QDF_STATUS fd_psoc_disable(struct wlan_objmgr_psoc *psoc)
709 {
710 	return QDF_STATUS_SUCCESS;
711 }
712 #endif /* WLAN_SUPPORT_FILS */
713 
714 #ifdef FEATURE_COEX
715 static QDF_STATUS dispatcher_coex_init(void)
716 {
717 	return wlan_coex_init();
718 }
719 
720 static QDF_STATUS dispatcher_coex_deinit(void)
721 {
722 	return wlan_coex_deinit();
723 }
724 
725 static QDF_STATUS dispatcher_coex_psoc_open(struct wlan_objmgr_psoc *psoc)
726 {
727 	return wlan_coex_psoc_open(psoc);
728 }
729 
730 static QDF_STATUS dispatcher_coex_psoc_close(struct wlan_objmgr_psoc *psoc)
731 {
732 	return wlan_coex_psoc_close(psoc);
733 }
734 #else
735 static inline QDF_STATUS dispatcher_coex_init(void)
736 {
737 	return QDF_STATUS_SUCCESS;
738 }
739 
740 static inline QDF_STATUS dispatcher_coex_deinit(void)
741 {
742 	return QDF_STATUS_SUCCESS;
743 }
744 
745 static inline QDF_STATUS
746 dispatcher_coex_psoc_open(struct wlan_objmgr_psoc *psoc)
747 {
748 	return QDF_STATUS_SUCCESS;
749 }
750 
751 static inline QDF_STATUS
752 dispatcher_coex_psoc_close(struct wlan_objmgr_psoc *psoc)
753 {
754 	return QDF_STATUS_SUCCESS;
755 }
756 #endif /* FEATURE_COEX */
757 
758 QDF_STATUS dispatcher_init(void)
759 {
760 	if (QDF_STATUS_SUCCESS != wlan_objmgr_global_obj_init())
761 		goto out;
762 
763 	if (QDF_STATUS_SUCCESS != wlan_mgmt_txrx_init())
764 		goto mgmt_txrx_init_fail;
765 
766 	if (QDF_STATUS_SUCCESS != ucfg_scan_init())
767 		goto ucfg_scan_init_fail;
768 
769 	if (QDF_STATUS_SUCCESS != wlan_serialization_init())
770 		goto serialization_init_fail;
771 
772 	if (QDF_STATUS_SUCCESS != dispatcher_init_crypto())
773 		goto crypto_init_fail;
774 
775 	if (QDF_STATUS_SUCCESS != dispatcher_init_cp_stats())
776 		goto cp_stats_init_fail;
777 
778 	if (QDF_STATUS_SUCCESS != dispatcher_init_atf())
779 		goto atf_init_fail;
780 
781 	if (QDF_STATUS_SUCCESS != dispatcher_init_sa_api())
782 		goto sa_api_init_fail;
783 
784 	if (QDF_STATUS_SUCCESS != dispatcher_init_wifi_pos())
785 		goto wifi_pos_init_fail;
786 
787 	if (QDF_STATUS_SUCCESS != dispatcher_init_dfs())
788 		goto dfs_init_fail;
789 
790 	if (QDF_STATUS_SUCCESS != dispatcher_regulatory_init())
791 		goto regulatory_init_fail;
792 
793 	if (QDF_STATUS_SUCCESS != dispatcher_offchan_txrx_init())
794 		goto offchan_init_fail;
795 
796 	if (QDF_STATUS_SUCCESS != dispatcher_init_son())
797 		goto son_init_fail;
798 
799 	if (QDF_STATUS_SUCCESS != dispatcher_splitmac_init())
800 		goto splitmac_init_fail;
801 
802 	if (QDF_STATUS_SUCCESS != dispatcher_fd_init())
803 		goto fd_init_fail;
804 
805 	if (QDF_STATUS_SUCCESS != dispatcher_green_ap_init())
806 		goto green_ap_init_fail;
807 
808 	if (QDF_STATUS_SUCCESS != dispatcher_ftm_init())
809 		goto ftm_init_fail;
810 
811 	if (QDF_IS_STATUS_ERROR(cfg_dispatcher_init()))
812 		goto cfg_init_fail;
813 
814 	if (QDF_STATUS_SUCCESS != dispatcher_spectral_init())
815 		goto spectral_init_fail;
816 
817 	if (QDF_STATUS_SUCCESS != wlan_cmn_mlme_init())
818 		goto cmn_mlme_init_fail;
819 
820 	if (QDF_STATUS_SUCCESS != dispatcher_init_cfr())
821 		goto cfr_init_fail;
822 
823 	if (QDF_STATUS_SUCCESS != dispatcher_coex_init())
824 		goto coex_init_fail;
825 
826 	/*
827 	 * scheduler INIT has to be the last as each component's
828 	 * initialization has to happen first and then at the end
829 	 * scheduler needs to start accepting the service.
830 	 */
831 	if (QDF_STATUS_SUCCESS != scheduler_init())
832 		goto scheduler_init_fail;
833 
834 	return QDF_STATUS_SUCCESS;
835 
836 scheduler_init_fail:
837 	dispatcher_coex_deinit();
838 coex_init_fail:
839 	dispatcher_deinit_cfr();
840 cfr_init_fail:
841 	wlan_cmn_mlme_deinit();
842 cmn_mlme_init_fail:
843 	dispatcher_spectral_deinit();
844 spectral_init_fail:
845 	cfg_dispatcher_deinit();
846 cfg_init_fail:
847 	dispatcher_ftm_deinit();
848 ftm_init_fail:
849 	dispatcher_green_ap_deinit();
850 green_ap_init_fail:
851 	dispatcher_fd_deinit();
852 fd_init_fail:
853 	dispatcher_splitmac_deinit();
854 splitmac_init_fail:
855 	dispatcher_deinit_son();
856 son_init_fail:
857 	dispatcher_offchan_txrx_deinit();
858 offchan_init_fail:
859 	dispatcher_regulatory_deinit();
860 regulatory_init_fail:
861 	dispatcher_deinit_dfs();
862 dfs_init_fail:
863 	dispatcher_deinit_wifi_pos();
864 wifi_pos_init_fail:
865 	dispatcher_deinit_sa_api();
866 sa_api_init_fail:
867 	dispatcher_deinit_atf();
868 atf_init_fail:
869 	dispatcher_deinit_cp_stats();
870 cp_stats_init_fail:
871 	dispatcher_deinit_crypto();
872 crypto_init_fail:
873 	wlan_serialization_deinit();
874 serialization_init_fail:
875 	ucfg_scan_deinit();
876 ucfg_scan_init_fail:
877 	wlan_mgmt_txrx_deinit();
878 mgmt_txrx_init_fail:
879 	wlan_objmgr_global_obj_deinit();
880 
881 out:
882 	return QDF_STATUS_E_FAILURE;
883 }
884 qdf_export_symbol(dispatcher_init);
885 
886 QDF_STATUS dispatcher_deinit(void)
887 {
888 	QDF_STATUS status;
889 
890 	QDF_BUG(QDF_STATUS_SUCCESS == scheduler_deinit());
891 
892 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_coex_deinit());
893 
894 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_cfr());
895 
896 	QDF_BUG(QDF_STATUS_SUCCESS == wlan_cmn_mlme_deinit());
897 
898 	status = cfg_dispatcher_deinit();
899 	QDF_BUG(QDF_IS_STATUS_SUCCESS(status));
900 
901 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_ftm_deinit());
902 
903 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_green_ap_deinit());
904 
905 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_fd_deinit());
906 
907 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_spectral_deinit());
908 
909 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_splitmac_deinit());
910 
911 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_son());
912 
913 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_offchan_txrx_deinit());
914 
915 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_regulatory_deinit());
916 
917 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_dfs());
918 
919 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_wifi_pos());
920 
921 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_sa_api());
922 
923 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_atf());
924 
925 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_cp_stats());
926 
927 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_crypto());
928 
929 	QDF_BUG(QDF_STATUS_SUCCESS == wlan_serialization_deinit());
930 
931 	QDF_BUG(QDF_STATUS_SUCCESS == ucfg_scan_deinit());
932 
933 	QDF_BUG(QDF_STATUS_SUCCESS == wlan_mgmt_txrx_deinit());
934 
935 	QDF_BUG(QDF_STATUS_SUCCESS == wlan_objmgr_global_obj_deinit());
936 
937 	return QDF_STATUS_SUCCESS;
938 }
939 qdf_export_symbol(dispatcher_deinit);
940 
941 QDF_STATUS dispatcher_enable(void)
942 {
943 	QDF_STATUS status;
944 
945 	status = scheduler_enable();
946 
947 	return status;
948 }
949 qdf_export_symbol(dispatcher_enable);
950 
951 QDF_STATUS dispatcher_disable(void)
952 {
953 	QDF_BUG(QDF_IS_STATUS_SUCCESS(scheduler_disable()));
954 
955 	return QDF_STATUS_SUCCESS;
956 }
957 qdf_export_symbol(dispatcher_disable);
958 
959 QDF_STATUS dispatcher_psoc_open(struct wlan_objmgr_psoc *psoc)
960 {
961 	if (QDF_STATUS_SUCCESS != wlan_mgmt_txrx_psoc_open(psoc))
962 		goto out;
963 
964 	if (QDF_STATUS_SUCCESS != ucfg_scan_psoc_open(psoc))
965 		goto scan_psoc_open_fail;
966 
967 	if (QDF_STATUS_SUCCESS != cp_stats_psoc_open(psoc))
968 		goto cp_stats_psoc_open_fail;
969 
970 	if (QDF_STATUS_SUCCESS != atf_psoc_open(psoc))
971 		goto atf_psoc_open_fail;
972 
973 	if (QDF_STATUS_SUCCESS != dispatcher_regulatory_psoc_open(psoc))
974 		goto regulatory_psoc_open_fail;
975 
976 	if (QDF_STATUS_SUCCESS != son_psoc_open(psoc))
977 		goto psoc_son_fail;
978 
979 	if (QDF_STATUS_SUCCESS != dispatcher_ftm_psoc_open(psoc))
980 		goto ftm_psoc_open_fail;
981 
982 	if (QDF_STATUS_SUCCESS != dispatcher_coex_psoc_open(psoc))
983 		goto coex_psoc_open_fail;
984 
985 	return QDF_STATUS_SUCCESS;
986 
987 coex_psoc_open_fail:
988 	dispatcher_ftm_psoc_close(psoc);
989 ftm_psoc_open_fail:
990 	son_psoc_close(psoc);
991 psoc_son_fail:
992 	regulatory_psoc_close(psoc);
993 regulatory_psoc_open_fail:
994 	atf_psoc_close(psoc);
995 atf_psoc_open_fail:
996 	cp_stats_psoc_close(psoc);
997 cp_stats_psoc_open_fail:
998 	ucfg_scan_psoc_close(psoc);
999 scan_psoc_open_fail:
1000 	wlan_mgmt_txrx_psoc_close(psoc);
1001 
1002 out:
1003 	return QDF_STATUS_E_FAILURE;
1004 }
1005 qdf_export_symbol(dispatcher_psoc_open);
1006 
1007 QDF_STATUS dispatcher_psoc_close(struct wlan_objmgr_psoc *psoc)
1008 {
1009 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_coex_psoc_close(psoc));
1010 
1011 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_ftm_psoc_close(psoc));
1012 
1013 	QDF_BUG(QDF_STATUS_SUCCESS == son_psoc_close(psoc));
1014 
1015 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_regulatory_psoc_close(psoc));
1016 
1017 	QDF_BUG(QDF_STATUS_SUCCESS == atf_psoc_close(psoc));
1018 
1019 	QDF_BUG(QDF_STATUS_SUCCESS == cp_stats_psoc_close(psoc));
1020 
1021 	QDF_BUG(QDF_STATUS_SUCCESS == ucfg_scan_psoc_close(psoc));
1022 
1023 	QDF_BUG(QDF_STATUS_SUCCESS == wlan_mgmt_txrx_psoc_close(psoc));
1024 
1025 	return QDF_STATUS_SUCCESS;
1026 }
1027 qdf_export_symbol(dispatcher_psoc_close);
1028 
1029 QDF_STATUS dispatcher_psoc_enable(struct wlan_objmgr_psoc *psoc)
1030 {
1031 	if (QDF_STATUS_SUCCESS != wlan_serialization_psoc_enable(psoc))
1032 		goto out;
1033 
1034 	if (QDF_STATUS_SUCCESS != ucfg_scan_psoc_enable(psoc))
1035 		goto serialization_psoc_enable_fail;
1036 
1037 	if (QDF_STATUS_SUCCESS != sa_api_psoc_enable(psoc))
1038 		goto sa_api_psoc_enable_fail;
1039 
1040 	if (QDF_STATUS_SUCCESS != cp_stats_psoc_enable(psoc))
1041 		goto cp_stats_psoc_enable_fail;
1042 
1043 	if (QDF_STATUS_SUCCESS != atf_psoc_enable(psoc))
1044 		goto atf_psoc_enable_fail;
1045 
1046 	if (QDF_STATUS_SUCCESS != dispatcher_wifi_pos_enable(psoc))
1047 		goto wifi_pos_psoc_enable_fail;
1048 
1049 	if (QDF_STATUS_SUCCESS != dispatcher_dfs_psoc_enable(psoc))
1050 		goto wifi_dfs_psoc_enable_fail;
1051 
1052 	if (QDF_STATUS_SUCCESS != fd_psoc_enable(psoc))
1053 		goto fd_psoc_enable_fail;
1054 
1055 	if (QDF_STATUS_SUCCESS != dispatcher_dbr_psoc_enable(psoc))
1056 		goto dbr_psoc_enable_fail;
1057 
1058 	if (QDF_STATUS_SUCCESS != wlan_mlme_psoc_enable(psoc))
1059 		goto mlme_psoc_enable_fail;
1060 
1061 	return QDF_STATUS_SUCCESS;
1062 
1063 mlme_psoc_enable_fail:
1064 	dispatcher_dbr_psoc_disable(psoc);
1065 dbr_psoc_enable_fail:
1066 	fd_psoc_disable(psoc);
1067 fd_psoc_enable_fail:
1068 	dispatcher_dfs_psoc_disable(psoc);
1069 wifi_dfs_psoc_enable_fail:
1070 	dispatcher_wifi_pos_disable(psoc);
1071 wifi_pos_psoc_enable_fail:
1072 	atf_psoc_disable(psoc);
1073 atf_psoc_enable_fail:
1074 	cp_stats_psoc_disable(psoc);
1075 cp_stats_psoc_enable_fail:
1076 	sa_api_psoc_disable(psoc);
1077 sa_api_psoc_enable_fail:
1078 	ucfg_scan_psoc_disable(psoc);
1079 serialization_psoc_enable_fail:
1080 	wlan_serialization_psoc_disable(psoc);
1081 out:
1082 	return QDF_STATUS_E_FAILURE;
1083 }
1084 qdf_export_symbol(dispatcher_psoc_enable);
1085 
1086 QDF_STATUS dispatcher_psoc_disable(struct wlan_objmgr_psoc *psoc)
1087 {
1088 	QDF_BUG(QDF_STATUS_SUCCESS == wlan_mlme_psoc_disable(psoc));
1089 
1090 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_dbr_psoc_disable(psoc));
1091 
1092 	QDF_BUG(QDF_STATUS_SUCCESS == fd_psoc_disable(psoc));
1093 
1094 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_dfs_psoc_disable(psoc));
1095 
1096 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_wifi_pos_disable(psoc));
1097 
1098 	QDF_BUG(QDF_STATUS_SUCCESS == atf_psoc_disable(psoc));
1099 
1100 	QDF_BUG(QDF_STATUS_SUCCESS == cp_stats_psoc_disable(psoc));
1101 
1102 	QDF_BUG(QDF_STATUS_SUCCESS == sa_api_psoc_disable(psoc));
1103 
1104 	QDF_BUG(QDF_STATUS_SUCCESS == ucfg_scan_psoc_disable(psoc));
1105 
1106 	QDF_BUG(QDF_STATUS_SUCCESS == wlan_serialization_psoc_disable(psoc));
1107 
1108 	return QDF_STATUS_SUCCESS;
1109 }
1110 qdf_export_symbol(dispatcher_psoc_disable);
1111 
1112 QDF_STATUS dispatcher_pdev_open(struct wlan_objmgr_pdev *pdev)
1113 {
1114 	QDF_STATUS status;
1115 
1116 	if (QDF_STATUS_SUCCESS != dispatcher_regulatory_pdev_open(pdev))
1117 		goto regulatory_pdev_open_fail;
1118 
1119 	status = dispatcher_spectral_pdev_open(pdev);
1120 	if (status != QDF_STATUS_SUCCESS && status != QDF_STATUS_COMP_DISABLED)
1121 		goto spectral_pdev_open_fail;
1122 
1123 	status = dispatcher_cfr_pdev_open(pdev);
1124 	if (status != QDF_STATUS_SUCCESS && status != QDF_STATUS_COMP_DISABLED)
1125 		goto cfr_pdev_open_fail;
1126 
1127 	if (QDF_STATUS_SUCCESS != wlan_mgmt_txrx_pdev_open(pdev))
1128 		goto mgmt_txrx_pdev_open_fail;
1129 	if (QDF_IS_STATUS_ERROR(dispatcher_green_ap_pdev_open(pdev)))
1130 		goto green_ap_pdev_open_fail;
1131 
1132 	return QDF_STATUS_SUCCESS;
1133 
1134 green_ap_pdev_open_fail:
1135 	wlan_mgmt_txrx_pdev_close(pdev);
1136 mgmt_txrx_pdev_open_fail:
1137 	dispatcher_cfr_pdev_close(pdev);
1138 cfr_pdev_open_fail:
1139 	dispatcher_spectral_pdev_close(pdev);
1140 spectral_pdev_open_fail:
1141 	dispatcher_regulatory_pdev_close(pdev);
1142 regulatory_pdev_open_fail:
1143 
1144 	return QDF_STATUS_E_FAILURE;
1145 }
1146 qdf_export_symbol(dispatcher_pdev_open);
1147 
1148 QDF_STATUS dispatcher_pdev_close(struct wlan_objmgr_pdev *pdev)
1149 {
1150 	QDF_STATUS status;
1151 
1152 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_green_ap_pdev_close(pdev));
1153 
1154 	QDF_BUG(QDF_STATUS_SUCCESS == wlan_mgmt_txrx_pdev_close(pdev));
1155 
1156 	status = dispatcher_cfr_pdev_close(pdev);
1157 	QDF_BUG((QDF_STATUS_SUCCESS == status) ||
1158 		(QDF_STATUS_COMP_DISABLED == status));
1159 
1160 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_spectral_pdev_close(pdev));
1161 
1162 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_regulatory_pdev_close(pdev));
1163 
1164 	return QDF_STATUS_SUCCESS;
1165 }
1166 qdf_export_symbol(dispatcher_pdev_close);
1167