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