From: lhh Date: Thu, 27 Jan 2011 09:07:03 +0000 (+0800) Subject: delay 2s for the same sdcard check X-Git-Tag: firefly_0821_release~10789^2~2 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0a70ec0d75c1db05002ef64fd00a9a4339eab3b6;p=firefly-linux-kernel-4.4.55.git delay 2s for the same sdcard check --- diff --git a/drivers/mmc/host/rk29_sdmmc.c b/drivers/mmc/host/rk29_sdmmc.c index cf846eec5fc6..55c07dbd9b34 100755 --- a/drivers/mmc/host/rk29_sdmmc.c +++ b/drivers/mmc/host/rk29_sdmmc.c @@ -1150,7 +1150,7 @@ static irqreturn_t rk29_sdmmc_interrupt(int irq, void *dev_id) u32 status, pending; unsigned int pass_count = 0; bool present; - //bool present_old; + bool present_old; spin_lock(&host->lock); do { @@ -1161,16 +1161,17 @@ static irqreturn_t rk29_sdmmc_interrupt(int irq, void *dev_id) if(pending & SDMMC_INT_CD) { rk29_sdmmc_write(host->regs, SDMMC_RINTSTS, SDMMC_INT_CD); // clear sd detect int present = rk29_sdmmc_get_cd(host->mmc); - //present_old = test_bit(RK29_SDMMC_CARD_PRESENT, &host->flags); - //if(present != present_old) { - if (present != 0) { - set_bit(RK29_SDMMC_CARD_PRESENT, &host->flags); + present_old = test_bit(RK29_SDMMC_CARD_PRESENT, &host->flags); + if (present != 0) { + set_bit(RK29_SDMMC_CARD_PRESENT, &host->flags); + if(present == present_old) + mod_timer(&host->detect_timer, jiffies + msecs_to_jiffies(2000)); + else mod_timer(&host->detect_timer, jiffies + msecs_to_jiffies(200)); - } else { - clear_bit(RK29_SDMMC_CARD_PRESENT, &host->flags); - mod_timer(&host->detect_timer, jiffies + msecs_to_jiffies(10)); - } - //} + } else { + clear_bit(RK29_SDMMC_CARD_PRESENT, &host->flags); + mod_timer(&host->detect_timer, jiffies + msecs_to_jiffies(10)); + } } if(pending & RK29_SDMMC_CMD_ERROR_FLAGS) { rk29_sdmmc_write(host->regs, SDMMC_RINTSTS,RK29_SDMMC_CMD_ERROR_FLAGS); // clear interrupt