static void hifDeviceRemoved(struct sdio_func *func) { A_STATUS status = A_OK; HIF_DEVICE *device; AR_DEBUG_ASSERT(func != NULL); AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDeviceRemoved\n")); device = getHifDevice(func); if (device->claimedContext != NULL) { status = osdrvCallbacks.deviceRemovedHandler(device->claimedContext, device); } if (device->is_suspend) { device->is_suspend = FALSE; } else { if (hifDisableFunc(device, func)!=0) { status = A_ERROR; } } CleanupHIFScatterResources(device); delHifDevice(device); AR_DEBUG_ASSERT(status == A_OK); AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceRemoved\n")); }
static int hifDeviceSuspend(struct device *dev) { struct sdio_func *func = dev_to_sdio_func(dev); A_STATUS status = A_OK; HIF_DEVICE *device; device = getHifDevice(func); if (device && device->claimedContext && osdrvCallbacks.deviceSuspendHandler) { status = osdrvCallbacks.deviceSuspendHandler(device->claimedContext); } if (status == A_OK) { int oldresetvalue = reset_sdio_on_unload; reset_sdio_on_unload = 1; hifDisableFunc(device, func); reset_sdio_on_unload = oldresetvalue; device->is_suspend = TRUE; } else if (status == A_EBUSY) { A_INT32 cnt = 10; A_UINT8 host_int_status; do { while (atomic_read(&device->irqHandling)) { /* wait until irq handler finished all the jobs */ schedule_timeout(HZ/10); } /* check if there is any pending irq due to force done */ host_int_status = 0; status = HIFReadWrite(device, HOST_INT_STATUS_ADDRESS, (A_UINT8 *)&host_int_status, sizeof(host_int_status), HIF_RD_SYNC_BYTE_INC, NULL); host_int_status = A_SUCCESS(status) ? (host_int_status & (1 << 0)) : 0; if (host_int_status) { schedule(); /* schedule for next dsrHandler */ } } while (host_int_status && --cnt > 0); if (host_int_status && cnt == 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("AR6000: %s(), Unable clear up pending IRQ before the system suspended\n", __FUNCTION__)); } #if 1 status = A_OK; /* assume that sdio host controller will take care the power of wifi chip */ #else return -EBUSY; /* Return -EBUSY if customer use all android patch of mmc stack provided by us */ #endif } return A_SUCCESS(status) ? 0 : status; }
static int hifDeviceSuspend(struct device *dev) { struct sdio_func *func = dev_to_sdio_func(dev); A_STATUS status = A_OK; HIF_DEVICE *device; device = getHifDevice(func); if (device && device->claimedContext && osdrvCallbacks.deviceSuspendHandler) { status = osdrvCallbacks.deviceSuspendHandler(device->claimedContext); } if (status == A_OK) { hifDisableFunc(device, func); device->is_suspend = TRUE; } else if (status == A_EBUSY) { status = A_OK; /* assume that sdio host controller will take care the power of wifi chip */ } return A_SUCCESS(status) ? 0 : status; }
static void ath6kl_hifdev_remove(struct sdio_func *func) { int status = 0; struct hif_device *device; device = ath6kl_get_hifdev(func); if (device->claimedContext != NULL) status = osdrvCallbacks. deviceRemovedHandler(device->claimedContext, device); if (device->is_disabled) device->is_disabled = false; else status = hifDisableFunc(device, func); CleanupHIFScatterResources(device); delHifDevice(device); }