dispatcher_init_deinit.h 6.5 KB

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