xref: /wlan-driver/qca-wifi-host-cmn/wmi/src/wmi_unified_dcs_api.c (revision 5113495b16420b49004c444715d2daae2066e7dc)
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: Implement API's specific to DCS component.
20  */
21 #include <wmi_unified_dcs_api.h>
22 
wmi_extract_dcs_interference_type(void * wmi_hdl,void * evt_buf,struct wlan_host_dcs_interference_param * param)23 QDF_STATUS wmi_extract_dcs_interference_type(
24 		void *wmi_hdl,
25 		void *evt_buf,
26 		struct wlan_host_dcs_interference_param *param)
27 {
28 	wmi_unified_t wmi = (wmi_unified_t)wmi_hdl;
29 
30 	if (wmi->ops->extract_dcs_interference_type) {
31 		return wmi->ops->extract_dcs_interference_type(wmi,
32 							       evt_buf,
33 							       param);
34 	}
35 	return QDF_STATUS_E_FAILURE;
36 }
37 
wmi_extract_dcs_im_tgt_stats(void * wmi_hdl,void * evt_buf,struct wlan_host_dcs_im_tgt_stats * wlan_stat)38 QDF_STATUS wmi_extract_dcs_im_tgt_stats(
39 		void *wmi_hdl,
40 		void *evt_buf,
41 		struct wlan_host_dcs_im_tgt_stats *wlan_stat)
42 {
43 	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
44 
45 	if (wmi_handle->ops->extract_dcs_im_tgt_stats) {
46 		return wmi_handle->ops->extract_dcs_im_tgt_stats(wmi_handle,
47 								 evt_buf,
48 								 wlan_stat);
49 	}
50 	return QDF_STATUS_E_FAILURE;
51 }
52 
wmi_extract_dcs_awgn_info(wmi_unified_t wmi_hdl,void * evt_buf,struct wlan_host_dcs_awgn_info * awgn_info)53 QDF_STATUS wmi_extract_dcs_awgn_info(wmi_unified_t wmi_hdl, void *evt_buf,
54 				     struct wlan_host_dcs_awgn_info *awgn_info)
55 {
56 	if (wmi_hdl && wmi_hdl->ops->extract_dcs_awgn_info)
57 		return wmi_hdl->ops->extract_dcs_awgn_info(wmi_hdl, evt_buf,
58 							   awgn_info);
59 
60 	return QDF_STATUS_E_FAILURE;
61 }
62 
wmi_send_dcs_pdev_param(wmi_unified_t wmi_handle,uint32_t pdev_idx,bool is_host_pdev_id,uint32_t dcs_enable)63 QDF_STATUS wmi_send_dcs_pdev_param(wmi_unified_t wmi_handle,
64 				   uint32_t pdev_idx,
65 				   bool is_host_pdev_id,
66 				   uint32_t dcs_enable)
67 {
68 	struct pdev_params pparam;
69 
70 	qdf_mem_zero(&pparam, sizeof(pparam));
71 	pparam.is_host_pdev_id = is_host_pdev_id;
72 	pparam.param_id = wmi_pdev_param_dcs;
73 	pparam.param_value = dcs_enable;
74 
75 	return wmi_unified_pdev_param_send(wmi_handle, &pparam, pdev_idx);
76 }
77