xref: /wlan-dirver/qca-wifi-host-cmn/wmi/src/wmi_unified_dcs_api.c (revision a86b23ee68a2491aede2e03991f3fb37046f4e41)
1 /*
2  * Copyright (c) 2020, The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 /**
18  * DOC: Implement API's specific to DCS component.
19  */
20 #include <wmi_unified_dcs_api.h>
21 
22 QDF_STATUS wmi_extract_dcs_interference_type(
23 		void *wmi_hdl,
24 		void *evt_buf,
25 		struct wlan_host_dcs_interference_param *param)
26 {
27 	wmi_unified_t wmi = (wmi_unified_t)wmi_hdl;
28 
29 	if (wmi->ops->extract_dcs_interference_type) {
30 		return wmi->ops->extract_dcs_interference_type(wmi,
31 							       evt_buf,
32 							       param);
33 	}
34 	return QDF_STATUS_E_FAILURE;
35 }
36 
37 QDF_STATUS wmi_extract_dcs_im_tgt_stats(
38 		void *wmi_hdl,
39 		void *evt_buf,
40 		struct wlan_host_dcs_im_tgt_stats *wlan_stat)
41 {
42 	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
43 
44 	if (wmi_handle->ops->extract_dcs_im_tgt_stats) {
45 		return wmi_handle->ops->extract_dcs_im_tgt_stats(wmi_handle,
46 								 evt_buf,
47 								 wlan_stat);
48 	}
49 	return QDF_STATUS_E_FAILURE;
50 }
51 
52 #ifdef ENABLE_HOST_TO_TARGET_CONVERSION
53 QDF_STATUS wmi_send_dcs_pdev_param(wmi_unified_t wmi_handle,
54 				   uint32_t pdev_idx,
55 				   bool is_host_pdev_id,
56 				   uint32_t dcs_enable)
57 {
58 	struct pdev_params pparam;
59 
60 	qdf_mem_zero(&pparam, sizeof(pparam));
61 	pparam.is_host_pdev_id = is_host_pdev_id;
62 	pparam.param_id = wmi_pdev_param_dcs;
63 	pparam.param_value = dcs_enable;
64 
65 	return wmi_unified_pdev_param_send(wmi_handle, &pparam, pdev_idx);
66 }
67 #else
68 QDF_STATUS wmi_send_dcs_pdev_param(wmi_unified_t wmi_handle,
69 				   uint32_t pdev_idx,
70 				   bool is_host_pdev_id,
71 				   uint32_t dcs_enable)
72 {
73 	struct pdev_params pparam;
74 
75 	qdf_mem_zero(&pparam, sizeof(pparam));
76 	pparam.is_host_pdev_id = is_host_pdev_id;
77 	pparam.param_id = WMI_PDEV_PARAM_DCS;
78 	pparam.param_value = dcs_enable;
79 
80 	return wmi_unified_pdev_param_send(wmi_handle, &pparam, pdev_idx);
81 }
82 #endif
83