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