dispatcher_init_deinit.h 6.4 KB

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