dispatcher_init_deinit.h 5.7 KB

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