wlan_spectral_utils_api.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /*
  2. * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
  3. *
  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. #ifndef _WLAN_SPECTRAL_UTILS_API_H_
  20. #define _WLAN_SPECTRAL_UTILS_API_H_
  21. #include <wlan_objmgr_cmn.h>
  22. #include <wlan_lmac_if_def.h>
  23. /* Forward declaration */
  24. struct direct_buf_rx_data;
  25. struct wmi_spectral_cmd_ops;
  26. /**
  27. * wlan_spectral_init() - API to init spectral component
  28. *
  29. * This API is invoked from dispatcher init during all component init.
  30. * This API will register all required handlers for pdev and peer object
  31. * create/delete notification.
  32. *
  33. * Return: SUCCESS,
  34. * Failure
  35. */
  36. QDF_STATUS wlan_spectral_init(void);
  37. /**
  38. * wlan_spectral_deinit() - API to deinit spectral component
  39. *
  40. * This API is invoked from dispatcher deinit during all component deinit.
  41. * This API will unregister all registered handlers for pdev and peer object
  42. * create/delete notification.
  43. *
  44. * Return: SUCCESS,
  45. * Failure
  46. */
  47. QDF_STATUS wlan_spectral_deinit(void);
  48. /**
  49. * wlan_lmac_if_sptrl_register_rx_ops() - Register lmac interface Rx operations
  50. * @rx_ops: Pointer to lmac interface Rx operations structure
  51. *
  52. * API to register spectral related lmac interface Rx operations
  53. *
  54. * Return: None
  55. */
  56. void
  57. wlan_lmac_if_sptrl_register_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops);
  58. /**
  59. * wlan_register_wmi_spectral_cmd_ops() - Register operations related to wmi
  60. * commands on spectral parameters
  61. * @pdev - the physical device object
  62. * @cmd_ops - pointer to the structure holding the operations
  63. * related to wmi commands on spectral parameters
  64. *
  65. * API to register operations related to wmi commands on spectral parameters
  66. *
  67. * Return: None
  68. */
  69. void
  70. wlan_register_wmi_spectral_cmd_ops(struct wlan_objmgr_pdev *pdev,
  71. struct wmi_spectral_cmd_ops *cmd_ops);
  72. /**
  73. * struct spectral_legacy_cbacks - Spectral legacy callbacks
  74. * @vdev_get_chan_freq: Get channel frequency
  75. * @vdev_get_ch_width: Get channel width
  76. * @vdev_get_sec20chan_freq_mhz: Get seconadry 20 frequency
  77. */
  78. struct spectral_legacy_cbacks {
  79. int16_t (*vdev_get_chan_freq)(struct wlan_objmgr_vdev *vdev);
  80. enum phy_ch_width (*vdev_get_ch_width)(struct wlan_objmgr_vdev *vdev);
  81. int (*vdev_get_sec20chan_freq_mhz)(struct wlan_objmgr_vdev *vdev,
  82. uint16_t *sec20chan_freq);
  83. };
  84. /**
  85. * spectral_vdev_get_chan_freq - Get vdev channel frequency
  86. * @vdev: vdev object
  87. *
  88. * Return: vdev operating frequency
  89. */
  90. int16_t spectral_vdev_get_chan_freq(struct wlan_objmgr_vdev *vdev);
  91. /**
  92. * spectral_vdev_get_sec20chan_freq_mhz - Get vdev secondary channel frequency
  93. * @vdev: vdev object
  94. * @sec20chan_freq: secondary channel frequency
  95. *
  96. * Return: secondary channel freq
  97. */
  98. int spectral_vdev_get_sec20chan_freq_mhz(struct wlan_objmgr_vdev *vdev,
  99. uint16_t *sec20chan_freq);
  100. /**
  101. * spectral_register_legacy_cb() - Register spectral legacy callbacks
  102. * commands on spectral parameters
  103. * @psoc - the physical device object
  104. * @legacy_cbacks - Reference to struct spectral_legacy_cbacks from which
  105. * function pointers need to be copied
  106. *
  107. * API to register spectral related legacy callbacks
  108. *
  109. * Return: QDF_STATUS_SUCCESS upon successful registration,
  110. * QDF_STATUS_E_FAILURE upon failure
  111. */
  112. QDF_STATUS spectral_register_legacy_cb(
  113. struct wlan_objmgr_psoc *psoc,
  114. struct spectral_legacy_cbacks *legacy_cbacks);
  115. /**
  116. * spectral_vdev_get_ch_width() - Get the channel bandwidth
  117. * @vdev - Pointer to vdev
  118. *
  119. * API to get the channel bandwidth of a given vdev
  120. *
  121. * Return: Enumeration corresponding to the channel bandwidth
  122. */
  123. enum phy_ch_width
  124. spectral_vdev_get_ch_width(struct wlan_objmgr_vdev *vdev);
  125. /**
  126. * spectral_pdev_open() - Spectral pdev open handler
  127. * @pdev: pointer to pdev object
  128. *
  129. * API to execute operations on pdev open
  130. *
  131. * Return: QDF_STATUS_SUCCESS upon successful registration,
  132. * QDF_STATUS_E_FAILURE upon failure
  133. */
  134. QDF_STATUS spectral_pdev_open(struct wlan_objmgr_pdev *pdev);
  135. #ifdef DIRECT_BUF_RX_ENABLE
  136. /**
  137. * spectral_dbr_event_handler() - Spectral dbr event handler
  138. * @pdev: pointer to pdev object
  139. * @payload: dbr event buffer
  140. *
  141. * API to handle spectral dbr event
  142. *
  143. * Return: status
  144. */
  145. int spectral_dbr_event_handler(struct wlan_objmgr_pdev *pdev,
  146. struct direct_buf_rx_data *payload);
  147. #endif
  148. #endif /* _WLAN_SPECTRAL_UTILS_API_H_*/