spectral_offload.c 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /*
  2. * Copyright (c) 2017 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. #include "spectral_cmn_api_i.h"
  20. #include "spectral_ol_api_i.h"
  21. int spectral_control_ol(
  22. struct wlan_objmgr_pdev *pdev,
  23. u_int id,
  24. void *indata,
  25. u_int32_t insize,
  26. void *outdata, u_int32_t *outsize)
  27. {
  28. struct spectral_context *sc;
  29. if (!pdev) {
  30. spectral_err("PDEV is NULL!\n");
  31. return -EPERM;
  32. }
  33. sc = spectral_get_spectral_ctx_from_pdev(pdev);
  34. if (!sc) {
  35. spectral_err("spectral context is NULL!\n");
  36. return -EPERM;
  37. }
  38. return spectral_control_cmn(pdev, id, indata, insize, outdata, outsize);
  39. }
  40. static void *pdev_spectral_init_ol(struct wlan_objmgr_pdev *pdev)
  41. {
  42. struct wlan_objmgr_psoc *psoc = NULL;
  43. psoc = wlan_pdev_get_psoc(pdev);
  44. return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_pdev_spectral_init(
  45. pdev);
  46. }
  47. static void pdev_spectral_deinit_ol(struct wlan_objmgr_pdev *pdev)
  48. {
  49. struct wlan_objmgr_psoc *psoc = NULL;
  50. psoc = wlan_pdev_get_psoc(pdev);
  51. psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_pdev_spectral_deinit(pdev);
  52. }
  53. static int set_spectral_config_ol(
  54. struct wlan_objmgr_pdev *pdev,
  55. const u_int32_t threshtype, const u_int32_t value)
  56. {
  57. struct wlan_objmgr_psoc *psoc = NULL;
  58. psoc = wlan_pdev_get_psoc(pdev);
  59. return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_set_spectral_config(
  60. pdev,
  61. threshtype, value);
  62. }
  63. static void get_spectral_config_ol(struct wlan_objmgr_pdev *pdev,
  64. struct spectral_config *sptrl_config)
  65. {
  66. struct wlan_objmgr_psoc *psoc = NULL;
  67. psoc = wlan_pdev_get_psoc(pdev);
  68. psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_get_spectral_config(pdev,
  69. sptrl_config);
  70. }
  71. static int start_spectral_scan_ol(struct wlan_objmgr_pdev *pdev)
  72. {
  73. struct wlan_objmgr_psoc *psoc = NULL;
  74. psoc = wlan_pdev_get_psoc(pdev);
  75. return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_start_spectral_scan(
  76. pdev);
  77. }
  78. static void stop_spectral_scan_ol(struct wlan_objmgr_pdev *pdev)
  79. {
  80. struct wlan_objmgr_psoc *psoc = NULL;
  81. psoc = wlan_pdev_get_psoc(pdev);
  82. psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_stop_spectral_scan(pdev);
  83. }
  84. static bool is_spectral_active_ol(struct wlan_objmgr_pdev *pdev)
  85. {
  86. struct wlan_objmgr_psoc *psoc = NULL;
  87. psoc = wlan_pdev_get_psoc(pdev);
  88. return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_is_spectral_active(
  89. pdev);
  90. }
  91. static bool is_spectral_enabled_ol(struct wlan_objmgr_pdev *pdev)
  92. {
  93. struct wlan_objmgr_psoc *psoc = NULL;
  94. psoc = wlan_pdev_get_psoc(pdev);
  95. return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_is_spectral_enabled(
  96. pdev);
  97. }
  98. static int set_debug_level_ol(struct wlan_objmgr_pdev *pdev,
  99. u_int32_t debug_level)
  100. {
  101. struct wlan_objmgr_psoc *psoc = NULL;
  102. psoc = wlan_pdev_get_psoc(pdev);
  103. return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_set_debug_level(pdev,
  104. debug_level);
  105. }
  106. static u_int32_t get_debug_level_ol(struct wlan_objmgr_pdev *pdev)
  107. {
  108. struct wlan_objmgr_psoc *psoc = NULL;
  109. psoc = wlan_pdev_get_psoc(pdev);
  110. return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_get_debug_level(pdev);
  111. }
  112. static void get_spectral_capinfo_ol(struct wlan_objmgr_pdev *pdev,
  113. void *outdata)
  114. {
  115. struct wlan_objmgr_psoc *psoc = NULL;
  116. psoc = wlan_pdev_get_psoc(pdev);
  117. return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_get_spectral_capinfo(
  118. pdev,
  119. outdata);
  120. }
  121. static void get_spectral_diagstats_ol(struct wlan_objmgr_pdev *pdev,
  122. void *outdata)
  123. {
  124. struct wlan_objmgr_psoc *psoc = NULL;
  125. psoc = wlan_pdev_get_psoc(pdev);
  126. return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_get_spectral_diagstats(
  127. pdev,
  128. outdata);
  129. }
  130. static void register_wmi_spectral_cmd_ops_ol(
  131. struct wlan_objmgr_pdev *pdev,
  132. struct wmi_spectral_cmd_ops *cmd_ops)
  133. {
  134. struct wlan_objmgr_psoc *psoc = NULL;
  135. struct wlan_lmac_if_sptrl_tx_ops *psptrl_tx_ops = NULL;
  136. psoc = wlan_pdev_get_psoc(pdev);
  137. psptrl_tx_ops = &psoc->soc_cb.tx_ops.sptrl_tx_ops;
  138. return psptrl_tx_ops->sptrlto_register_wmi_spectral_cmd_ops(
  139. pdev,
  140. cmd_ops);
  141. }
  142. void spectral_ctx_init_ol(struct spectral_context *sc)
  143. {
  144. if (!sc) {
  145. spectral_err("spectral context is null!\n");
  146. return;
  147. }
  148. sc->sptrlc_spectral_control = spectral_control_ol;
  149. sc->sptrlc_pdev_spectral_init = pdev_spectral_init_ol;
  150. sc->sptrlc_pdev_spectral_deinit = pdev_spectral_deinit_ol;
  151. sc->sptrlc_set_spectral_config = set_spectral_config_ol;
  152. sc->sptrlc_get_spectral_config = get_spectral_config_ol;
  153. sc->sptrlc_start_spectral_scan = start_spectral_scan_ol;
  154. sc->sptrlc_stop_spectral_scan = stop_spectral_scan_ol;
  155. sc->sptrlc_is_spectral_active = is_spectral_active_ol;
  156. sc->sptrlc_is_spectral_enabled = is_spectral_enabled_ol;
  157. sc->sptrlc_set_debug_level = set_debug_level_ol;
  158. sc->sptrlc_get_debug_level = get_debug_level_ol;
  159. sc->sptrlc_get_spectral_capinfo = get_spectral_capinfo_ol;
  160. sc->sptrlc_get_spectral_diagstats = get_spectral_diagstats_ol;
  161. sc->sptrlc_register_wmi_spectral_cmd_ops =
  162. register_wmi_spectral_cmd_ops_ol;
  163. }