xref: /wlan-dirver/qca-wifi-host-cmn/spectral/dispatcher/src/wlan_spectral_ucfg_api.c (revision 6ecd284e5a94a1c96e26d571dd47419ac305990d)
1 /*
2  * Copyright (c) 2017-2018 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_ucfg_api.h>
21 #include "../../core/spectral_cmn_api_i.h"
22 #include <wlan_spectral_utils_api.h>
23 #include <qdf_module.h>
24 
25 int
26 ucfg_spectral_control(struct wlan_objmgr_pdev *pdev,
27 		      u_int id,
28 		      void *indata,
29 		      uint32_t insize, void *outdata, uint32_t *outsize)
30 {
31 	struct spectral_context *sc;
32 
33 	if (!pdev) {
34 		spectral_err("PDEV is NULL!");
35 		return -EPERM;
36 	}
37 	sc = spectral_get_spectral_ctx_from_pdev(pdev);
38 	if (!sc) {
39 		spectral_err("spectral context is NULL!");
40 		return -EPERM;
41 	}
42 
43 	return sc->sptrlc_spectral_control(pdev,
44 					   id,
45 					   indata, insize, outdata, outsize);
46 }
47 qdf_export_symbol(ucfg_spectral_control);
48 
49 void ucfg_spectral_scan_set_ppid(struct wlan_objmgr_pdev *pdev, uint32_t ppid)
50 {
51 	struct pdev_spectral *ps = NULL;
52 
53 	if (!pdev) {
54 		spectral_err("PDEV is NULL!");
55 		return;
56 	}
57 	ps = wlan_objmgr_pdev_get_comp_private_obj(pdev,
58 						   WLAN_UMAC_COMP_SPECTRAL);
59 	if (!ps) {
60 		spectral_err("spectral context is NULL!");
61 		return;
62 	}
63 	ps->spectral_pid = ppid;
64 	spectral_debug("spectral ppid: %d", ppid);
65 
66 	return;
67 }
68