1 /* 2 * Copyright (c) 2016-2020 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 #include "qdf_types.h" 20 #include "dummy.h" 21 #include "hif_debug.h" 22 23 /** 24 * hif_dummy_bus_prevent_linkdown() - prevent linkdown 25 * @hif_ctx: hif context 26 * @flag: weather to keep the bus alive or not 27 * 28 * Dummy function for busses and platforms that do not support 29 * link down. This may need to be replaced with a wakelock. 30 */ 31 void hif_dummy_bus_prevent_linkdown(struct hif_softc *scn, bool flag) 32 { 33 hif_debug("wlan: %s pcie power collapse ignored", 34 (flag ? "disable" : "enable")); 35 } 36 37 /** 38 * hif_reset_soc(): reset soc 39 * 40 * this function resets soc 41 * 42 * @hif_ctx: HIF context 43 * 44 * Return: void 45 */ 46 /* Function to reset SoC */ 47 void hif_dummy_reset_soc(struct hif_softc *hif_ctx) 48 { 49 } 50 51 /** 52 * hif_dummy_suspend() - suspend the bus 53 * @hif_ctx: hif context 54 * 55 * dummy for busses that don't need to suspend. 56 * 57 * Return: 0 for success and non-zero for failure 58 */ 59 int hif_dummy_bus_suspend(struct hif_softc *hif_ctx) 60 { 61 return 0; 62 } 63 64 /** 65 * hif_dummy_resume() - hif resume API 66 * 67 * This function resumes the bus. but snoc doesn't need to resume. 68 * Therefore do nothing. 69 * 70 * Return: 0 for success and non-zero for failure 71 */ 72 int hif_dummy_bus_resume(struct hif_softc *hif_ctx) 73 { 74 return 0; 75 } 76 77 /** 78 * hif_dummy_suspend_noirq() - suspend the bus 79 * @hif_ctx: hif context 80 * 81 * dummy for busses that don't need to synchronize 82 * with interrupt disable. 83 * 84 * Return: 0 for success and non-zero for failure 85 */ 86 int hif_dummy_bus_suspend_noirq(struct hif_softc *hif_ctx) 87 { 88 return 0; 89 } 90 91 /** 92 * hif_dummy_resume_noirq() - resume the bus 93 * @hif_ctx: hif context 94 * 95 * dummy for busses that don't need to synchronize 96 * with interrupt disable. 97 * 98 * Return: 0 for success and non-zero for failure 99 */ 100 int hif_dummy_bus_resume_noirq(struct hif_softc *hif_ctx) 101 { 102 return 0; 103 } 104 105 /** 106 * hif_dummy_target_sleep_state_adjust() - api to adjust state of target 107 * @scn: hif context 108 * @sleep_ok: allow or deny target to go to sleep 109 * @wait_for_it: ensure target has change 110 */ 111 int hif_dummy_target_sleep_state_adjust(struct hif_softc *scn, 112 bool sleep_ok, bool wait_for_it) 113 { 114 return 0; 115 } 116 117 /** 118 * hif_dummy_enable_power_management - dummy call 119 * hif_ctx: hif context 120 * is_packet_log_enabled: true if packet log is enabled 121 */ 122 void hif_dummy_enable_power_management(struct hif_softc *hif_ctx, 123 bool is_packet_log_enabled) 124 {} 125 126 /** 127 * hif_dummy_disable_power_management - dummy call 128 * hif_ctx: hif context 129 * 130 * Return: none 131 */ 132 void hif_dummy_disable_power_management(struct hif_softc *hif_ctx) 133 {} 134 135 /** 136 * hif_dummy_disable_isr - dummy call 137 * hif_ctx: hif context 138 * 139 * Return: none 140 */ 141 void hif_dummy_disable_isr(struct hif_softc *scn) 142 {} 143 144 /** 145 * hif_dummy_nointrs - dummy call 146 * hif_sc: hif context 147 * 148 * Return: none 149 */ 150 void hif_dummy_nointrs(struct hif_softc *hif_sc) 151 {} 152 153 /** 154 * hif_dummy_bus_configure - dummy call 155 * hif_ctx: hif context 156 * 157 * Return: 0 for success 158 */ 159 int hif_dummy_bus_configure(struct hif_softc *hif_sc) 160 { 161 return 0; 162 } 163 164 /** 165 * hif_dummy_get_config_item - dummy call 166 * @hif_sc: hif context 167 * @opcode: configuration type 168 * @config: configuration value to set 169 * @config_len: configuration length 170 * 171 * Return: QDF_STATUS_SUCCESS for success 172 */ 173 QDF_STATUS 174 hif_dummy_get_config_item(struct hif_softc *hif_sc, 175 int opcode, void *config, uint32_t config_len) 176 { 177 return QDF_STATUS_SUCCESS; 178 } 179 180 /** 181 * hif_dummy_set_mailbox_swap - dummy call 182 * @hif_sc: hif context 183 * 184 * Return: None 185 */ 186 void 187 hif_dummy_set_mailbox_swap(struct hif_softc *hif_sc) 188 { 189 } 190 191 /** 192 * hif_dummy_claim_device - dummy call 193 * @hif_sc: hif context 194 * 195 * Return: None 196 */ 197 void 198 hif_dummy_claim_device(struct hif_softc *hif_sc) 199 { 200 } 201 202 /** 203 * hif_dummy_cancel_deferred_target_sleep - dummy call 204 * @hif_sc: hif context 205 * 206 * Return: None 207 */ 208 void 209 hif_dummy_cancel_deferred_target_sleep(struct hif_softc *hif_sc) 210 { 211 } 212 213 /** 214 * hif_dummy_irq_enable - dummy call 215 * hif_ctx: hif context 216 * @irq_id: irq id 217 * 218 * Return: none 219 */ 220 void hif_dummy_irq_enable(struct hif_softc *hif_sc, int irq_id) 221 {} 222 223 /** 224 * hif_dummy_grp_irq_enable - dummy call 225 * hif_ctx: hif context 226 * @irq_id: grp id 227 * 228 * Return: none 229 */ 230 void hif_dummy_grp_irq_enable(struct hif_softc *hif_sc, uint32_t grp_id) 231 {} 232 233 /** 234 * hif_dummy_irq_disable - dummy call 235 * hif_ctx: hif context 236 * @irq_id: irq id 237 * 238 * Return: none 239 */ 240 void hif_dummy_irq_disable(struct hif_softc *hif_sc, int irq_id) 241 {} 242 243 /** 244 * hif_dummy_grp_irq_disable- dummy call 245 * hif_ctx: hif context 246 * @grp_id: grp id 247 * 248 * Return: none 249 */ 250 void hif_dummy_grp_irq_disable(struct hif_softc *hif_sc, uint32_t grp_id) 251 {} 252 253 /** 254 * hif_dummy_grp_irq_configure - dummy call 255 * hif_ctx: hif context 256 * 257 * Return: none 258 */ 259 int hif_dummy_grp_irq_configure(struct hif_softc *hif_sc, 260 struct hif_exec_context *exec) 261 { 262 return 0; 263 } 264 265 /** 266 * hif_dummy_dump_registers - dummy call 267 * hif_sc: hif context 268 * 269 * Return: 0 for success 270 */ 271 int hif_dummy_dump_registers(struct hif_softc *hif_sc) 272 { 273 return 0; 274 } 275 276 /** 277 * hif_dummy_dump_target_memory - dummy call 278 * @hif_sc: hif context 279 * @ramdump_base: base 280 * @address: address 281 * @size: size 282 * 283 * Return: None 284 */ 285 void hif_dummy_dump_target_memory(struct hif_softc *hif_sc, void *ramdump_base, 286 uint32_t address, uint32_t size) 287 { 288 } 289 290 uint32_t hif_dummy_bus_reg_read32(struct hif_softc *hif_sc, 291 uint32_t offset) 292 { 293 return 0; 294 } 295 296 void hif_dummy_bus_reg_write32(struct hif_softc *hif_sc, 297 uint32_t offset, 298 uint32_t value) 299 { 300 } 301 302 /** 303 * hif_dummy_ipa_get_ce_resource - dummy call 304 * @scn: HIF context 305 * @ce_sr: copyengine source ring resource info 306 * @sr_ring_size: source ring size 307 * @reg_paddr: bus physical address 308 * 309 * Return: None 310 */ 311 void hif_dummy_ipa_get_ce_resource(struct hif_softc *hif_sc, 312 qdf_shared_mem_t **ce_sr, 313 uint32_t *sr_ring_size, 314 qdf_dma_addr_t *reg_paddr) 315 { 316 } 317 318 /** 319 * hif_dummy_mask_interrupt_call - dummy call 320 * @hif_sc: hif context 321 * 322 * Return: None 323 */ 324 void 325 hif_dummy_mask_interrupt_call(struct hif_softc *hif_sc) 326 { 327 } 328 329 /** 330 * hif_dummy_display_stats - dummy call 331 * hif_ctx: hif context 332 * 333 * Return: none 334 */ 335 void hif_dummy_display_stats(struct hif_softc *hif_ctx) 336 {} 337 338 /** 339 * hif_dummy_clear_stats - dummy call 340 * hif_ctx: hif context 341 * 342 * Return: none 343 */ 344 void hif_dummy_clear_stats(struct hif_softc *hif_ctx) 345 {} 346 /** 347 * hif_dummy_set_bundle_mode() - dummy call 348 * @hif_sc: hif context 349 * @enabled: flag to enable/disable bundling 350 * @rx_bundle_cnt: bundle count to be used for RX 351 * 352 * Return: none 353 */ 354 void hif_dummy_set_bundle_mode(struct hif_softc *hif_ctx, 355 bool enabled, int rx_bundle_cnt) 356 { 357 } 358 359 /** 360 * hif_dummy_bus_reset_resume() - dummy call 361 * @hif_sc: hif context 362 * 363 * Return: int 0 for success, non zero for failure 364 */ 365 int hif_dummy_bus_reset_resume(struct hif_softc *hif_ctx) 366 { 367 return 0; 368 } 369 370 int hif_dummy_map_ce_to_irq(struct hif_softc *scn, int ce_id) 371 { 372 hif_err("hif_map_ce_to_irq is not implemented on this platform"); 373 QDF_BUG(0); 374 return -(1); 375 } 376 377 int hif_dummy_addr_in_boundary(struct hif_softc *scn, uint32_t offset) 378 { 379 return 0; 380 } 381 382 /** 383 * hif_dummy_config_irq_affinity - dummy call 384 * @scn: hif context 385 * 386 * Return: None 387 */ 388 void hif_dummy_config_irq_affinity(struct hif_softc *scn) 389 { 390 } 391 392 /** 393 * hif_dummy_config_irq_by_ceid - dummy call 394 * @scn: hif context 395 * @ce_id : copy engine id 396 * Return: 0 397 */ 398 int hif_dummy_config_irq_by_ceid(struct hif_softc *scn, int ce_id) 399 { 400 return 0; 401 } 402 403 /** 404 * hif_dummy_log_bus_info - dummy call 405 * @scn: hif context 406 * @data: hang event data buffer 407 * @offset: offset at which data needs to be written 408 * 409 * Return: bool 410 */ 411 bool hif_dummy_log_bus_info(struct hif_softc *scn, uint8_t *data, 412 unsigned int *offset) 413 { 414 return false; 415 } 416