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