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