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 DSRC component.
20  */
21 
22 #include <wmi_unified_priv.h>
23 #include <wlan_ocb_public_structs.h>
24 #include <wmi_unified_ocb_api.h>
25 
wmi_unified_ocb_start_timing_advert(struct wmi_unified * wmi_hdl,struct ocb_timing_advert_param * timing_advert)26 QDF_STATUS wmi_unified_ocb_start_timing_advert(struct wmi_unified *wmi_hdl,
27 	struct ocb_timing_advert_param *timing_advert)
28 {
29 	if (wmi_hdl->ops->send_ocb_start_timing_advert_cmd)
30 		return wmi_hdl->ops->send_ocb_start_timing_advert_cmd(wmi_hdl,
31 							timing_advert);
32 
33 	return QDF_STATUS_E_FAILURE;
34 }
35 
wmi_unified_ocb_stop_timing_advert(struct wmi_unified * wmi_hdl,struct ocb_timing_advert_param * timing_advert)36 QDF_STATUS wmi_unified_ocb_stop_timing_advert(struct wmi_unified *wmi_hdl,
37 	struct ocb_timing_advert_param *timing_advert)
38 {
39 	if (wmi_hdl->ops->send_ocb_stop_timing_advert_cmd)
40 		return wmi_hdl->ops->send_ocb_stop_timing_advert_cmd(wmi_hdl,
41 							timing_advert);
42 
43 	return QDF_STATUS_E_FAILURE;
44 }
45 
wmi_unified_ocb_set_utc_time_cmd(struct wmi_unified * wmi_hdl,struct ocb_utc_param * utc)46 QDF_STATUS wmi_unified_ocb_set_utc_time_cmd(struct wmi_unified *wmi_hdl,
47 					    struct ocb_utc_param *utc)
48 {
49 	if (wmi_hdl->ops->send_ocb_set_utc_time_cmd)
50 		return wmi_hdl->ops->send_ocb_set_utc_time_cmd(wmi_hdl, utc);
51 
52 	return QDF_STATUS_E_FAILURE;
53 }
54 
wmi_unified_ocb_get_tsf_timer(struct wmi_unified * wmi_hdl,struct ocb_get_tsf_timer_param * req)55 QDF_STATUS wmi_unified_ocb_get_tsf_timer(struct wmi_unified *wmi_hdl,
56 					 struct ocb_get_tsf_timer_param *req)
57 {
58 	if (wmi_hdl->ops->send_ocb_get_tsf_timer_cmd)
59 		return wmi_hdl->ops->send_ocb_get_tsf_timer_cmd(wmi_hdl,
60 								req->vdev_id);
61 
62 	return QDF_STATUS_E_FAILURE;
63 }
64 
wmi_unified_dcc_get_stats_cmd(struct wmi_unified * wmi_hdl,struct ocb_dcc_get_stats_param * get_stats_param)65 QDF_STATUS wmi_unified_dcc_get_stats_cmd(struct wmi_unified *wmi_hdl,
66 			struct ocb_dcc_get_stats_param *get_stats_param)
67 {
68 	if (wmi_hdl->ops->send_dcc_get_stats_cmd)
69 		return wmi_hdl->ops->send_dcc_get_stats_cmd(wmi_hdl,
70 							    get_stats_param);
71 
72 	return QDF_STATUS_E_FAILURE;
73 }
74 
wmi_unified_dcc_clear_stats(struct wmi_unified * wmi_hdl,struct ocb_dcc_clear_stats_param * clear_stats_param)75 QDF_STATUS wmi_unified_dcc_clear_stats(struct wmi_unified *wmi_hdl,
76 		struct ocb_dcc_clear_stats_param *clear_stats_param)
77 {
78 	if (wmi_hdl->ops->send_dcc_clear_stats_cmd)
79 		return wmi_hdl->ops->send_dcc_clear_stats_cmd(wmi_hdl,
80 				clear_stats_param->vdev_id,
81 				clear_stats_param->dcc_stats_bitmap);
82 
83 	return QDF_STATUS_E_FAILURE;
84 }
85 
wmi_unified_dcc_update_ndl(struct wmi_unified * wmi_hdl,struct ocb_dcc_update_ndl_param * update_ndl_param)86 QDF_STATUS wmi_unified_dcc_update_ndl(struct wmi_unified *wmi_hdl,
87 			struct ocb_dcc_update_ndl_param *update_ndl_param)
88 {
89 	if (wmi_hdl->ops->send_dcc_update_ndl_cmd)
90 		return wmi_hdl->ops->send_dcc_update_ndl_cmd(wmi_hdl,
91 					update_ndl_param);
92 
93 	return QDF_STATUS_E_FAILURE;
94 }
95 
wmi_unified_ocb_set_config(struct wmi_unified * wmi_hdl,struct ocb_config * config)96 QDF_STATUS wmi_unified_ocb_set_config(struct wmi_unified *wmi_hdl,
97 				      struct ocb_config *config)
98 {
99 	if (wmi_hdl->ops->send_ocb_set_config_cmd)
100 		return wmi_hdl->ops->send_ocb_set_config_cmd(wmi_hdl,
101 							     config);
102 
103 	return QDF_STATUS_E_FAILURE;
104 }
105 
106 QDF_STATUS
wmi_extract_ocb_set_channel_config_resp(struct wmi_unified * wmi_hdl,void * evt_buf,uint32_t * status)107 wmi_extract_ocb_set_channel_config_resp(struct wmi_unified *wmi_hdl,
108 					void *evt_buf,
109 					uint32_t *status)
110 {
111 	if (wmi_hdl->ops->extract_ocb_chan_config_resp)
112 		return wmi_hdl->ops->extract_ocb_chan_config_resp(wmi_hdl,
113 								  evt_buf,
114 								  status);
115 
116 	return QDF_STATUS_E_FAILURE;
117 }
118 
wmi_extract_ocb_tsf_timer(struct wmi_unified * wmi_hdl,void * evt_buf,struct ocb_get_tsf_timer_response * resp)119 QDF_STATUS wmi_extract_ocb_tsf_timer(struct wmi_unified *wmi_hdl,
120 				     void *evt_buf,
121 				     struct ocb_get_tsf_timer_response *resp)
122 {
123 	if (wmi_hdl->ops->extract_ocb_tsf_timer)
124 		return wmi_hdl->ops->extract_ocb_tsf_timer(wmi_hdl,
125 							   evt_buf,
126 							   resp);
127 
128 	return QDF_STATUS_E_FAILURE;
129 }
130 
wmi_extract_dcc_update_ndl_resp(struct wmi_unified * wmi_hdl,void * evt_buf,struct ocb_dcc_update_ndl_response * resp)131 QDF_STATUS wmi_extract_dcc_update_ndl_resp(struct wmi_unified *wmi_hdl,
132 		void *evt_buf, struct ocb_dcc_update_ndl_response *resp)
133 {
134 	if (wmi_hdl->ops->extract_dcc_update_ndl_resp)
135 		return wmi_hdl->ops->extract_dcc_update_ndl_resp(wmi_hdl,
136 								 evt_buf,
137 								 resp);
138 
139 	return QDF_STATUS_E_FAILURE;
140 }
141 
wmi_extract_dcc_stats(struct wmi_unified * wmi_hdl,void * evt_buf,struct ocb_dcc_get_stats_response ** resp)142 QDF_STATUS wmi_extract_dcc_stats(struct wmi_unified *wmi_hdl,
143 				 void *evt_buf,
144 				 struct ocb_dcc_get_stats_response **resp)
145 {
146 	if (wmi_hdl->ops->extract_dcc_stats)
147 		return wmi_hdl->ops->extract_dcc_stats(wmi_hdl,
148 						       evt_buf,
149 						       resp);
150 
151 	return QDF_STATUS_E_FAILURE;
152 }
153 
154