wlan_spectral_utils_api.h 5.2 KB

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