diff options
author | Ulf Hansson <ulf.hansson@stericsson.com> | 2011-12-05 18:36:00 +0100 |
---|---|---|
committer | Philippe Langlais <philippe.langlais@stericsson.com> | 2012-05-22 11:03:00 +0200 |
commit | 1822dc467592a9bc31f92dec9a9fb7b8b91e31bb (patch) | |
tree | 8542adab3c4e8e27ba9985bdbb5c495262ed6a86 | |
parent | 0c13ac50ca4263239e4937ae560ffe79f1c9e7c9 (diff) |
mmc: mmci: Use ios_handler to save power
To disable a levelshifter when we are in an idle state will
decrease current consumption. We make use of the ios_handler
at runtime suspend and at regular suspend to accomplish this.
Of course depending on the used levelshifter the decrease of
current differs. For ST6G3244ME the value is up to ~200 uA.
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Change-Id: Ie782d3af7932730c442dcb6c7f12b2f69dcac75e
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/44399
Reviewed-by: QABUILD
Reviewed-by: QATEST
-rw-r--r-- | drivers/mmc/host/mmci.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 70ae28efb3c..6c810d4f36a 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -1562,10 +1562,22 @@ static int mmci_save(struct amba_device *dev) { struct mmc_host *mmc = amba_get_drvdata(dev); unsigned long flags; + struct mmc_ios ios; + int ret = 0; if (mmc) { struct mmci_host *host = mmc_priv(mmc); + /* Let the ios_handler act on a POWER_OFF to save power. */ + if (host->plat->ios_handler) { + memcpy(&ios, &mmc->ios, sizeof(struct mmc_ios)); + ios.power_mode = MMC_POWER_OFF; + ret = host->plat->ios_handler(mmc_dev(mmc), + &ios); + if (ret) + return ret; + } + spin_lock_irqsave(&host->lock, flags); /* @@ -1583,7 +1595,7 @@ static int mmci_save(struct amba_device *dev) amba_vcore_disable(dev); } - return 0; + return ret; } static int mmci_restore(struct amba_device *dev) @@ -1605,6 +1617,11 @@ static int mmci_restore(struct amba_device *dev) writel(MCI_IRQENABLE, host->base + MMCIMASK0); spin_unlock_irqrestore(&host->lock, flags); + + /* Restore settings done by the ios_handler. */ + if (host->plat->ios_handler) + host->plat->ios_handler(mmc_dev(mmc), + &mmc->ios); } return 0; |