1 /* 2 * Copyright (c) 2016-2021 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_grp_irq_deconfigure - dummy call 267 * hif_sc: hif context 268 * 269 * Return: none 270 */ 271 void hif_dummy_grp_irq_deconfigure(struct hif_softc *hif_sc) 272 { 273 } 274 275 /** 276 * hif_dummy_dump_registers - dummy call 277 * hif_sc: hif context 278 * 279 * Return: 0 for success 280 */ 281 int hif_dummy_dump_registers(struct hif_softc *hif_sc) 282 { 283 return 0; 284 } 285 286 /** 287 * hif_dummy_dump_target_memory - dummy call 288 * @hif_sc: hif context 289 * @ramdump_base: base 290 * @address: address 291 * @size: size 292 * 293 * Return: None 294 */ 295 void hif_dummy_dump_target_memory(struct hif_softc *hif_sc, void *ramdump_base, 296 uint32_t address, uint32_t size) 297 { 298 } 299 300 uint32_t hif_dummy_bus_reg_read32(struct hif_softc *hif_sc, 301 uint32_t offset) 302 { 303 return 0; 304 } 305 306 void hif_dummy_bus_reg_write32(struct hif_softc *hif_sc, 307 uint32_t offset, 308 uint32_t value) 309 { 310 } 311 312 /** 313 * hif_dummy_ipa_get_ce_resource - dummy call 314 * @scn: HIF context 315 * @ce_sr: copyengine source ring resource info 316 * @sr_ring_size: source ring size 317 * @reg_paddr: bus physical address 318 * 319 * Return: None 320 */ 321 void hif_dummy_ipa_get_ce_resource(struct hif_softc *hif_sc, 322 qdf_shared_mem_t **ce_sr, 323 uint32_t *sr_ring_size, 324 qdf_dma_addr_t *reg_paddr) 325 { 326 } 327 328 /** 329 * hif_dummy_mask_interrupt_call - dummy call 330 * @hif_sc: hif context 331 * 332 * Return: None 333 */ 334 void 335 hif_dummy_mask_interrupt_call(struct hif_softc *hif_sc) 336 { 337 } 338 339 /** 340 * hif_dummy_display_stats - dummy call 341 * hif_ctx: hif context 342 * 343 * Return: none 344 */ 345 void hif_dummy_display_stats(struct hif_softc *hif_ctx) 346 {} 347 348 /** 349 * hif_dummy_clear_stats - dummy call 350 * hif_ctx: hif context 351 * 352 * Return: none 353 */ 354 void hif_dummy_clear_stats(struct hif_softc *hif_ctx) 355 {} 356 /** 357 * hif_dummy_set_bundle_mode() - dummy call 358 * @hif_sc: hif context 359 * @enabled: flag to enable/disable bundling 360 * @rx_bundle_cnt: bundle count to be used for RX 361 * 362 * Return: none 363 */ 364 void hif_dummy_set_bundle_mode(struct hif_softc *hif_ctx, 365 bool enabled, int rx_bundle_cnt) 366 { 367 } 368 369 /** 370 * hif_dummy_bus_reset_resume() - dummy call 371 * @hif_sc: hif context 372 * 373 * Return: int 0 for success, non zero for failure 374 */ 375 int hif_dummy_bus_reset_resume(struct hif_softc *hif_ctx) 376 { 377 return 0; 378 } 379 380 int hif_dummy_map_ce_to_irq(struct hif_softc *scn, int ce_id) 381 { 382 hif_err("hif_map_ce_to_irq is not implemented on this platform"); 383 QDF_BUG(0); 384 return -(1); 385 } 386 387 int hif_dummy_addr_in_boundary(struct hif_softc *scn, uint32_t offset) 388 { 389 return 0; 390 } 391 392 /** 393 * hif_dummy_config_irq_affinity - dummy call 394 * @scn: hif context 395 * 396 * Return: None 397 */ 398 void hif_dummy_config_irq_affinity(struct hif_softc *scn) 399 { 400 } 401 402 /** 403 * hif_dummy_config_irq_by_ceid - dummy call 404 * @scn: hif context 405 * @ce_id : copy engine id 406 * Return: 0 407 */ 408 int hif_dummy_config_irq_by_ceid(struct hif_softc *scn, int ce_id) 409 { 410 return 0; 411 } 412 413 /** 414 * hif_config_irq_clear_affinity() - dummy call 415 * @scn: HIF handle 416 * @intr_ctxt_id: interrupt group index 417 * @cpu: CPU core to clear 418 * 419 * Return: None 420 */ 421 void hif_dummy_config_irq_clear_cpu_affinity(struct hif_softc *scn, 422 int intr_ctxt_id, int cpu) 423 { 424 } 425 426 /** 427 * hif_dummy_log_bus_info - dummy call 428 * @scn: hif context 429 * @data: hang event data buffer 430 * @offset: offset at which data needs to be written 431 * 432 * Return: bool 433 */ 434 bool hif_dummy_log_bus_info(struct hif_softc *scn, uint8_t *data, 435 unsigned int *offset) 436 { 437 return false; 438 } 439 440 /** 441 * hif_dummy_enable_grp_irqs - dummy call 442 * @scn: hif context 443 * Return: EOPNOTSUPP 444 */ 445 int hif_dummy_enable_grp_irqs(struct hif_softc *scn) 446 { 447 return -EOPNOTSUPP; 448 } 449 450 /** 451 * hif_dummy_disable_grp_irqs - dummy call 452 * @scn: hif context 453 * Return: EOPNOTSUPP 454 */ 455 int hif_dummy_disable_grp_irqs(struct hif_softc *scn) 456 { 457 return -EOPNOTSUPP; 458 } 459