1 /*
2  * Copyright (c) 2013-2020 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
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  * DOC: Implement API's specific to P2P component.
21  */
22 
23 #include <wmi_unified_priv.h>
24 #include <wmi_unified_p2p_api.h>
25 
wmi_unified_set_p2pgo_oppps_req(wmi_unified_t wmi_handle,struct p2p_ps_params * oppps)26 QDF_STATUS wmi_unified_set_p2pgo_oppps_req(wmi_unified_t wmi_handle,
27 					   struct p2p_ps_params *oppps)
28 {
29 	if (wmi_handle->ops->send_set_p2pgo_oppps_req_cmd)
30 		return wmi_handle->ops->send_set_p2pgo_oppps_req_cmd(wmi_handle,
31 								     oppps);
32 
33 	return QDF_STATUS_E_FAILURE;
34 }
35 
wmi_unified_set_p2pgo_noa_req_cmd(wmi_unified_t wmi_handle,struct p2p_ps_params * noa)36 QDF_STATUS wmi_unified_set_p2pgo_noa_req_cmd(wmi_unified_t wmi_handle,
37 					     struct p2p_ps_params *noa)
38 {
39 	if (wmi_handle->ops->send_set_p2pgo_noa_req_cmd)
40 		return wmi_handle->ops->send_set_p2pgo_noa_req_cmd(wmi_handle,
41 								   noa);
42 
43 	return QDF_STATUS_E_FAILURE;
44 }
45 
wmi_extract_p2p_noa_ev_param(wmi_unified_t wmi_handle,void * evt_buf,struct p2p_noa_info * param)46 QDF_STATUS wmi_extract_p2p_noa_ev_param(wmi_unified_t wmi_handle,
47 					void *evt_buf,
48 					struct p2p_noa_info *param)
49 {
50 	if (!wmi_handle) {
51 		wmi_err("wmi handle is null");
52 		return QDF_STATUS_E_INVAL;
53 	}
54 
55 	if (wmi_handle->ops->extract_p2p_noa_ev_param)
56 		return wmi_handle->ops->extract_p2p_noa_ev_param(
57 				wmi_handle, evt_buf, param);
58 
59 	return QDF_STATUS_E_FAILURE;
60 }
61 
62 QDF_STATUS
wmi_extract_mac_addr_rx_filter_evt_param(wmi_unified_t wmi_handle,void * evt_buf,struct p2p_set_mac_filter_evt * param)63 wmi_extract_mac_addr_rx_filter_evt_param(wmi_unified_t wmi_handle,
64 					 void *evt_buf,
65 					 struct p2p_set_mac_filter_evt *param)
66 {
67 	if (!wmi_handle) {
68 		wmi_err("wmi handle is null");
69 		return QDF_STATUS_E_INVAL;
70 	}
71 
72 	if (wmi_handle->ops->extract_mac_addr_rx_filter_evt_param)
73 		return wmi_handle->ops->extract_mac_addr_rx_filter_evt_param(
74 				wmi_handle, evt_buf, param);
75 
76 	return QDF_STATUS_E_FAILURE;
77 }
78 
79 #ifdef FEATURE_P2P_LISTEN_OFFLOAD
wmi_unified_p2p_lo_start_cmd(wmi_unified_t wmi_handle,struct p2p_lo_start * param)80 QDF_STATUS wmi_unified_p2p_lo_start_cmd(wmi_unified_t wmi_handle,
81 					struct p2p_lo_start *param)
82 {
83 	if (!wmi_handle) {
84 		wmi_err("wmi handle is null");
85 		return QDF_STATUS_E_INVAL;
86 	}
87 
88 	if (wmi_handle->ops->send_p2p_lo_start_cmd)
89 		return wmi_handle->ops->send_p2p_lo_start_cmd(wmi_handle,
90 							      param);
91 
92 	return QDF_STATUS_E_FAILURE;
93 }
94 
wmi_unified_p2p_lo_stop_cmd(wmi_unified_t wmi_handle,uint8_t vdev_id)95 QDF_STATUS wmi_unified_p2p_lo_stop_cmd(wmi_unified_t wmi_handle,
96 				       uint8_t vdev_id)
97 {
98 	if (!wmi_handle) {
99 		wmi_err("wmi handle is null");
100 		return QDF_STATUS_E_INVAL;
101 	}
102 
103 	if (wmi_handle->ops->send_p2p_lo_stop_cmd)
104 		return wmi_handle->ops->send_p2p_lo_stop_cmd(wmi_handle,
105 							     vdev_id);
106 
107 	return QDF_STATUS_E_FAILURE;
108 }
109 
wmi_extract_p2p_lo_stop_ev_param(wmi_unified_t wmi_handle,void * evt_buf,struct p2p_lo_event * param)110 QDF_STATUS wmi_extract_p2p_lo_stop_ev_param(wmi_unified_t wmi_handle,
111 					    void *evt_buf,
112 					    struct p2p_lo_event *param)
113 {
114 	if (!wmi_handle) {
115 		wmi_err("wmi handle is null");
116 		return QDF_STATUS_E_INVAL;
117 	}
118 
119 	if (wmi_handle->ops->extract_p2p_lo_stop_ev_param)
120 		return wmi_handle->ops->extract_p2p_lo_stop_ev_param(
121 				wmi_handle, evt_buf, param);
122 
123 	return QDF_STATUS_E_FAILURE;
124 }
125 #endif /* End of FEATURE_P2P_LISTEN_OFFLOAD*/
126 
127