xref: /wlan-driver/qca-wifi-host-cmn/init_deinit/dispatcher/inc/dispatcher_init_deinit.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2016-2018,2020 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
4*5113495bSYour Name  *
5*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
6*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
7*5113495bSYour Name  * above copyright notice and this permission notice appear in all
8*5113495bSYour Name  * copies.
9*5113495bSYour Name  *
10*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
18*5113495bSYour Name  */
19*5113495bSYour Name 
20*5113495bSYour Name /**
21*5113495bSYour Name  * DOC: This file provides various init/deinit trigger point for new
22*5113495bSYour Name  * components.
23*5113495bSYour Name  */
24*5113495bSYour Name 
25*5113495bSYour Name #if !defined(__DISPATCHER_INIT_H)
26*5113495bSYour Name #define __DISPATCHER_INIT_H
27*5113495bSYour Name 
28*5113495bSYour Name #include <qdf_types.h>
29*5113495bSYour Name #include <wlan_objmgr_cmn.h>
30*5113495bSYour Name #include <wlan_objmgr_psoc_obj.h>
31*5113495bSYour Name #include <wlan_objmgr_global_obj.h>
32*5113495bSYour Name 
33*5113495bSYour Name /**
34*5113495bSYour Name  * struct dispatcher_spectral_ops - Spectral ops table
35*5113495bSYour Name  * @spectral_pdev_open_handler: Spectral pdev open handler
36*5113495bSYour Name  * @spectral_psoc_open_handler: Spectral psoc open handler
37*5113495bSYour Name  * @spectral_psoc_close_handler: Spectral psoc close handler
38*5113495bSYour Name  * @spectral_psoc_enable_handler: Spectral psoc enable handler
39*5113495bSYour Name  * @spectral_psoc_disable_handler: Spectral psoc disable handler
40*5113495bSYour Name  */
41*5113495bSYour Name struct dispatcher_spectral_ops {
42*5113495bSYour Name 	QDF_STATUS(*spectral_pdev_open_handler)(struct wlan_objmgr_pdev *pdev);
43*5113495bSYour Name 	QDF_STATUS(*spectral_psoc_open_handler)(
44*5113495bSYour Name 					struct wlan_objmgr_psoc *psoc);
45*5113495bSYour Name 	QDF_STATUS(*spectral_psoc_close_handler)(
46*5113495bSYour Name 					struct wlan_objmgr_psoc *psoc);
47*5113495bSYour Name 	QDF_STATUS(*spectral_psoc_enable_handler)(
48*5113495bSYour Name 					struct wlan_objmgr_psoc *psoc);
49*5113495bSYour Name 	QDF_STATUS(*spectral_psoc_disable_handler)(
50*5113495bSYour Name 					struct wlan_objmgr_psoc *psoc);
51*5113495bSYour Name };
52*5113495bSYour Name 
53*5113495bSYour Name /**
54*5113495bSYour Name  * dispatcher_init(): API to init all new components
55*5113495bSYour Name  *
56*5113495bSYour Name  * This API calls all new components init APIs. This is invoked
57*5113495bSYour Name  * from HDD/OS_If layer during:
58*5113495bSYour Name  * 1) Driver load sequence
59*5113495bSYour Name  * 2) before probing the attached device.
60*5113495bSYour Name  * 3) FW is not ready
61*5113495bSYour Name  * 4) WMI channel is not established
62*5113495bSYour Name  *
63*5113495bSYour Name  * A component can't communicate with FW during init stage.
64*5113495bSYour Name  *
65*5113495bSYour Name  * Return: none
66*5113495bSYour Name  */
67*5113495bSYour Name QDF_STATUS dispatcher_init(void);
68*5113495bSYour Name 
69*5113495bSYour Name /**
70*5113495bSYour Name  * dispatcher_deinit(): API to de-init all new components
71*5113495bSYour Name  *
72*5113495bSYour Name  * This API calls all new components de-init APIs. This is invoked
73*5113495bSYour Name  * from HDD/OS_If layer during:
74*5113495bSYour Name  * 1) Driver unload sequence
75*5113495bSYour Name  * 2) FW is dead
76*5113495bSYour Name  * 3) WMI channel is destroyed
77*5113495bSYour Name  * 4) all PDEV and PSOC objects are destroyed
78*5113495bSYour Name  *
79*5113495bSYour Name  * A component can't communicate with FW during de-init stage.
80*5113495bSYour Name  *
81*5113495bSYour Name  * Return: none
82*5113495bSYour Name  */
83*5113495bSYour Name QDF_STATUS dispatcher_deinit(void);
84*5113495bSYour Name 
85*5113495bSYour Name /**
86*5113495bSYour Name  * dispatcher_enable(): global (above psoc) level component start
87*5113495bSYour Name  *
88*5113495bSYour Name  * Prepare components to service requests. Must only be called after
89*5113495bSYour Name  * dispatcher_init().
90*5113495bSYour Name  *
91*5113495bSYour Name  * Return: QDF_STATUS
92*5113495bSYour Name  */
93*5113495bSYour Name QDF_STATUS dispatcher_enable(void);
94*5113495bSYour Name 
95*5113495bSYour Name /**
96*5113495bSYour Name  * dispatcher_disable(): global (above psoc) level component stop
97*5113495bSYour Name  *
98*5113495bSYour Name  * Stop components from servicing requests. Must be called before
99*5113495bSYour Name  * scheduler_deinit().
100*5113495bSYour Name  *
101*5113495bSYour Name  * Return: QDF_STATUS
102*5113495bSYour Name  */
103*5113495bSYour Name QDF_STATUS dispatcher_disable(void);
104*5113495bSYour Name 
105*5113495bSYour Name /**
106*5113495bSYour Name  * dispatcher_psoc_open(): API to trigger PSOC open for all new components
107*5113495bSYour Name  * @psoc: psoc context
108*5113495bSYour Name  *
109*5113495bSYour Name  * This API calls all new components PSOC OPEN APIs. This is invoked from
110*5113495bSYour Name  * HDD/OS_If layer during:
111*5113495bSYour Name  * 1) Driver load sequence
112*5113495bSYour Name  * 2) PSOC object is created
113*5113495bSYour Name  * 3) FW is not yet ready
114*5113495bSYour Name  * 4) WMI channel is not yet established with FW
115*5113495bSYour Name  *
116*5113495bSYour Name  * PSOC open happens before FW WMI ready and hence a component can't
117*5113495bSYour Name  * communicate with FW during PSOC open sequence.
118*5113495bSYour Name  *
119*5113495bSYour Name  * Return: none
120*5113495bSYour Name  */
121*5113495bSYour Name QDF_STATUS dispatcher_psoc_open(struct wlan_objmgr_psoc *psoc);
122*5113495bSYour Name 
123*5113495bSYour Name /**
124*5113495bSYour Name  * dispatcher_psoc_close(): API to trigger PSOC close for all new components
125*5113495bSYour Name  * @psoc: psoc context
126*5113495bSYour Name  *
127*5113495bSYour Name  * This API calls all new components PSOC CLOSE APIs. This is invoked from
128*5113495bSYour Name  * HDD/OS_If layer during:
129*5113495bSYour Name  * 1) Driver unload sequence
130*5113495bSYour Name  * 2) PSOC object is destroyed
131*5113495bSYour Name  * 3) FW is already dead(PDEV suspended)
132*5113495bSYour Name  * 4) WMI channel is destroyed with FW
133*5113495bSYour Name  *
134*5113495bSYour Name  * A component can't communicate with FW during PSOC close.
135*5113495bSYour Name  *
136*5113495bSYour Name  * Return: none
137*5113495bSYour Name  */
138*5113495bSYour Name QDF_STATUS dispatcher_psoc_close(struct wlan_objmgr_psoc *psoc);
139*5113495bSYour Name 
140*5113495bSYour Name /**
141*5113495bSYour Name  * dispatcher_psoc_enable(): API to trigger PSOC enable(start) for all new
142*5113495bSYour Name  *                           components
143*5113495bSYour Name  * @psoc: psoc context
144*5113495bSYour Name  *
145*5113495bSYour Name  * This API calls all new components PSOC enable(start) APIs. This is invoked
146*5113495bSYour Name  * from HDD/OS_If layer during:
147*5113495bSYour Name  * 1) Driver load sequence
148*5113495bSYour Name  * 2) PSOC object is created
149*5113495bSYour Name  * 3) WMI endpoint and WMI channel is ready with FW
150*5113495bSYour Name  * 4) WMI FW ready event is also received from FW.
151*5113495bSYour Name  *
152*5113495bSYour Name  * FW is already ready and WMI channel is established by this time so a
153*5113495bSYour Name  * component can communicate with FW during PSOC enable sequence.
154*5113495bSYour Name  *
155*5113495bSYour Name  * Return: none
156*5113495bSYour Name  */
157*5113495bSYour Name QDF_STATUS dispatcher_psoc_enable(struct wlan_objmgr_psoc *psoc);
158*5113495bSYour Name 
159*5113495bSYour Name /**
160*5113495bSYour Name  * dispatcher_psoc_disable(): API to trigger PSOC disable(stop) for all new
161*5113495bSYour Name  *                            components
162*5113495bSYour Name  * @psoc: psoc context
163*5113495bSYour Name  *
164*5113495bSYour Name  * This API calls all new components PSOC disable(stop) APIs. This is invoked
165*5113495bSYour Name  * from HDD/OS_If layer during:
166*5113495bSYour Name  * 1) Driver unload sequence
167*5113495bSYour Name  * 2) WMI channel is still available
168*5113495bSYour Name  * 3) FW is still running and up
169*5113495bSYour Name  * 4) PSOC object is not destroyed
170*5113495bSYour Name  *
171*5113495bSYour Name  * A component should abort all its ongign transaction with FW at this stage
172*5113495bSYour Name  * for example scan component needs to abort all its ongoing scan in FW because
173*5113495bSYour Name  * is going to be stopped very soon.
174*5113495bSYour Name  *
175*5113495bSYour Name  * Return: none
176*5113495bSYour Name  */
177*5113495bSYour Name QDF_STATUS dispatcher_psoc_disable(struct wlan_objmgr_psoc *psoc);
178*5113495bSYour Name 
179*5113495bSYour Name /**
180*5113495bSYour Name  * dispatcher_pdev_open(): API to trigger PDEV open for all new components
181*5113495bSYour Name  * @pdev: pdev context
182*5113495bSYour Name  *
183*5113495bSYour Name  * This API calls all new components PDEV OPEN APIs. This is invoked from
184*5113495bSYour Name  * during PDEV object is created.
185*5113495bSYour Name  *
186*5113495bSYour Name  * Return: none
187*5113495bSYour Name  */
188*5113495bSYour Name QDF_STATUS dispatcher_pdev_open(struct wlan_objmgr_pdev *pdev);
189*5113495bSYour Name 
190*5113495bSYour Name /**
191*5113495bSYour Name  * dispatcher_pdev_close(): API to trigger PDEV close for all new components
192*5113495bSYour Name  * @pdev: pdev context
193*5113495bSYour Name  *
194*5113495bSYour Name  * This API calls all new components PDEV CLOSE APIs. This is invoked from
195*5113495bSYour Name  * during driver unload sequence.
196*5113495bSYour Name  *
197*5113495bSYour Name  * Return: none
198*5113495bSYour Name  */
199*5113495bSYour Name QDF_STATUS dispatcher_pdev_close(struct wlan_objmgr_pdev *pdev);
200*5113495bSYour Name 
201*5113495bSYour Name /**
202*5113495bSYour Name  * dispatcher_register_spectral_ops_handler(): API to register spectral
203*5113495bSYour Name  * operations
204*5113495bSYour Name  * @sops: pointer to Spectral ops table
205*5113495bSYour Name  *
206*5113495bSYour Name  * This API registers spectral pdev open handler, psoc enable handler and
207*5113495bSYour Name  * psoc disable handler, psoc open handler and psoc close handler.
208*5113495bSYour Name  *
209*5113495bSYour Name  * Return: QDF_STATUS
210*5113495bSYour Name  */
211*5113495bSYour Name QDF_STATUS
212*5113495bSYour Name dispatcher_register_spectral_ops_handler(struct dispatcher_spectral_ops *sops);
213*5113495bSYour Name #endif /* End of  !defined(__DISPATCHER_INIT_H) */
214