/* * Resume callback from host. * * This function tries to determine if the same card is still present * and, if so, restore all state to it. */ static int mmc_resume(struct mmc_host *host) { int err; BUG_ON(!host); BUG_ON(!host->card); mmc_claim_host(host); if (mmc_card_is_sleep(host->card)) { err = mmc_card_awake(host); mmc_card_clr_sleep(host->card); } else err = mmc_init_card(host, host->ocr, host->card); mmc_release_host(host); return err; }
/* Handler for [SLEEP -> ENABLED] transition */ static int omap_hsmmc_sleep_to_enabled(struct omap_hsmmc_host *host) { if (!mmc_try_claim_host(host->mmc)) return 0; clk_enable(host->fclk); omap_hsmmc_context_restore(host); if (mmc_slot(host).set_sleep) mmc_slot(host).set_sleep(host->dev, host->slot_id, 0, host->vdd, host->dpm_state == CARDSLEEP); if (mmc_card_can_sleep(host->mmc)) mmc_card_awake(host->mmc); dev_dbg(mmc_dev(host->mmc), "%s -> ENABLED\n", host->dpm_state == CARDSLEEP ? "CARDSLEEP" : "REGSLEEP"); host->dpm_state = ENABLED; mmc_release_host(host->mmc); return 0; }
/* Routine to resume the MMC device */ static int omap_mmc_resume(struct platform_device *pdev) { int ret = 0; struct mmc_omap_host *host = platform_get_drvdata(pdev); if (host && !host->suspended){ if (host->card_sleep){/*mmc is sleeping but mmc regulator power on*/ if (mmc_card_can_sleep(host->mmc)) mmc_card_awake(host->mmc); host->card_sleep = 0; } return 0; } if (host) { if (host->card_sleep){ host->card_sleep = 0; } if (host->pdata->resume) { ret = host->pdata->resume(&pdev->dev, host->slot_id); if (ret) dev_dbg(mmc_dev(host->mmc), "Unmask interrupt failed\n"); } /* Notify the core to resume the host */ ret = mmc_resume_host(host->mmc); if (ret == 0) host->suspended = 0; } return ret; }