Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8259293a authored by Ulf Hansson's avatar Ulf Hansson Committed by Russell King
Browse files

ARM: 7622/1: mmc: mmci: Gate the clock in runtime suspend to save power



The amba bus is already performing same actions but for the apb_pclk.
So here we just make sure the clock to card is gated as well to save
more power. At runtime resume we will thus restore the clock again.

Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
Acked-by: default avatarKevin Liu <kliu5@marvell.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 599c1d5c
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -1614,8 +1614,37 @@ static int mmci_resume(struct device *dev)
}
#endif

#ifdef CONFIG_PM_RUNTIME
static int mmci_runtime_suspend(struct device *dev)
{
	struct amba_device *adev = to_amba_device(dev);
	struct mmc_host *mmc = amba_get_drvdata(adev);

	if (mmc) {
		struct mmci_host *host = mmc_priv(mmc);
		clk_disable_unprepare(host->clk);
	}

	return 0;
}

static int mmci_runtime_resume(struct device *dev)
{
	struct amba_device *adev = to_amba_device(dev);
	struct mmc_host *mmc = amba_get_drvdata(adev);

	if (mmc) {
		struct mmci_host *host = mmc_priv(mmc);
		clk_prepare_enable(host->clk);
	}

	return 0;
}
#endif

static const struct dev_pm_ops mmci_dev_pm_ops = {
	SET_SYSTEM_SLEEP_PM_OPS(mmci_suspend, mmci_resume)
	SET_RUNTIME_PM_OPS(mmci_runtime_suspend, mmci_runtime_resume, NULL)
};

static struct amba_id mmci_ids[] = {