target_if_cfr.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. /*
  2. * Copyright (c) 2019-2021 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. #ifndef _TARGET_IF_CFR_H_
  19. #define _TARGET_IF_CFR_H_
  20. #include <wlan_objmgr_cmn.h>
  21. #include <wlan_objmgr_psoc_obj.h>
  22. #include <wlan_objmgr_pdev_obj.h>
  23. #include <wlan_objmgr_vdev_obj.h>
  24. #include <wlan_objmgr_peer_obj.h>
  25. #include "wmi_unified_cfr_api.h"
  26. #include "wmi_unified_param.h"
  27. #include "wmi_unified_cfr_param.h"
  28. #define PEER_CFR_CAPTURE_ENABLE 1
  29. #define PEER_CFR_CAPTURE_DISABLE 0
  30. #define PEER_CFR_CAPTURE_EVT_STATUS_MASK 0x80000000
  31. #define PEER_CFR_CAPTURE_EVT_PS_STATUS_MASK 0x40000000
  32. #define CFR_TX_EVT_STATUS_MASK 0x00000003
  33. /* Status codes used by correlate and relay function */
  34. #define STATUS_STREAM_AND_RELEASE 0
  35. #define STATUS_HOLD 1
  36. #define STATUS_ERROR -1
  37. /* Module IDs using corrlation function */
  38. #define CORRELATE_DBR_MODULE_ID 0
  39. /*
  40. * HKV2 - Tx completion event for one-shot capture
  41. * Cypress - Tx completion event for one-shot capture (or) RXTLV event for RCC
  42. */
  43. #define CORRELATE_TX_EV_MODULE_ID 1
  44. #define get_u16_lsb(value) (uint16_t)(value)
  45. #define get_u16_msb(value) (uint16_t)(((uint32_t)value) >> 16)
  46. #define get_gain_db(value) ((value) & 0xFF)
  47. #define get_gain_table_idx(value) (((value) >> 8) & 0x3)
  48. #define INVALID_PHASE_DELTA 0xFFFF
  49. /**
  50. * target_if_cfr_init_pdev() - Inits cfr pdev and registers necessary handlers.
  51. * @psoc: pointer to psoc object
  52. * @pdev: pointer to pdev object
  53. *
  54. * Return: Registration status for necessary handlers
  55. */
  56. QDF_STATUS
  57. target_if_cfr_init_pdev(struct wlan_objmgr_psoc *psoc,
  58. struct wlan_objmgr_pdev *pdev);
  59. /**
  60. * target_if_cfr_deinit_pdev() - De-inits corresponding pdev and handlers.
  61. * @psoc: pointer to psoc object
  62. * @pdev: pointer to pdev object
  63. *
  64. * Return: De-registration status for necessary handlers
  65. */
  66. QDF_STATUS
  67. target_if_cfr_deinit_pdev(struct wlan_objmgr_psoc *psoc,
  68. struct wlan_objmgr_pdev *pdev);
  69. /**
  70. * target_if_cfr_tx_ops_register() - Registers tx ops for cfr module
  71. * @tx_ops - pointer to tx_ops structure.
  72. */
  73. void target_if_cfr_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops);
  74. /**
  75. * target_if_cfr_enable_cfr_timer() - Enables cfr timer
  76. * @pdev: pointer to pdev object
  77. * @cfr_timer: Amount of time this timer has to run
  78. *
  79. * Return: status of timer
  80. */
  81. int target_if_cfr_enable_cfr_timer(struct wlan_objmgr_pdev *pdev,
  82. uint32_t cfr_timer);
  83. /**
  84. * target_if_cfr_pdev_set_param() - Function to set params for cfr config
  85. * @pdev: pointer to pdev object
  86. * @param_value: value of param being set
  87. *
  88. * Return: success/failure of setting param
  89. */
  90. int target_if_cfr_periodic_peer_cfr_enable(struct wlan_objmgr_pdev *pdev,
  91. uint32_t param_value);
  92. /**
  93. * target_if_cfr_start_capture() - Function to start cfr capture for a peer
  94. * @pdev: pointer to pdev object
  95. * @peer: pointer to peer object
  96. * @cfr_params: capture parameters for this peer
  97. *
  98. * Return: success/failure status of start capture
  99. */
  100. int target_if_cfr_start_capture(struct wlan_objmgr_pdev *pdev,
  101. struct wlan_objmgr_peer *peer,
  102. struct cfr_capture_params *cfr_params);
  103. /**
  104. * target_if_cfr_stop_capture() - Function to stop cfr capture for a peer
  105. * @pdev: pointer to pdev object
  106. * @peer: pointer to peer object
  107. *
  108. * Return: success/failure status of stop capture
  109. */
  110. int target_if_cfr_stop_capture(struct wlan_objmgr_pdev *pdev,
  111. struct wlan_objmgr_peer *peer);
  112. /**
  113. * target_if_cfr_get_target_type() - Function to get target type
  114. * @psoc: pointer to psoc object
  115. *
  116. * Return: target type of target
  117. */
  118. int target_if_cfr_get_target_type(struct wlan_objmgr_psoc *psoc);
  119. /**
  120. * target_if_cfr_set_cfr_support() - Function to set cfr support
  121. * @psoc: pointer to psoc object
  122. * @value: value to be set
  123. */
  124. void target_if_cfr_set_cfr_support(struct wlan_objmgr_psoc *psoc,
  125. uint8_t value);
  126. /**
  127. * target_if_cfr_set_capture_count_support() - Function to set capture count
  128. * support.
  129. * @psoc: pointer to psoc object
  130. * @value: value to be set
  131. *
  132. * Return: success/failure
  133. */
  134. QDF_STATUS
  135. target_if_cfr_set_capture_count_support(struct wlan_objmgr_psoc *psoc,
  136. uint8_t value);
  137. /**
  138. * target_if_cfr_set_mo_marking_support() - Function to set MO marking support
  139. * @psoc: pointer to psoc object
  140. * @value: value to be set
  141. *
  142. * Return: success/failure
  143. */
  144. QDF_STATUS
  145. target_if_cfr_set_mo_marking_support(struct wlan_objmgr_psoc *psoc,
  146. uint8_t value);
  147. /**
  148. * target_if_cfr_set_aoa_for_rcc_support() - Function to set AoA for RCC
  149. * @psoc: pointer to psoc object
  150. * @value: value to be set
  151. *
  152. * Return: success/failure
  153. */
  154. QDF_STATUS
  155. target_if_cfr_set_aoa_for_rcc_support(struct wlan_objmgr_psoc *psoc,
  156. uint8_t value);
  157. /**
  158. * target_if_cfr_info_send() - Function to send cfr info to upper layers
  159. * @pdev: pointer to pdev object
  160. * @head: pointer to cfr info head
  161. * @hlen: head len
  162. * @data: pointer to cfr info data
  163. * @dlen: data len
  164. * @tail: pointer to cfr info tail
  165. * @tlen: tail len
  166. */
  167. void target_if_cfr_info_send(struct wlan_objmgr_pdev *pdev, void *head,
  168. size_t hlen, void *data, size_t dlen, void *tail,
  169. size_t tlen);
  170. /**
  171. * target_if_cfr_fill_header() - Function to fill cfr header cmn section
  172. * @hdr: pointer to the csi_cfr_header
  173. * @is_wifi_2_0: flag to indicate legacy and non legacy radio
  174. * @target_type: target type of the radio
  175. * @is_rcc: flag to denote fill header request from periodic cfr/rcc
  176. */
  177. void target_if_cfr_fill_header(struct csi_cfr_header *hdr,
  178. bool is_wifi_2_0,
  179. uint32_t target_type,
  180. bool is_rcc);
  181. #ifdef WIFI_TARGET_TYPE_2_0
  182. /**
  183. * cfr_wifi2_0_init_pdev() - Function to init legacy pdev
  184. * @psoc: pointer to psoc object
  185. * @pdev: pointer to pdev object
  186. *
  187. * Return: success/failure status of init
  188. */
  189. QDF_STATUS cfr_wifi2_0_init_pdev(struct wlan_objmgr_psoc *psoc,
  190. struct wlan_objmgr_pdev *pdev);
  191. /**
  192. * cfr_wifi2_0_deinit_pdev() - Function to deinit legacy pdev
  193. * @psoc: pointer to psoc object
  194. * @pdev: pointer to pdev object
  195. *
  196. * Return: success/failure status of deinit
  197. */
  198. QDF_STATUS cfr_wifi2_0_deinit_pdev(struct wlan_objmgr_psoc *psoc,
  199. struct wlan_objmgr_pdev *pdev);
  200. #else
  201. #ifndef CFR_USE_FIXED_FOLDER
  202. static QDF_STATUS cfr_wifi2_0_init_pdev(struct wlan_objmgr_psoc *psoc,
  203. struct wlan_objmgr_pdev *pdev)
  204. {
  205. return QDF_STATUS_SUCCESS;
  206. }
  207. static QDF_STATUS cfr_wifi2_0_deinit_pdev(struct wlan_objmgr_psoc *psoc,
  208. struct wlan_objmgr_pdev *pdev)
  209. {
  210. return QDF_STATUS_SUCCESS;
  211. }
  212. #endif
  213. #endif
  214. #endif