xref: /wlan-dirver/qca-wifi-host-cmn/wmi/src/wmi_unified_p2p_api.c (revision 27d564647e9b50e713c60b0d7e5ea2a9b0a3ae74)
1 /*
2  * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 /**
19  * DOC: Implement API's specific to P2P component.
20  */
21 
22 #include <wmi_unified_priv.h>
23 #include <wmi_unified_p2p_api.h>
24 
25 QDF_STATUS wmi_unified_set_p2pgo_oppps_req(void *wmi_hdl,
26 					   struct p2p_ps_params *oppps)
27 {
28 	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
29 
30 	if (wmi_handle->ops->send_set_p2pgo_oppps_req_cmd)
31 		return wmi_handle->ops->send_set_p2pgo_oppps_req_cmd(wmi_handle,
32 								     oppps);
33 
34 	return QDF_STATUS_E_FAILURE;
35 }
36 
37 QDF_STATUS wmi_unified_set_p2pgo_noa_req_cmd(void *wmi_hdl,
38 					     struct p2p_ps_params *noa)
39 {
40 	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
41 
42 	if (wmi_handle->ops->send_set_p2pgo_noa_req_cmd)
43 		return wmi_handle->ops->send_set_p2pgo_noa_req_cmd(wmi_handle,
44 								   noa);
45 
46 	return QDF_STATUS_E_FAILURE;
47 }
48 
49 QDF_STATUS wmi_extract_p2p_noa_ev_param(void *wmi_hdl, void *evt_buf,
50 					struct p2p_noa_info *param)
51 {
52 	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
53 
54 	if (!wmi_handle) {
55 		WMI_LOGE("wmi handle is null");
56 		return QDF_STATUS_E_INVAL;
57 	}
58 
59 	if (wmi_handle->ops->extract_p2p_noa_ev_param)
60 		return wmi_handle->ops->extract_p2p_noa_ev_param(
61 				wmi_handle, evt_buf, param);
62 
63 	return QDF_STATUS_E_FAILURE;
64 }
65 
66 #ifdef FEATURE_P2P_LISTEN_OFFLOAD
67 QDF_STATUS wmi_unified_p2p_lo_start_cmd(void *wmi_hdl,
68 					struct p2p_lo_start *param)
69 {
70 	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
71 
72 	if (!wmi_handle) {
73 		WMI_LOGE("wmi handle is null");
74 		return QDF_STATUS_E_INVAL;
75 	}
76 
77 	if (wmi_handle->ops->send_p2p_lo_start_cmd)
78 		return wmi_handle->ops->send_p2p_lo_start_cmd(wmi_handle,
79 							      param);
80 
81 	return QDF_STATUS_E_FAILURE;
82 }
83 
84 QDF_STATUS wmi_unified_p2p_lo_stop_cmd(void *wmi_hdl, uint8_t vdev_id)
85 {
86 	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
87 
88 	if (!wmi_handle) {
89 		WMI_LOGE("wmi handle is null");
90 		return QDF_STATUS_E_INVAL;
91 	}
92 
93 	if (wmi_handle->ops->send_p2p_lo_stop_cmd)
94 		return wmi_handle->ops->send_p2p_lo_stop_cmd(wmi_handle,
95 							     vdev_id);
96 
97 	return QDF_STATUS_E_FAILURE;
98 }
99 
100 QDF_STATUS wmi_extract_p2p_lo_stop_ev_param(void *wmi_hdl, void *evt_buf,
101 					    struct p2p_lo_event *param)
102 {
103 	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
104 
105 	if (!wmi_handle) {
106 		WMI_LOGE("wmi handle is null");
107 		return QDF_STATUS_E_INVAL;
108 	}
109 
110 	if (wmi_handle->ops->extract_p2p_lo_stop_ev_param)
111 		return wmi_handle->ops->extract_p2p_lo_stop_ev_param(
112 				wmi_handle, evt_buf, param);
113 
114 	return QDF_STATUS_E_FAILURE;
115 }
116 #endif /* End of FEATURE_P2P_LISTEN_OFFLOAD*/
117 
118