/** * mmc_remove_host - remove host hardware * @host: mmc host * * Unregister and remove all cards associated with this host, * and power down the MMC bus. */ void mmc_remove_host(struct mmc_host *host) { #ifdef CONFIG_MMC_DEBUG mmc_claim_host(host); host->removed = 1; mmc_release_host(host); #endif mmc_flush_scheduled_work(); mmc_bus_get(host); if (host->bus_ops && !host->bus_dead) { if (host->bus_ops->remove) host->bus_ops->remove(host); mmc_claim_host(host); mmc_detach_bus(host); mmc_release_host(host); } mmc_bus_put(host); BUG_ON(host->card); mmc_power_off(host); mmc_remove_host_sysfs(host); }
/** * mmc_suspend_host - suspend a host * @host: mmc host * @state: suspend mode (PM_SUSPEND_xxx) */ int mmc_suspend_host(struct mmc_host *host, pm_message_t state) { if (mmc_bus_needs_resume(host)) return 0; cancel_delayed_work(&host->detect); mmc_flush_scheduled_work(); mmc_bus_get(host); if (host->bus_ops && !host->bus_dead) { if (host->bus_ops->suspend) host->bus_ops->suspend(host); if (!host->bus_ops->resume) { if (host->bus_ops->remove) host->bus_ops->remove(host); mmc_claim_host(host); mmc_detach_bus(host); mmc_release_host(host); } } mmc_bus_put(host); mmc_power_off(host); return 0; }
void mmc_stop_host(struct mmc_host *host) { #ifdef CONFIG_MMC_DEBUG unsigned long flags; spin_lock_irqsave(&host->lock, flags); host->removed = 1; spin_unlock_irqrestore(&host->lock, flags); #endif mmc_flush_scheduled_work(); mmc_bus_get(host); if (host->bus_ops && !host->bus_dead) { if (host->bus_ops->remove) host->bus_ops->remove(host); mmc_claim_host(host); mmc_detach_bus(host); mmc_release_host(host); } mmc_bus_put(host); BUG_ON(host->card); mmc_power_off(host); }
/** * mmc_suspend_host - suspend a host * @host: mmc host * @state: suspend mode (PM_SUSPEND_xxx) */ int mmc_suspend_host(struct mmc_host *host, pm_message_t state) { int err = 0; cancel_delayed_work(&host->detect); #ifdef CONFIG_MMC_AUTO_SUSPEND cancel_delayed_work(&host->auto_suspend); #endif if (mmc_bus_needs_resume(host)) return 0; cancel_delayed_work(&host->detect); mmc_flush_scheduled_work(); mmc_bus_get(host); if (host->bus_ops && !host->bus_dead) { if (host->bus_ops->suspend) err = host->bus_ops->suspend(host); if (err == -ENOSYS || !host->bus_ops->resume) { if (host->bus_ops->remove) host->bus_ops->remove(host); mmc_claim_host(host); mmc_detach_bus(host); mmc_release_host(host); err = 0; } } mmc_bus_put(host); if (!err) mmc_power_off(host); host->last_suspend_error = err; return err; }
/** * mmc_suspend_host - suspend a host * @host: mmc host * @state: suspend mode (PM_SUSPEND_xxx) */ int mmc_suspend_host(struct mmc_host *host, pm_message_t state) { if (mmc_bus_needs_resume(host)) return 0; cancel_delayed_work(&host->detect); mmc_flush_scheduled_work(); #ifdef CVKK_SUSPEND_FIX /* Wait for pending wakelock to expire */ while (wake_lock_active(&mmc_delayed_work_wake_lock)) { msleep(100); } #endif mmc_bus_get(host); if (host->bus_ops && !host->bus_dead) { if (host->bus_ops->suspend) host->bus_ops->suspend(host); if (!host->bus_ops->resume) { if (host->bus_ops->remove) host->bus_ops->remove(host); mmc_claim_host(host); mmc_detach_bus(host); mmc_release_host(host); } } mmc_bus_put(host); mmc_power_off(host); return 0; }
void mmc_stop_host(struct mmc_host *host) { #ifdef CONFIG_MMC_DEBUG unsigned long flags; spin_lock_irqsave(&host->lock, flags); host->removed = 1; spin_unlock_irqrestore(&host->lock, flags); #endif if (host->caps & MMC_CAP_DISABLE) cancel_delayed_work(&host->disable); if (unlikely(cancel_delayed_work(&host->detect))) { atomic_dec(&wakelock_refs); } mmc_flush_scheduled_work(); mmc_bus_get(host); if (host->bus_ops && !host->bus_dead) { if (host->bus_ops->remove) host->bus_ops->remove(host); mmc_claim_host(host); mmc_detach_bus(host); mmc_release_host(host); mmc_bus_put(host); return; } mmc_bus_put(host); BUG_ON(host->card); mmc_power_off(host); }
/** * mmc_suspend_host - suspend a host * @host: mmc host * @state: suspend mode (PM_SUSPEND_xxx) */ int mmc_suspend_host(struct mmc_host *host, pm_message_t state) { int err = 0; printk("DBG::mmc_suspend_host\n"); if (host->caps & MMC_CAP_DISABLE) cancel_delayed_work(&host->disable); cancel_delayed_work(&host->detect); mmc_flush_scheduled_work(); mmc_bus_get(host); if (host->bus_ops && !host->bus_dead) { if (host->bus_ops->suspend) err = host->bus_ops->suspend(host); if (err == -ENOSYS || !host->bus_ops->resume) { /* * We simply "remove" the card in this case. * It will be redetected on resume. */ if (host->bus_ops->remove) host->bus_ops->remove(host); mmc_claim_host(host); mmc_detach_bus(host); mmc_release_host(host); err = 0; } } mmc_bus_put(host); if (!err) mmc_power_off(host); return err; }
/** * mmc_suspend_host - suspend a host * @host: mmc host */ int mmc_suspend_host(struct mmc_host *host) { int err = 0; if (mmc_bus_needs_resume(host)) return 0; if (host->caps & MMC_CAP_DISABLE) cancel_delayed_work(&host->disable); cancel_delayed_work(&host->detect); mmc_flush_scheduled_work(); mmc_bus_get(host); if (host->bus_ops && !host->bus_dead) { if (host->bus_ops->suspend && (host->bus_resume_flags & MMC_NEEDS_UNSAFE_RESUME)) err = host->bus_ops->suspend(host); } mmc_bus_put(host); if (!err && !(host->pm_flags & MMC_PM_KEEP_POWER)) mmc_power_off(host); return err; }
void mmc_stop_host(struct mmc_host *host) { #ifdef CONFIG_MMC_DEBUG unsigned long flags; spin_lock_irqsave(&host->lock, flags); host->removed = 1; spin_unlock_irqrestore(&host->lock, flags); #endif if (host->caps & MMC_CAP_DISABLE) cancel_delayed_work(&host->disable); cancel_delayed_work(&host->detect); mmc_flush_scheduled_work(); /* clear pm flags now and let card drivers set them as needed */ host->pm_flags = 0; mmc_bus_get(host); if (host->bus_ops && !host->bus_dead) { if (host->bus_ops->remove) host->bus_ops->remove(host); mmc_claim_host(host); mmc_detach_bus(host); mmc_release_host(host); mmc_bus_put(host); return; } mmc_bus_put(host); BUG_ON(host->card); mmc_power_off(host); }
/** * mmc_suspend_host - suspend a host * @host: mmc host * @state: suspend mode (PM_SUSPEND_xxx) */ int mmc_suspend_host(struct mmc_host *host, pm_message_t state) { mmc_flush_scheduled_work(); mmc_bus_get(host); if (host->bus_ops && !host->bus_dead) { if (host->bus_ops->remove) host->bus_ops->remove(host); mmc_detach_bus(host); } mmc_bus_put(host); BUG_ON(host->card); mmc_power_off(host); return 0; }
/** * mmc_suspend_host - suspend a host * @host: mmc host * @state: suspend mode (PM_SUSPEND_xxx) */ int mmc_suspend_host(struct mmc_host *host, pm_message_t state) { int err = 0; if (mmc_bus_needs_resume(host)) return 0; if (host->caps & MMC_CAP_DISABLE) cancel_delayed_work(&host->disable); if (unlikely(cancel_delayed_work(&host->detect))) { atomic_dec(&wakelock_refs); } mmc_flush_scheduled_work(); mmc_bus_get(host); if (host->bus_ops && !host->bus_dead) { if (host->bus_ops->suspend) err = host->bus_ops->suspend(host); if (err == -ENOSYS || !host->bus_ops->resume) { /* * We simply "remove" the card in this case. * It will be redetected on resume. */ if (host->bus_ops->remove) host->bus_ops->remove(host); mmc_claim_host(host); mmc_detach_bus(host); mmc_release_host(host); err = 0; } } mmc_bus_put(host); if (!host->card || host->card->type != MMC_TYPE_SDIO) { if (!err) mmc_power_off(host); } else if(!host->card || host->card->type == MMC_TYPE_SDIO) { is_mmc_resume = 1; } return err; }
/** * mmc_suspend_host - suspend a host * @host: mmc host */ int mmc_suspend_host(struct mmc_host *host) { int err = 0; if (mmc_bus_needs_resume(host)) return 0; if (host->caps & MMC_CAP_DISABLE) cancel_delayed_work(&host->disable); cancel_delayed_work(&host->detect); mmc_flush_scheduled_work(); mmc_bus_get(host); if (host->bus_ops && !host->bus_dead) { if (host->bus_ops->suspend) err = host->bus_ops->suspend(host); if (err == -ENOSYS || !host->bus_ops->resume) { /* * We simply "remove" the card in this case. * It will be redetected on resume. */ if (host->bus_ops->remove) host->bus_ops->remove(host); mmc_claim_host(host); mmc_detach_bus(host); mmc_release_host(host); host->pm_flags = 0; err = 0; } } #ifdef CONFIG_PM_RUNTIME if (mmc_bus_manual_resume(host)) host->bus_resume_flags |= MMC_BUSRESUME_NEEDS_RESUME; #endif mmc_bus_put(host); if (!err && !(host->pm_flags & MMC_PM_KEEP_POWER)) mmc_power_off(host); return err; }
/** * mmc_suspend_host - suspend a host * @host: mmc host * @state: suspend mode (PM_SUSPEND_xxx) */ int mmc_suspend_host(struct mmc_host *host, pm_message_t state) { int err = 0; if (host->caps & MMC_CAP_DISABLE) cancel_delayed_work(&host->disable); cancel_delayed_work(&host->detect); mmc_flush_scheduled_work(); mmc_bus_get(host); if (host->bus_ops && !host->bus_dead) { if (host->bus_ops->suspend) err = host->bus_ops->suspend(host); } mmc_bus_put(host); if (!err && !(host->pm_flags & MMC_PM_KEEP_POWER)) mmc_power_off(host); return err; }
static void s3c24xx_irq_cd_handler( void *param ) { struct mmc_host *host=(struct mmc_host *) param; /* We want the MMC/SD stack to redetect if this IRQ goes off. To do this */ /* we remove the bus when this IRQ occurs. mmc_detect_change will then */ /* make sure the bus is reenumerated. */ mmc_flush_scheduled_work(); mmc_bus_get(host); if (host->bus_ops && !host->bus_dead) { if (host->bus_ops->remove) host->bus_ops->remove(host); mmc_claim_host(host); mmc_detach_bus(host); mmc_release_host(host); } mmc_bus_put(host); mmc_detect_change( host, HZ/10 ); return; }
/** * mmc_suspend_host - suspend a host * @host: mmc host */ int mmc_suspend_host(struct mmc_host *host) { int err = 0; if (mmc_bus_needs_resume(host)) return 0; if (host->caps & MMC_CAP_DISABLE) cancel_delayed_work(&host->disable); if (unlikely(cancel_delayed_work(&host->detect))) { atomic_dec(&wakelock_refs); } mmc_flush_scheduled_work(); mmc_bus_get(host); if (host->bus_ops && !host->bus_dead) { if (host->bus_ops->suspend) err = host->bus_ops->suspend(host); if (err == -ENOSYS || !host->bus_ops->resume) { /* * We simply "remove" the card in this case. * It will be redetected on resume. */ if (host->bus_ops->remove) host->bus_ops->remove(host); mmc_claim_host(host); mmc_detach_bus(host); mmc_release_host(host); host->pm_flags = 0; err = 0; } } mmc_bus_put(host); if (!err && !(host->pm_flags & MMC_PM_KEEP_POWER)) mmc_power_off(host); return err; }
/** * mmc_suspend_host - suspend a host * @host: mmc host * @state: suspend mode (PM_SUSPEND_xxx) */ int mmc_suspend_host(struct mmc_host *host, pm_message_t state) { #if 0 // kimhyuns remove to recognize card // for issue fix for ecim G0100145817 if(host->bus_dead ) #else if((host->bus_dead) && (host->index!=0)) #endif { printk("No Suspend resume in case of bus-dead if init failed (%s) \r\n",__FUNCTION__); return 0; } printk("Soni calling mmc_flush_scheduled_work (%s)",__FUNCTION__); mmc_flush_scheduled_work(); mmc_bus_get(host); if (host->bus_ops && !host->bus_dead) { if (host->bus_ops->suspend) host->bus_ops->suspend(host); if (!host->bus_ops->resume) { if (host->bus_ops->remove) host->bus_ops->remove(host); mmc_claim_host(host); mmc_detach_bus(host); mmc_release_host(host); } } mmc_bus_put(host); if (host->card && mmc_card_sdio(host->card)) { //ijihyun.jung -Sec VinsQ printk("mmc%d:mmc_suspend_host: skip mmc_power_off()\n", host->index); } else { mmc_power_off(host); } return 0; }
/** * mmc_suspend_host - suspend a host * @host: mmc host * @state: suspend mode (PM_SUSPEND_xxx) */ int mmc_suspend_host(struct mmc_host *host, pm_message_t state) { int err = 0; if (mmc_bus_needs_resume(host)) return 0; //B: Robert, 20101006, KB62_CR766 : Fix unexpectedly remove SD card issue cancel_delayed_work(&host->detect); mmc_flush_scheduled_work(); //E: Robert, 20101006, KB62_CR766 if (host->caps & MMC_CAP_DISABLE) cancel_delayed_work(&host->disable); mmc_bus_get(host); if (host->bus_ops && !host->bus_dead) { if (host->bus_ops->suspend) err = host->bus_ops->suspend(host); //B: Robert, 20101006, KB62_CR766 : Fix unexpectedly remove SD card issue if (!host->bus_ops->resume) { if (host->bus_ops->remove) host->bus_ops->remove(host); mmc_claim_host(host); mmc_detach_bus(host); mmc_release_host(host); } //E: Robert, 20101006, KB62_CR766 } mmc_bus_put(host); if (!err) mmc_power_off(host); return err; }
/** * mmc_suspend_host - suspend a host * @host: mmc host */ int mmc_suspend_host(struct mmc_host *host) { int err = 0; if (mmc_bus_needs_resume(host)) return 0; if (host->caps & MMC_CAP_DISABLE) cancel_delayed_work(&host->disable); cancel_delayed_work(&host->detect); mmc_flush_scheduled_work(); mmc_bus_get(host); if (host->bus_ops && !host->bus_dead) { if (host->bus_ops->suspend) err = host->bus_ops->suspend(host); } mmc_bus_put(host); #ifndef CONFIG_WILINK_NLCP if (!err && !(host->pm_flags & MMC_PM_KEEP_POWER)) #else if (!err && !mmc_card_keep_power(host)) #endif { if(suspend_debug) printk("P off mmc \n"); mmc_power_off(host); } if(host->nesting_cnt < 0) // Mahesh non line fetch patch host->nesting_cnt = 0; return err; }
/** * mmc_suspend_host - suspend a host * @host: mmc host */ int mmc_suspend_host(struct mmc_host *host) { int err = 0; if (mmc_bus_needs_resume(host)) return 0; if (host->caps & MMC_CAP_DISABLE) cancel_delayed_work(&host->disable); cancel_delayed_work(&host->detect); mmc_flush_scheduled_work(); mmc_bus_get(host); if (host->bus_ops && !host->bus_dead) { /* * A long response time is not acceptable for device drivers * when doing suspend. Prevent mmc_claim_host in the suspend * sequence, to potentially wait "forever" by trying to * pre-claim the host. * * Skip try claim host for SDIO cards, doing so fixes deadlock * conditions. The function driver suspend may again call into * SDIO driver within a different context for enabling power * save mode in the card and hence wait in mmc_claim_host * causing deadlock. */ if (!(host->card && mmc_card_sdio(host->card))) if (!mmc_try_claim_host(host)) err = -EBUSY; if (!err) { if (host->bus_ops->suspend) err = host->bus_ops->suspend(host); if (!(host->card && mmc_card_sdio(host->card))) mmc_do_release_host(host); if (err == -ENOSYS || !host->bus_ops->resume) { /* * We simply "remove" the card in this case. * It will be redetected on resume. */ if (host->bus_ops->remove) host->bus_ops->remove(host); mmc_claim_host(host); mmc_detach_bus(host); mmc_power_off(host); mmc_release_host(host); host->pm_flags = 0; err = 0; } } } #ifdef CONFIG_PM_RUNTIME if (mmc_bus_manual_resume(host)) host->bus_resume_flags |= MMC_BUSRESUME_NEEDS_RESUME; #endif mmc_bus_put(host); if (!err && !(host->pm_flags & MMC_PM_KEEP_POWER)) mmc_power_off(host); return err; }