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