spectral_offload.c 5.5 KB

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