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