wlan_spectral_tgt_api.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. /*
  2. * Copyright (c) 2011,2017-2020 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 <wlan_spectral_tgt_api.h>
  20. #include <wlan_spectral_utils_api.h>
  21. #include <target_type.h>
  22. #ifdef DIRECT_BUF_RX_ENABLE
  23. #include <target_if_direct_buf_rx_api.h>
  24. #define DBR_EVENT_TIMEOUT_IN_MS_SPECTRAL 1
  25. #define DBR_NUM_RESP_PER_EVENT_SPECTRAL 2
  26. #endif
  27. void *
  28. tgt_get_pdev_target_handle(struct wlan_objmgr_pdev *pdev)
  29. {
  30. struct pdev_spectral *ps;
  31. if (!pdev) {
  32. spectral_err("PDEV is NULL!");
  33. return NULL;
  34. }
  35. ps = wlan_objmgr_pdev_get_comp_private_obj(pdev,
  36. WLAN_UMAC_COMP_SPECTRAL);
  37. if (!ps) {
  38. spectral_err("PDEV SPECTRAL object is NULL!");
  39. return NULL;
  40. }
  41. return ps->psptrl_target_handle;
  42. }
  43. void *
  44. tgt_get_psoc_target_handle(struct wlan_objmgr_psoc *psoc)
  45. {
  46. struct spectral_context *sc;
  47. if (!psoc) {
  48. spectral_err("psoc is NULL!");
  49. return NULL;
  50. }
  51. sc = wlan_objmgr_psoc_get_comp_private_obj(psoc,
  52. WLAN_UMAC_COMP_SPECTRAL);
  53. if (!sc) {
  54. spectral_err("psoc Spectral object is NULL!");
  55. return NULL;
  56. }
  57. return sc->psoc_target_handle;
  58. }
  59. QDF_STATUS
  60. tgt_spectral_control(
  61. struct wlan_objmgr_pdev *pdev,
  62. struct spectral_cp_request *sscan_req)
  63. {
  64. struct spectral_context *sc;
  65. if (!pdev) {
  66. spectral_err("PDEV is NULL!");
  67. return -EPERM;
  68. }
  69. sc = spectral_get_spectral_ctx_from_pdev(pdev);
  70. if (!sc) {
  71. spectral_err("spectral context is NULL!");
  72. return -EPERM;
  73. }
  74. return spectral_control_cmn(pdev, sscan_req);
  75. }
  76. void *
  77. tgt_pdev_spectral_init(struct wlan_objmgr_pdev *pdev)
  78. {
  79. struct wlan_objmgr_psoc *psoc = NULL;
  80. struct wlan_lmac_if_tx_ops *tx_ops;
  81. psoc = wlan_pdev_get_psoc(pdev);
  82. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  83. if (!tx_ops) {
  84. spectral_err("tx_ops is NULL");
  85. return NULL;
  86. }
  87. return tx_ops->sptrl_tx_ops.sptrlto_pdev_spectral_init(pdev);
  88. }
  89. void
  90. tgt_pdev_spectral_deinit(struct wlan_objmgr_pdev *pdev)
  91. {
  92. struct wlan_objmgr_psoc *psoc = NULL;
  93. struct wlan_lmac_if_tx_ops *tx_ops;
  94. psoc = wlan_pdev_get_psoc(pdev);
  95. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  96. if (!tx_ops) {
  97. spectral_err("tx_ops is NULL");
  98. return;
  99. }
  100. tx_ops->sptrl_tx_ops.sptrlto_pdev_spectral_deinit(pdev);
  101. }
  102. void *
  103. tgt_psoc_spectral_init(struct wlan_objmgr_psoc *psoc)
  104. {
  105. struct wlan_lmac_if_tx_ops *tx_ops;
  106. if (!psoc) {
  107. spectral_err("psoc is null");
  108. return NULL;
  109. }
  110. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  111. if (!tx_ops) {
  112. spectral_err("tx_ops is NULL");
  113. return NULL;
  114. }
  115. return tx_ops->sptrl_tx_ops.sptrlto_psoc_spectral_init(psoc);
  116. }
  117. void
  118. tgt_psoc_spectral_deinit(struct wlan_objmgr_psoc *psoc)
  119. {
  120. struct wlan_lmac_if_tx_ops *tx_ops;
  121. if (!psoc) {
  122. spectral_err("psoc is null");
  123. return;
  124. }
  125. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  126. if (!tx_ops) {
  127. spectral_err("tx_ops is NULL");
  128. return;
  129. }
  130. tx_ops->sptrl_tx_ops.sptrlto_psoc_spectral_deinit(psoc);
  131. }
  132. QDF_STATUS
  133. tgt_set_spectral_config(struct wlan_objmgr_pdev *pdev,
  134. const struct spectral_cp_param *param,
  135. const enum spectral_scan_mode smode,
  136. enum spectral_cp_error_code *err)
  137. {
  138. struct wlan_objmgr_psoc *psoc = NULL;
  139. struct wlan_lmac_if_tx_ops *tx_ops;
  140. psoc = wlan_pdev_get_psoc(pdev);
  141. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  142. if (!tx_ops) {
  143. spectral_err("tx_ops is NULL");
  144. return QDF_STATUS_E_FAILURE;
  145. }
  146. return tx_ops->sptrl_tx_ops.sptrlto_set_spectral_config(pdev, param,
  147. smode, err);
  148. }
  149. QDF_STATUS
  150. tgt_get_spectral_config(struct wlan_objmgr_pdev *pdev,
  151. struct spectral_config *sptrl_config,
  152. const enum spectral_scan_mode smode)
  153. {
  154. struct wlan_objmgr_psoc *psoc = NULL;
  155. struct wlan_lmac_if_tx_ops *tx_ops;
  156. psoc = wlan_pdev_get_psoc(pdev);
  157. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  158. if (!tx_ops) {
  159. spectral_err("tx_ops is NULL");
  160. return QDF_STATUS_E_FAILURE;
  161. }
  162. return tx_ops->sptrl_tx_ops.sptrlto_get_spectral_config(pdev,
  163. sptrl_config,
  164. smode);
  165. }
  166. QDF_STATUS
  167. tgt_start_spectral_scan(struct wlan_objmgr_pdev *pdev,
  168. uint8_t vdev_id,
  169. enum spectral_scan_mode smode,
  170. enum spectral_cp_error_code *err)
  171. {
  172. struct wlan_objmgr_psoc *psoc = NULL;
  173. struct wlan_lmac_if_tx_ops *tx_ops;
  174. psoc = wlan_pdev_get_psoc(pdev);
  175. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  176. if (!tx_ops) {
  177. spectral_err("tx_ops is NULL");
  178. return QDF_STATUS_E_FAILURE;
  179. }
  180. return tx_ops->sptrl_tx_ops.sptrlto_start_spectral_scan(pdev, vdev_id,
  181. smode, err);
  182. }
  183. QDF_STATUS
  184. tgt_stop_spectral_scan(struct wlan_objmgr_pdev *pdev,
  185. enum spectral_scan_mode smode,
  186. enum spectral_cp_error_code *err)
  187. {
  188. struct wlan_objmgr_psoc *psoc;
  189. struct wlan_lmac_if_tx_ops *tx_ops;
  190. psoc = wlan_pdev_get_psoc(pdev);
  191. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  192. if (!tx_ops) {
  193. spectral_err("tx_ops is NULL");
  194. return QDF_STATUS_E_FAILURE;
  195. }
  196. return tx_ops->sptrl_tx_ops.sptrlto_stop_spectral_scan(pdev, smode,
  197. err);
  198. }
  199. bool
  200. tgt_is_spectral_active(struct wlan_objmgr_pdev *pdev,
  201. enum spectral_scan_mode smode)
  202. {
  203. struct wlan_objmgr_psoc *psoc = NULL;
  204. struct wlan_lmac_if_tx_ops *tx_ops;
  205. psoc = wlan_pdev_get_psoc(pdev);
  206. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  207. if (!tx_ops) {
  208. spectral_err("tx_ops is NULL");
  209. return false;
  210. }
  211. return tx_ops->sptrl_tx_ops.sptrlto_is_spectral_active(pdev, smode);
  212. }
  213. bool
  214. tgt_is_spectral_enabled(struct wlan_objmgr_pdev *pdev,
  215. enum spectral_scan_mode smode)
  216. {
  217. struct wlan_objmgr_psoc *psoc = NULL;
  218. struct wlan_lmac_if_tx_ops *tx_ops;
  219. psoc = wlan_pdev_get_psoc(pdev);
  220. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  221. if (!tx_ops) {
  222. spectral_err("tx_ops is NULL");
  223. return false;
  224. }
  225. return tx_ops->sptrl_tx_ops.sptrlto_is_spectral_enabled(pdev, smode);
  226. }
  227. QDF_STATUS
  228. tgt_set_debug_level(struct wlan_objmgr_pdev *pdev, u_int32_t debug_level)
  229. {
  230. struct wlan_objmgr_psoc *psoc = NULL;
  231. struct wlan_lmac_if_tx_ops *tx_ops;
  232. psoc = wlan_pdev_get_psoc(pdev);
  233. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  234. if (!tx_ops) {
  235. spectral_err("tx_ops is NULL");
  236. return QDF_STATUS_E_FAILURE;
  237. }
  238. return tx_ops->sptrl_tx_ops.sptrlto_set_debug_level(pdev, debug_level);
  239. }
  240. u_int32_t
  241. tgt_get_debug_level(struct wlan_objmgr_pdev *pdev)
  242. {
  243. struct wlan_objmgr_psoc *psoc = NULL;
  244. struct wlan_lmac_if_tx_ops *tx_ops;
  245. psoc = wlan_pdev_get_psoc(pdev);
  246. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  247. if (!tx_ops) {
  248. spectral_err("tx_ops is NULL");
  249. return -EINVAL;
  250. }
  251. return tx_ops->sptrl_tx_ops.sptrlto_get_debug_level(pdev);
  252. }
  253. QDF_STATUS
  254. tgt_get_spectral_capinfo(struct wlan_objmgr_pdev *pdev,
  255. struct spectral_caps *scaps)
  256. {
  257. struct wlan_objmgr_psoc *psoc = NULL;
  258. struct wlan_lmac_if_tx_ops *tx_ops;
  259. psoc = wlan_pdev_get_psoc(pdev);
  260. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  261. if (!tx_ops) {
  262. spectral_err("tx_ops is NULL");
  263. return QDF_STATUS_E_FAILURE;
  264. }
  265. return tx_ops->sptrl_tx_ops.sptrlto_get_spectral_capinfo(pdev, scaps);
  266. }
  267. QDF_STATUS
  268. tgt_get_spectral_diagstats(struct wlan_objmgr_pdev *pdev,
  269. struct spectral_diag_stats *stats)
  270. {
  271. struct wlan_objmgr_psoc *psoc = NULL;
  272. struct wlan_lmac_if_tx_ops *tx_ops;
  273. psoc = wlan_pdev_get_psoc(pdev);
  274. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  275. if (!tx_ops) {
  276. spectral_err("tx_ops is NULL");
  277. return QDF_STATUS_E_FAILURE;
  278. }
  279. return tx_ops->sptrl_tx_ops.sptrlto_get_spectral_diagstats(pdev, stats);
  280. }
  281. QDF_STATUS
  282. tgt_register_spectral_wmi_ops(struct wlan_objmgr_psoc *psoc,
  283. struct spectral_wmi_ops *wmi_ops)
  284. {
  285. struct wlan_lmac_if_sptrl_tx_ops *psptrl_tx_ops = NULL;
  286. struct wlan_lmac_if_tx_ops *tx_ops;
  287. if (!psoc) {
  288. spectral_err("psoc is null");
  289. return QDF_STATUS_E_INVAL;
  290. }
  291. if (!wmi_ops) {
  292. spectral_err("WMI operations table is null");
  293. return QDF_STATUS_E_INVAL;
  294. }
  295. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  296. if (!tx_ops) {
  297. spectral_err("tx_ops is NULL");
  298. return QDF_STATUS_E_INVAL;
  299. }
  300. psptrl_tx_ops = &tx_ops->sptrl_tx_ops;
  301. return psptrl_tx_ops->sptrlto_register_spectral_wmi_ops(psoc, wmi_ops);
  302. }
  303. QDF_STATUS
  304. tgt_register_spectral_tgt_ops(struct wlan_objmgr_psoc *psoc,
  305. struct spectral_tgt_ops *tgt_ops)
  306. {
  307. struct wlan_lmac_if_sptrl_tx_ops *psptrl_tx_ops;
  308. struct wlan_lmac_if_tx_ops *tx_ops;
  309. if (!psoc) {
  310. spectral_err("psoc is null");
  311. return QDF_STATUS_E_INVAL;
  312. }
  313. if (!tgt_ops) {
  314. spectral_err("Target operations table is null");
  315. return QDF_STATUS_E_INVAL;
  316. }
  317. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  318. if (!tx_ops) {
  319. spectral_err("tx_ops is NULL");
  320. return QDF_STATUS_E_INVAL;
  321. }
  322. psptrl_tx_ops = &tx_ops->sptrl_tx_ops;
  323. return psptrl_tx_ops->sptrlto_register_spectral_tgt_ops(psoc, tgt_ops);
  324. }
  325. void
  326. tgt_spectral_register_nl_cb(
  327. struct wlan_objmgr_pdev *pdev,
  328. struct spectral_nl_cb *nl_cb)
  329. {
  330. struct wlan_objmgr_psoc *psoc = NULL;
  331. struct wlan_lmac_if_sptrl_tx_ops *psptrl_tx_ops = NULL;
  332. struct wlan_lmac_if_tx_ops *tx_ops;
  333. if (!pdev) {
  334. spectral_err("PDEV is NULL!");
  335. return;
  336. }
  337. psoc = wlan_pdev_get_psoc(pdev);
  338. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  339. if (!tx_ops) {
  340. spectral_err("tx_ops is NULL");
  341. return;
  342. }
  343. psptrl_tx_ops = &tx_ops->sptrl_tx_ops;
  344. return psptrl_tx_ops->sptrlto_register_netlink_cb(pdev, nl_cb);
  345. }
  346. bool
  347. tgt_spectral_use_nl_bcast(struct wlan_objmgr_pdev *pdev)
  348. {
  349. struct wlan_objmgr_psoc *psoc = NULL;
  350. struct wlan_lmac_if_sptrl_tx_ops *psptrl_tx_ops = NULL;
  351. struct wlan_lmac_if_tx_ops *tx_ops;
  352. psoc = wlan_pdev_get_psoc(pdev);
  353. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  354. if (!tx_ops) {
  355. spectral_err("tx_ops is NULL");
  356. return false;
  357. }
  358. psptrl_tx_ops = &tx_ops->sptrl_tx_ops;
  359. return psptrl_tx_ops->sptrlto_use_nl_bcast(pdev);
  360. }
  361. void tgt_spectral_deregister_nl_cb(struct wlan_objmgr_pdev *pdev)
  362. {
  363. struct wlan_objmgr_psoc *psoc = NULL;
  364. struct wlan_lmac_if_sptrl_tx_ops *psptrl_tx_ops = NULL;
  365. struct wlan_lmac_if_tx_ops *tx_ops;
  366. if (!pdev) {
  367. spectral_err("PDEV is NULL!");
  368. return;
  369. }
  370. psoc = wlan_pdev_get_psoc(pdev);
  371. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  372. if (!tx_ops) {
  373. spectral_err("tx_ops is NULL");
  374. return;
  375. }
  376. psptrl_tx_ops = &tx_ops->sptrl_tx_ops;
  377. psptrl_tx_ops->sptrlto_deregister_netlink_cb(pdev);
  378. }
  379. int
  380. tgt_spectral_process_report(struct wlan_objmgr_pdev *pdev,
  381. void *payload)
  382. {
  383. struct wlan_objmgr_psoc *psoc = NULL;
  384. struct wlan_lmac_if_sptrl_tx_ops *psptrl_tx_ops = NULL;
  385. struct wlan_lmac_if_tx_ops *tx_ops;
  386. psoc = wlan_pdev_get_psoc(pdev);
  387. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  388. if (!tx_ops) {
  389. spectral_err("tx_ops is NULL");
  390. return -EINVAL;
  391. }
  392. psptrl_tx_ops = &tx_ops->sptrl_tx_ops;
  393. return psptrl_tx_ops->sptrlto_process_spectral_report(pdev, payload);
  394. }
  395. uint32_t
  396. tgt_spectral_get_target_type(struct wlan_objmgr_psoc *psoc)
  397. {
  398. uint32_t target_type = 0;
  399. struct wlan_lmac_if_target_tx_ops *target_type_tx_ops;
  400. struct wlan_lmac_if_tx_ops *tx_ops;
  401. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  402. if (!tx_ops) {
  403. spectral_err("tx_ops is NULL");
  404. return target_type;
  405. }
  406. target_type_tx_ops = &tx_ops->target_tx_ops;
  407. if (target_type_tx_ops->tgt_get_tgt_type)
  408. target_type = target_type_tx_ops->tgt_get_tgt_type(psoc);
  409. return target_type;
  410. }
  411. #ifdef DIRECT_BUF_RX_ENABLE
  412. QDF_STATUS
  413. tgt_spectral_register_to_dbr(struct wlan_objmgr_pdev *pdev)
  414. {
  415. struct wlan_objmgr_psoc *psoc;
  416. struct wlan_lmac_if_direct_buf_rx_tx_ops *dbr_tx_ops = NULL;
  417. struct wlan_lmac_if_sptrl_tx_ops *sptrl_tx_ops = NULL;
  418. struct dbr_module_config dbr_config = {0};
  419. struct wlan_lmac_if_tx_ops *tx_ops;
  420. psoc = wlan_pdev_get_psoc(pdev);
  421. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  422. if (!tx_ops) {
  423. spectral_err("tx_ops is NULL");
  424. return QDF_STATUS_E_FAILURE;
  425. }
  426. dbr_tx_ops = &tx_ops->dbr_tx_ops;
  427. sptrl_tx_ops = &tx_ops->sptrl_tx_ops;
  428. dbr_config.num_resp_per_event = DBR_NUM_RESP_PER_EVENT_SPECTRAL;
  429. dbr_config.event_timeout_in_ms = DBR_EVENT_TIMEOUT_IN_MS_SPECTRAL;
  430. if ((sptrl_tx_ops->sptrlto_direct_dma_support) &&
  431. (sptrl_tx_ops->sptrlto_direct_dma_support(pdev))) {
  432. if (sptrl_tx_ops->sptrlto_check_and_do_dbr_buff_debug)
  433. sptrl_tx_ops->sptrlto_check_and_do_dbr_buff_debug(pdev);
  434. if (dbr_tx_ops->direct_buf_rx_module_register)
  435. dbr_tx_ops->direct_buf_rx_module_register
  436. (pdev, 0, &dbr_config,
  437. spectral_dbr_event_handler);
  438. if (sptrl_tx_ops->sptrlto_check_and_do_dbr_ring_debug)
  439. sptrl_tx_ops->sptrlto_check_and_do_dbr_ring_debug(pdev);
  440. }
  441. return QDF_STATUS_SUCCESS;
  442. }
  443. QDF_STATUS
  444. tgt_spectral_unregister_to_dbr(struct wlan_objmgr_pdev *pdev)
  445. {
  446. struct wlan_objmgr_psoc *psoc;
  447. struct wlan_lmac_if_direct_buf_rx_tx_ops *dbr_tx_ops = NULL;
  448. struct wlan_lmac_if_sptrl_tx_ops *sptrl_tx_ops = NULL;
  449. struct wlan_lmac_if_tx_ops *tx_ops;
  450. psoc = wlan_pdev_get_psoc(pdev);
  451. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  452. if (!tx_ops) {
  453. spectral_err("tx_ops is NULL");
  454. return QDF_STATUS_E_FAILURE;
  455. }
  456. dbr_tx_ops = &tx_ops->dbr_tx_ops;
  457. sptrl_tx_ops = &tx_ops->sptrl_tx_ops;
  458. if ((sptrl_tx_ops->sptrlto_direct_dma_support) &&
  459. (sptrl_tx_ops->sptrlto_direct_dma_support(pdev))) {
  460. /* Stop DBR debug as the buffers itself are freed now */
  461. if (dbr_tx_ops->direct_buf_rx_stop_ring_debug)
  462. dbr_tx_ops->direct_buf_rx_stop_ring_debug(pdev, 0);
  463. /*No need to zero-out as buffers are anyway getting freed*/
  464. if (dbr_tx_ops->direct_buf_rx_stop_buffer_poisoning)
  465. dbr_tx_ops->direct_buf_rx_stop_buffer_poisoning
  466. (pdev, 0);
  467. if (dbr_tx_ops->direct_buf_rx_module_unregister)
  468. dbr_tx_ops->direct_buf_rx_module_unregister
  469. (pdev, 0);
  470. return QDF_STATUS_SUCCESS;
  471. }
  472. return QDF_STATUS_E_FAILURE;
  473. }
  474. #else
  475. QDF_STATUS
  476. tgt_spectral_register_to_dbr(struct wlan_objmgr_pdev *pdev)
  477. {
  478. return QDF_STATUS_SUCCESS;
  479. }
  480. QDF_STATUS
  481. tgt_spectral_unregister_to_dbr(struct wlan_objmgr_pdev *pdev)
  482. {
  483. return QDF_STATUS_SUCCESS;
  484. }
  485. #endif /* DIRECT_BUF_RX_ENABLE */
  486. #ifdef DIRECT_BUF_RX_DEBUG
  487. QDF_STATUS tgt_set_spectral_dma_debug(struct wlan_objmgr_pdev *pdev,
  488. enum spectral_dma_debug dma_debug_type,
  489. bool dma_debug_enable)
  490. {
  491. struct wlan_objmgr_psoc *psoc;
  492. struct wlan_lmac_if_tx_ops *tx_ops;
  493. psoc = wlan_pdev_get_psoc(pdev);
  494. if (!psoc) {
  495. spectral_err("psoc is NULL!");
  496. return QDF_STATUS_E_FAILURE;
  497. }
  498. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  499. if (!tx_ops) {
  500. spectral_err("tx_ops is NULL");
  501. return QDF_STATUS_E_FAILURE;
  502. }
  503. return tx_ops->sptrl_tx_ops.sptrlto_set_dma_debug(pdev, dma_debug_type,
  504. dma_debug_enable);
  505. }
  506. #else
  507. QDF_STATUS tgt_set_spectral_dma_debug(struct wlan_objmgr_pdev *pdev,
  508. enum spectral_dma_debug dma_debug_type,
  509. bool dma_debug_enable)
  510. {
  511. return QDF_STATUS_SUCCESS;
  512. }
  513. #endif
  514. QDF_STATUS
  515. tgt_spectral_register_events(struct wlan_objmgr_psoc *psoc)
  516. {
  517. struct wlan_lmac_if_tx_ops *tx_ops;
  518. struct wlan_lmac_if_sptrl_tx_ops *psptrl_tx_ops;
  519. if (!psoc) {
  520. spectral_err("psoc is null");
  521. return QDF_STATUS_E_INVAL;
  522. }
  523. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  524. if (!tx_ops) {
  525. spectral_err("tx_ops is NULL");
  526. return QDF_STATUS_E_INVAL;
  527. }
  528. psptrl_tx_ops = &tx_ops->sptrl_tx_ops;
  529. return psptrl_tx_ops->sptrlto_register_events(psoc);
  530. }
  531. QDF_STATUS
  532. tgt_spectral_unregister_events(struct wlan_objmgr_psoc *psoc)
  533. {
  534. struct wlan_lmac_if_tx_ops *tx_ops;
  535. struct wlan_lmac_if_sptrl_tx_ops *psptrl_tx_ops;
  536. if (!psoc) {
  537. spectral_err("psoc is null");
  538. return QDF_STATUS_E_INVAL;
  539. }
  540. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  541. if (!tx_ops) {
  542. spectral_err("tx_ops is NULL");
  543. return QDF_STATUS_E_INVAL;
  544. }
  545. psptrl_tx_ops = &tx_ops->sptrl_tx_ops;
  546. return psptrl_tx_ops->sptrlto_unregister_events(psoc);
  547. }
  548. QDF_STATUS
  549. tgt_spectral_init_pdev_feature_caps(struct wlan_objmgr_pdev *pdev)
  550. {
  551. struct wlan_lmac_if_sptrl_tx_ops *spectral_tx_ops;
  552. if (!pdev) {
  553. spectral_err("pdev is NULL!");
  554. return QDF_STATUS_E_INVAL;
  555. }
  556. spectral_tx_ops = wlan_spectral_pdev_get_lmac_if_txops(pdev);
  557. if (!spectral_tx_ops) {
  558. spectral_err("Spectral txops is null");
  559. return QDF_STATUS_E_FAILURE;
  560. }
  561. return spectral_tx_ops->sptrlto_init_pdev_feature_caps(pdev);
  562. }