xref: /wlan-dirver/qca-wifi-host-cmn/umac/dcs/dispatcher/src/wlan_dcs_tgt_api.c (revision 8cfe6b10058a04cafb17eed051f2ddf11bee8931)
1 /*
2  * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 /**
19  * DOC:wlan_dcs_tgt_api.c
20  *
21  * This file provide API definitions to update dcs from southbound interface
22  */
23 
24 #include "wlan_dcs_tgt_api.h"
25 #include "../../core/src/wlan_dcs.h"
26 
27 QDF_STATUS tgt_dcs_process_event(struct wlan_objmgr_psoc *psoc,
28 				 struct wlan_host_dcs_event *event)
29 {
30 	return wlan_dcs_process(psoc, event);
31 }
32 
33 #ifdef CONFIG_AFC_SUPPORT
34 QDF_STATUS tgt_afc_trigger_dcs(struct wlan_objmgr_pdev *pdev)
35 {
36 	struct wlan_objmgr_psoc *psoc;
37 	struct wlan_host_dcs_event *event;
38 	QDF_STATUS status;
39 
40 	psoc = wlan_pdev_get_psoc(pdev);
41 
42 	event = qdf_mem_malloc(sizeof(*event));
43 	if (!event)
44 		return QDF_STATUS_E_NOMEM;
45 
46 	event->dcs_param.interference_type = WLAN_HOST_DCS_AFC;
47 	event->dcs_param.pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
48 	status = wlan_dcs_process(psoc, event);
49 
50 	qdf_mem_free(event);
51 	return status;
52 }
53 #endif
54