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 #else /* CONFIG_IPA_WDI_UNIFIED_API */ 211 212 #include <i_qdf_ipa_wdi3.h> 213 214 /** 215 * qdf_ipa_wdi3_hdr_info_t - Header to install on IPA HW 216 */ 217 typedef __qdf_ipa_wdi3_hdr_info_t qdf_ipa_wdi3_hdr_info_t; 218 219 /** 220 * qdf_ipa_wdi3_reg_intf_in_params_t - parameters for uC offload 221 * interface registration 222 */ 223 typedef __qdf_ipa_wdi3_reg_intf_in_params_t qdf_ipa_wdi3_reg_intf_in_params_t; 224 225 /** 226 * qdf_ipa_wdi3_setup_info_t - WDI3 TX/Rx configuration 227 */ 228 typedef __qdf_ipa_wdi3_setup_info_t qdf_ipa_wdi3_setup_info_t; 229 230 /** 231 * qdf_ipa_wdi3_conn_in_params_t - information provided by 232 * uC offload client 233 */ 234 typedef __qdf_ipa_wdi3_conn_in_params_t qdf_ipa_wdi3_conn_in_params_t; 235 236 /** 237 * qdf_ipa_wdi3_conn_out_params_t - information provided 238 * to WLAN druver 239 */ 240 typedef __qdf_ipa_wdi3_conn_out_params_t qdf_ipa_wdi3_conn_out_params_t; 241 242 /** 243 * qdf_ipa_wdi3_perf_profile_t - To set BandWidth profile 244 */ 245 typedef __qdf_ipa_wdi3_perf_profile_t qdf_ipa_wdi3_perf_profile_t; 246 247 /** 248 * qdf_ipa_wdi3_reg_intf - Client should call this function to 249 * init WDI3 IPA offload data path 250 * 251 * Note: Should not be called from atomic context and only 252 * after checking IPA readiness using ipa_register_ipa_ready_cb() 253 * 254 * @Return 0 on success, negative on failure 255 */ 256 static inline int qdf_ipa_wdi3_reg_intf( 257 struct ipa_wdi3_reg_intf_in_params *in) 258 { 259 return __qdf_ipa_wdi3_reg_intf(in); 260 } 261 262 /** 263 * qdf_ipa_wdi3_dereg_intf - Client Driver should call this 264 * function to deregister before unload and after disconnect 265 * 266 * @Return 0 on success, negative on failure 267 */ 268 static inline int qdf_ipa_wdi3_dereg_intf(const char *netdev_name) 269 { 270 return __qdf_ipa_wdi3_dereg_intf(netdev_name); 271 } 272 273 /** 274 * qdf_ipa_wdi3_conn_pipes - Client should call this 275 * function to connect pipes 276 * 277 * @in: [in] input parameters from client 278 * @out: [out] output params to client 279 * 280 * Note: Should not be called from atomic context and only 281 * after checking IPA readiness using ipa_register_ipa_ready_cb() 282 * 283 * @Return 0 on success, negative on failure 284 */ 285 static inline int qdf_ipa_wdi3_conn_pipes(struct ipa_wdi3_conn_in_params *in, 286 struct ipa_wdi3_conn_out_params *out) 287 { 288 return __qdf_ipa_wdi3_conn_pipes(in, out); 289 } 290 291 /** 292 * qdf_ipa_wdi3_disconn_pipes() - Client should call this 293 * function to disconnect pipes 294 * 295 * Note: Should not be called from atomic context 296 * 297 * Returns: 0 on success, negative on failure 298 */ 299 static inline int qdf_ipa_wdi3_disconn_pipes(void) 300 { 301 return __qdf_ipa_wdi3_disconn_pipes(); 302 } 303 304 /** 305 * qdf_ipa_wdi3_enable_pipes() - Client should call this 306 * function to enable IPA offload data path 307 * 308 * Note: Should not be called from atomic context 309 * 310 * Returns: 0 on success, negative on failure 311 */ 312 static inline int qdf_ipa_wdi3_enable_pipes(void) 313 { 314 return __qdf_ipa_wdi3_enable_pipes(); 315 } 316 317 /** 318 * qdf_ipa_wdi3_disable_pipes() - Client should call this 319 * function to disable IPA offload data path 320 * 321 * Note: Should not be called from atomic context 322 * 323 * Returns: 0 on success, negative on failure 324 */ 325 static inline int qdf_ipa_wdi3_disable_pipes(void) 326 { 327 return __qdf_ipa_wdi3_disable_pipes(); 328 } 329 330 /** 331 * qdf_ipa_wdi3_set_perf_profile() - Client should call this function to 332 * set IPA clock bandwidth based on data rates 333 * 334 * @profile: [in] BandWidth profile to use 335 * 336 * Returns: 0 on success, negative on failure 337 */ 338 static inline int qdf_ipa_wdi3_set_perf_profile( 339 struct ipa_wdi3_perf_profile *profile) 340 { 341 return __qdf_ipa_wdi3_set_perf_profile(profile); 342 } 343 344 #endif /* CONFIG_IPA_WDI_UNIFIED_API */ 345 346 #endif /* IPA_OFFLOAD */ 347 #endif /* _QDF_IPA_WDI3_H */ 348