コード例 #1
0
ファイル: hif.c プロジェクト: ArthySundaram/firstrepo
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;
}
コード例 #2
0
ファイル: hif.c プロジェクト: AvalueAES/rev-sa01
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;
}
コード例 #3
0
ファイル: hif.c プロジェクト: plaguedbypenguins/atheros_sdk2
int HIFDoDeviceSuspend(HIF_DEVICE *device)
{
    A_STATUS status = A_OK;

    if (device && device->claimedContext && osdrvCallbacks.deviceSuspendHandler) {
        status = osdrvCallbacks.deviceSuspendHandler(device->claimedContext);
    }
    if (status == A_OK) {
        /* Waiting for all pending request */
        if (!IS_ERR(device->async_task)) {
            init_completion(&device->async_completion);
            device->async_shutdown = 1;
            up(&device->sem_async);
            wait_for_completion(&device->async_completion);
            device->async_task = NULL;
        }
        device->is_suspend = TRUE;
    } else if (status == A_EBUSY) {
        return -EBUSY; /* Return -1 if customer use all android patch of mmc stack provided by us */ 
    }
    return A_SUCCESS(status) ? 0 : status;
}