xref: /wlan-driver/qca-wifi-host-cmn/spectral/core/spectral_offload.c (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 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 "spectral_cmn_api_i.h"
21 #include "spectral_ol_api_i.h"
22 #include "../dispatcher/inc/wlan_spectral_tgt_api.h"
23 
24 #ifdef DIRECT_BUF_RX_DEBUG
25 static void
spectral_ctx_init_ol_dma_debug(struct spectral_context * sc)26 spectral_ctx_init_ol_dma_debug(struct spectral_context *sc)
27 {
28 	if (!sc) {
29 		spectral_err("spectral context is null!");
30 		return;
31 	}
32 	sc->sptrlc_set_dma_debug = tgt_set_spectral_dma_debug;
33 }
34 #else
35 static void
spectral_ctx_init_ol_dma_debug(struct spectral_context * sc)36 spectral_ctx_init_ol_dma_debug(struct spectral_context *sc)
37 {
38 }
39 #endif
40 
41 void
spectral_ctx_init_ol(struct spectral_context * sc)42 spectral_ctx_init_ol(struct spectral_context *sc)
43 {
44 	if (!sc) {
45 		spectral_err("spectral context is null!");
46 		return;
47 	}
48 	sc->sptrlc_spectral_control = tgt_spectral_control;
49 	sc->sptrlc_pdev_spectral_init = tgt_pdev_spectral_init;
50 	sc->sptrlc_pdev_spectral_deinit = tgt_pdev_spectral_deinit;
51 	sc->sptrlc_psoc_spectral_init = tgt_psoc_spectral_init;
52 	sc->sptrlc_psoc_spectral_deinit = tgt_psoc_spectral_deinit;
53 	sc->sptrlc_set_spectral_config = tgt_set_spectral_config;
54 	sc->sptrlc_get_spectral_config = tgt_get_spectral_config;
55 	sc->sptrlc_start_spectral_scan = tgt_start_spectral_scan;
56 	sc->sptrlc_stop_spectral_scan = tgt_stop_spectral_scan;
57 	sc->sptrlc_is_spectral_active = tgt_is_spectral_active;
58 	sc->sptrlc_is_spectral_enabled = tgt_is_spectral_enabled;
59 	sc->sptrlc_set_debug_level = tgt_set_debug_level;
60 	sc->sptrlc_get_debug_level = tgt_get_debug_level;
61 	sc->sptrlc_get_spectral_capinfo = tgt_get_spectral_capinfo;
62 	sc->sptrlc_get_spectral_diagstats = tgt_get_spectral_diagstats;
63 	sc->sptrlc_register_spectral_wmi_ops = tgt_register_spectral_wmi_ops;
64 	sc->sptrlc_register_spectral_tgt_ops = tgt_register_spectral_tgt_ops;
65 	sc->sptrlc_register_netlink_cb = tgt_spectral_register_nl_cb;
66 	sc->sptrlc_use_nl_bcast = tgt_spectral_use_nl_bcast;
67 	sc->sptrlc_deregister_netlink_cb = tgt_spectral_deregister_nl_cb;
68 	sc->sptrlc_process_spectral_report = tgt_spectral_process_report;
69 	spectral_ctx_init_ol_dma_debug(sc);
70 }
71