xref: /wlan-dirver/qca-wifi-host-cmn/init_deinit/dispatcher/inc/dispatcher_init_deinit.h (revision 3149adf58a329e17232a4c0e58d460d025edd55a)
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 /**
20  * DOC: This file provides various init/deinit trigger point for new
21  * components.
22  */
23 
24 #if !defined(__DISPATCHER_INIT_H)
25 #define __DISPATCHER_INIT_H
26 
27 #include <qdf_types.h>
28 #include <wlan_objmgr_cmn.h>
29 #include <wlan_objmgr_psoc_obj.h>
30 #include <wlan_objmgr_global_obj.h>
31 
32 /* Function pointer for spectral pdev open handler */
33 typedef QDF_STATUS (*spectral_pdev_open_handler)(
34 		struct wlan_objmgr_pdev *pdev);
35 
36 /**
37  * dispatcher_init(): API to init all new components
38  *
39  * This API calls all new components init APIs. This is invoked
40  * from HDD/OS_If layer during:
41  * 1) Driver load sequence
42  * 2) before probing the attached device.
43  * 3) FW is not ready
44  * 4) WMI channel is not established
45  *
46  * A component can't communicate with FW during init stage.
47  *
48  * Return: none
49  */
50 QDF_STATUS dispatcher_init(void);
51 
52 /**
53  * dispatcher_deinit(): API to de-init all new components
54  *
55  * This API calls all new components de-init APIs. This is invoked
56  * from HDD/OS_If layer during:
57  * 1) Driver unload sequence
58  * 2) FW is dead
59  * 3) WMI channel is destroyed
60  * 4) all PDEV and PSOC objects are destroyed
61  *
62  * A component can't communicate with FW during de-init stage.
63  *
64  * Return: none
65  */
66 QDF_STATUS dispatcher_deinit(void);
67 
68 /**
69  * dispatcher_enable(): global (above psoc) level component start
70  *
71  * Prepare components to service requests. Must only be called after
72  * dispatcher_init().
73  *
74  * Return: QDF_STATUS
75  */
76 QDF_STATUS dispatcher_enable(void);
77 
78 /**
79  * dispatcher_disable(): global (above psoc) level component stop
80  *
81  * Stop components from servicing requests. Must be called before
82  * scheduler_deinit().
83  *
84  * Return: QDF_STATUS
85  */
86 QDF_STATUS dispatcher_disable(void);
87 
88 /**
89  * dispatcher_psoc_open(): API to trigger PSOC open for all new components
90  * @psoc: psoc context
91  *
92  * This API calls all new components PSOC OPEN APIs. This is invoked from
93  * HDD/OS_If layer during:
94  * 1) Driver load sequence
95  * 2) PSOC object is created
96  * 3) FW is not yet ready
97  * 4) WMI channel is not yet established with FW
98  *
99  * PSOC open happens before FW WMI ready and hence a component can't
100  * communicate with FW during PSOC open sequence.
101  *
102  * Return: none
103  */
104 QDF_STATUS dispatcher_psoc_open(struct wlan_objmgr_psoc *psoc);
105 
106 /**
107  * dispatcher_psoc_close(): API to trigger PSOC close for all new components
108  * @psoc: psoc context
109  *
110  * This API calls all new components PSOC CLOSE APIs. This is invoked from
111  * HDD/OS_If layer during:
112  * 1) Driver unload sequence
113  * 2) PSOC object is destroyed
114  * 3) FW is already dead(PDEV suspended)
115  * 4) WMI channel is destroyed with FW
116  *
117  * A component can't communicate with FW during PSOC close.
118  *
119  * Return: none
120  */
121 QDF_STATUS dispatcher_psoc_close(struct wlan_objmgr_psoc *psoc);
122 
123 /**
124  * dispatcher_psoc_enable(): API to trigger PSOC enable(start) for all new
125  *                           components
126  * @psoc: psoc context
127  *
128  * This API calls all new components PSOC enable(start) APIs. This is invoked
129  * from HDD/OS_If layer during:
130  * 1) Driver load sequence
131  * 2) PSOC object is created
132  * 3) WMI endpoint and WMI channel is ready with FW
133  * 4) WMI FW ready event is also received from FW.
134  *
135  * FW is already ready and WMI channel is established by this time so a
136  * component can communicate with FW during PSOC enable sequence.
137  *
138  * Return: none
139  */
140 QDF_STATUS dispatcher_psoc_enable(struct wlan_objmgr_psoc *psoc);
141 
142 /**
143  * dispatcher_psoc_disable(): API to trigger PSOC disable(stop) for all new
144  *                            components
145  * @psoc: psoc context
146  *
147  * This API calls all new components PSOC disable(stop) APIs. This is invoked
148  * from HDD/OS_If layer during:
149  * 1) Driver unload sequence
150  * 2) WMI channel is still available
151  * 3) FW is still running and up
152  * 4) PSOC object is not destroyed
153  *
154  * A component should abort all its ongign transaction with FW at this stage
155  * for example scan component needs to abort all its ongoing scan in FW because
156  * is goign to be stopped very soon.
157  *
158  * Return: none
159  */
160 QDF_STATUS dispatcher_psoc_disable(struct wlan_objmgr_psoc *psoc);
161 
162 /**
163  * dispatcher_pdev_open(): API to trigger PDEV open for all new components
164  * @pdev: pdev context
165  *
166  * This API calls all new components PDEV OPEN APIs. This is invoked from
167  * during PDEV object is created.
168  *
169  * Return: none
170  */
171 QDF_STATUS dispatcher_pdev_open(struct wlan_objmgr_pdev *pdev);
172 
173 /**
174  * dispatcher_pdev_close(): API to trigger PDEV close for all new components
175  * @pdev: pdev context
176  *
177  * This API calls all new components PDEV CLOSE APIs. This is invoked from
178  * during driver unload sequence.
179  *
180  * Return: none
181  */
182 QDF_STATUS dispatcher_pdev_close(struct wlan_objmgr_pdev *pdev);
183 
184 /**
185  * dispatcher_register_spectral_pdev_open_handler():
186  * API to register spectral pdev open handler
187  * @handler: pdev open handler
188  *
189  * This API registers spectral pdev open handler.
190  *
191  * Return: none
192  */
193 QDF_STATUS dispatcher_register_spectral_pdev_open_handler(QDF_STATUS (*handler)
194 				(struct wlan_objmgr_pdev *pdev));
195 
196 #endif /* End of  !defined(__DISPATCHER_INIT_H) */
197