xref: /wlan-dirver/qca-wifi-host-cmn/qdf/inc/qdf_ipa_wdi3.h (revision 92d87f51612f6c3b2285266215edee8911647c2f)
1 /*
2  * Copyright (c) 2017-2018, 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: qdf_ipa_wdi3.h
19  * This file provides OS abstraction for IPA WDI APIs.
20  */
21 
22 #ifndef _QDF_IPA_WDI3_H
23 #define _QDF_IPA_WDI3_H
24 
25 #ifdef IPA_OFFLOAD
26 
27 #ifdef CONFIG_IPA_WDI_UNIFIED_API
28 
29 #include <qdf_ipa.h>
30 #include <i_qdf_ipa_wdi3.h>
31 
32 /**
33  * qdf_ipa_wdi_version_t - IPA WDI version
34  */
35 typedef __qdf_ipa_wdi_version_t qdf_ipa_wdi_version_t;
36 
37 /**
38  * qdf_ipa_wdi_init_in_params_t - wdi init input parameters
39  */
40 typedef __qdf_ipa_wdi_init_in_params_t qdf_ipa_wdi_init_in_params_t;
41 
42 /**
43  * qdf_ipa_wdi_init_out_params_t - wdi init output parameters
44  */
45 typedef __qdf_ipa_wdi_init_out_params_t qdf_ipa_wdi_init_out_params_t;
46 
47 /**
48  * qdf_ipa_wdi_pipe_setup_info_smmu_t - WDI TX/Rx configuration
49  */
50 typedef __qdf_ipa_wdi_pipe_setup_info_smmu_t qdf_ipa_wdi_pipe_setup_info_smmu_t;
51 
52 typedef __qdf_ipa_ep_cfg_t qdf_ipa_ep_cfg_t;
53 
54 /**
55  * qdf_ipa_wdi_init - Client should call this function to
56  * init WDI IPA offload data path
57  *
58  * Note: Should not be called from atomic context and only
59  * after checking IPA readiness using ipa_register_ipa_ready_cb()
60  *
61  * @Return 0 on success, negative on failure
62  */
63 static inline int qdf_ipa_wdi_init(qdf_ipa_wdi_init_in_params_t *in,
64 		 qdf_ipa_wdi_init_out_params_t *out)
65 {
66 	return __qdf_ipa_wdi_init(in, out);
67 }
68 
69 /**
70  * qdf_ipa_wdi_cleanup - Client should call this function to
71  * clean up WDI IPA offload data path
72  *
73  * @Return 0 on success, negative on failure
74  */
75 static inline int qdf_ipa_wdi_cleanup(void)
76 {
77 	return __qdf_ipa_wdi_cleanup();
78 }
79 
80 /**
81  * qdf_ipa_wdi_hdr_info_t - Header to install on IPA HW
82  */
83 typedef __qdf_ipa_wdi_hdr_info_t qdf_ipa_wdi_hdr_info_t;
84 
85 /**
86  * qdf_ipa_wdi_reg_intf_in_params_t - parameters for uC offload
87  *	interface registration
88  */
89 typedef __qdf_ipa_wdi_reg_intf_in_params_t qdf_ipa_wdi_reg_intf_in_params_t;
90 
91 /**
92  * qdf_ipa_wdi_pipe_setup_info_t - WDI TX/Rx configuration
93  */
94 typedef __qdf_ipa_wdi_pipe_setup_info_t qdf_ipa_wdi_pipe_setup_info_t;
95 
96 /**
97  * qdf_ipa_wdi_conn_in_params_t - information provided by
98  *		uC offload client
99  */
100 typedef __qdf_ipa_wdi_conn_in_params_t qdf_ipa_wdi_conn_in_params_t;
101 
102 /**
103  * qdf_ipa_wdi_conn_out_params_t - information provided
104  *				to WLAN druver
105  */
106 typedef __qdf_ipa_wdi_conn_out_params_t qdf_ipa_wdi_conn_out_params_t;
107 
108 /**
109  * qdf_ipa_wdi_perf_profile_t - To set BandWidth profile
110  */
111 typedef __qdf_ipa_wdi_perf_profile_t qdf_ipa_wdi_perf_profile_t;
112 
113 /**
114  * qdf_ipa_wdi_reg_intf - Client should call this function to
115  * init WDI IPA offload data path
116  *
117  * Note: Should not be called from atomic context and only
118  * after checking IPA readiness using ipa_register_ipa_ready_cb()
119  *
120  * @Return 0 on success, negative on failure
121  */
122 static inline int qdf_ipa_wdi_reg_intf(
123 	qdf_ipa_wdi_reg_intf_in_params_t *in)
124 {
125 	return __qdf_ipa_wdi_reg_intf(in);
126 }
127 
128 /**
129  * qdf_ipa_wdi_dereg_intf - Client Driver should call this
130  * function to deregister before unload and after disconnect
131  *
132  * @Return 0 on success, negative on failure
133  */
134 static inline int qdf_ipa_wdi_dereg_intf(const char *netdev_name)
135 {
136 	return __qdf_ipa_wdi_dereg_intf(netdev_name);
137 }
138 
139 /**
140  * qdf_ipa_wdi_conn_pipes - Client should call this
141  * function to connect pipes
142  *
143  * @in:	[in] input parameters from client
144  * @out: [out] output params to client
145  *
146  * Note: Should not be called from atomic context and only
147  * after checking IPA readiness using ipa_register_ipa_ready_cb()
148  *
149  * @Return 0 on success, negative on failure
150  */
151 static inline int qdf_ipa_wdi_conn_pipes(qdf_ipa_wdi_conn_in_params_t *in,
152 			qdf_ipa_wdi_conn_out_params_t *out)
153 {
154 	return __qdf_ipa_wdi_conn_pipes(in, out);
155 }
156 
157 /**
158  * qdf_ipa_wdi_disconn_pipes() - Client should call this
159  *		function to disconnect pipes
160  *
161  * Note: Should not be called from atomic context
162  *
163  * Returns: 0 on success, negative on failure
164  */
165 static inline int qdf_ipa_wdi_disconn_pipes(void)
166 {
167 	return __qdf_ipa_wdi_disconn_pipes();
168 }
169 
170 /**
171  * qdf_ipa_wdi_enable_pipes() - Client should call this
172  *		function to enable IPA offload data path
173  *
174  * Note: Should not be called from atomic context
175  *
176  * Returns: 0 on success, negative on failure
177  */
178 static inline int qdf_ipa_wdi_enable_pipes(void)
179 {
180 	return __qdf_ipa_wdi_enable_pipes();
181 }
182 
183 /**
184  * qdf_ipa_wdi_disable_pipes() - Client should call this
185  *		function to disable IPA offload data path
186  *
187  * Note: Should not be called from atomic context
188  *
189  * Returns: 0 on success, negative on failure
190  */
191 static inline int qdf_ipa_wdi_disable_pipes(void)
192 {
193 	return __qdf_ipa_wdi_disable_pipes();
194 }
195 
196 /**
197  * qdf_ipa_wdi_set_perf_profile() - Client should call this function to
198  *		set IPA clock bandwidth based on data rates
199  *
200  * @profile: [in] BandWidth profile to use
201  *
202  * Returns: 0 on success, negative on failure
203  */
204 static inline int qdf_ipa_wdi_set_perf_profile(
205 			qdf_ipa_wdi_perf_profile_t *profile)
206 {
207 	return __qdf_ipa_wdi_set_perf_profile(profile);
208 }
209 
210 /**
211  * qdf_ipa_wdi_create_smmu_mapping() - Client should call this function to
212  *		create smmu mapping
213  *
214  * @num_buffers: [in] number of buffers
215  * @info: [in] wdi buffer info
216  *
217  * Returns: 0 on success, negative on failure
218  */
219 static inline int qdf_ipa_wdi_create_smmu_mapping(uint32_t num_buffers,
220 		qdf_ipa_wdi_buffer_info_t *info)
221 {
222 	return __qdf_ipa_wdi_create_smmu_mapping(num_buffers, info);
223 }
224 
225 /**
226  * qdf_ipa_wdi_release_smmu_mapping() - Client should call this function to
227  *		release smmu mapping
228  *
229  * @num_buffers: [in] number of buffers
230  * @info: [in] wdi buffer info
231  *
232  * Returns: 0 on success, negative on failure
233  */
234 static inline int qdf_ipa_wdi_release_smmu_mapping(uint32_t num_buffers,
235 		qdf_ipa_wdi_buffer_info_t *info)
236 {
237 	return __qdf_ipa_wdi_release_smmu_mapping(num_buffers, info);
238 }
239 
240 #else /* CONFIG_IPA_WDI_UNIFIED_API */
241 
242 #include <i_qdf_ipa_wdi3.h>
243 
244 /**
245  * qdf_ipa_wdi3_hdr_info_t - Header to install on IPA HW
246  */
247 typedef __qdf_ipa_wdi3_hdr_info_t qdf_ipa_wdi3_hdr_info_t;
248 
249 /**
250  * qdf_ipa_wdi3_reg_intf_in_params_t - parameters for uC offload
251  *	interface registration
252  */
253 typedef __qdf_ipa_wdi3_reg_intf_in_params_t qdf_ipa_wdi3_reg_intf_in_params_t;
254 
255 /**
256  * qdf_ipa_wdi3_setup_info_t - WDI3 TX/Rx configuration
257  */
258 typedef __qdf_ipa_wdi3_setup_info_t qdf_ipa_wdi3_setup_info_t;
259 
260 /**
261  * qdf_ipa_wdi3_conn_in_params_t - information provided by
262  *		uC offload client
263  */
264 typedef __qdf_ipa_wdi3_conn_in_params_t qdf_ipa_wdi3_conn_in_params_t;
265 
266 /**
267  * qdf_ipa_wdi3_conn_out_params_t - information provided
268  *				to WLAN druver
269  */
270 typedef __qdf_ipa_wdi3_conn_out_params_t qdf_ipa_wdi3_conn_out_params_t;
271 
272 /**
273  * qdf_ipa_wdi3_perf_profile_t - To set BandWidth profile
274  */
275 typedef __qdf_ipa_wdi3_perf_profile_t qdf_ipa_wdi3_perf_profile_t;
276 
277 /**
278  * qdf_ipa_wdi3_reg_intf - Client should call this function to
279  * init WDI3 IPA offload data path
280  *
281  * Note: Should not be called from atomic context and only
282  * after checking IPA readiness using ipa_register_ipa_ready_cb()
283  *
284  * @Return 0 on success, negative on failure
285  */
286 static inline int qdf_ipa_wdi3_reg_intf(
287 	struct ipa_wdi3_reg_intf_in_params *in)
288 {
289 	return __qdf_ipa_wdi3_reg_intf(in);
290 }
291 
292 /**
293  * qdf_ipa_wdi3_dereg_intf - Client Driver should call this
294  * function to deregister before unload and after disconnect
295  *
296  * @Return 0 on success, negative on failure
297  */
298 static inline int qdf_ipa_wdi3_dereg_intf(const char *netdev_name)
299 {
300 	return __qdf_ipa_wdi3_dereg_intf(netdev_name);
301 }
302 
303 /**
304  * qdf_ipa_wdi3_conn_pipes - Client should call this
305  * function to connect pipes
306  *
307  * @in:	[in] input parameters from client
308  * @out: [out] output params to client
309  *
310  * Note: Should not be called from atomic context and only
311  * after checking IPA readiness using ipa_register_ipa_ready_cb()
312  *
313  * @Return 0 on success, negative on failure
314  */
315 static inline int qdf_ipa_wdi3_conn_pipes(struct ipa_wdi3_conn_in_params *in,
316 			struct ipa_wdi3_conn_out_params *out)
317 {
318 	return __qdf_ipa_wdi3_conn_pipes(in, out);
319 }
320 
321 /**
322  * qdf_ipa_wdi3_disconn_pipes() - Client should call this
323  *		function to disconnect pipes
324  *
325  * Note: Should not be called from atomic context
326  *
327  * Returns: 0 on success, negative on failure
328  */
329 static inline int qdf_ipa_wdi3_disconn_pipes(void)
330 {
331 	return __qdf_ipa_wdi3_disconn_pipes();
332 }
333 
334 /**
335  * qdf_ipa_wdi3_enable_pipes() - Client should call this
336  *		function to enable IPA offload data path
337  *
338  * Note: Should not be called from atomic context
339  *
340  * Returns: 0 on success, negative on failure
341  */
342 static inline int qdf_ipa_wdi3_enable_pipes(void)
343 {
344 	return __qdf_ipa_wdi3_enable_pipes();
345 }
346 
347 /**
348  * qdf_ipa_wdi3_disable_pipes() - Client should call this
349  *		function to disable IPA offload data path
350  *
351  * Note: Should not be called from atomic context
352  *
353  * Returns: 0 on success, negative on failure
354  */
355 static inline int qdf_ipa_wdi3_disable_pipes(void)
356 {
357 	return __qdf_ipa_wdi3_disable_pipes();
358 }
359 
360 /**
361  * qdf_ipa_wdi3_set_perf_profile() - Client should call this function to
362  *		set IPA clock bandwidth based on data rates
363  *
364  * @profile: [in] BandWidth profile to use
365  *
366  * Returns: 0 on success, negative on failure
367  */
368 static inline int qdf_ipa_wdi3_set_perf_profile(
369 			struct ipa_wdi3_perf_profile *profile)
370 {
371 	return __qdf_ipa_wdi3_set_perf_profile(profile);
372 }
373 
374 #endif /* CONFIG_IPA_WDI_UNIFIED_API */
375 
376 #endif /* IPA_OFFLOAD */
377 #endif /* _QDF_IPA_WDI3_H */
378