>From 7f7a877143abc25a02879918a79d87c736268bb4 Mon Sep 17 00:00:00 2001 From: Denis Robert <[email protected]> Date: Wed, 20 Oct 2010 18:19:42 +0200 Subject: [PATCH 18/26] mmc: add runtime PM handlers
Add MMC runtime PM handlers, which call mmc_power_save_host and mmc_power_restore_host in response to runtime_suspend and runtime_resume events. Runtime PM is still disabled by default, so this patch alone has no immediate effect. Signed-off-by: Ohad Ben-Cohen <[email protected]> Signed-off-by: Denis Robert <[email protected]> Signed-off-by: Claude Brouat <[email protected]> --- drivers/mmc/core/bus.c | 37 +++++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 49d9dca..551eecc 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -14,6 +14,7 @@ #include <linux/device.h> #include <linux/err.h> #include <linux/slab.h> +#include <linux/pm_runtime.h> #include <linux/mmc/card.h> #include <linux/mmc/host.h> @@ -137,6 +138,41 @@ static int mmc_bus_resume(struct device *dev) return ret; } +#ifdef CONFIG_PM_RUNTIME + +static int mmc_runtime_suspend(struct device *dev) +{ + struct mmc_card *card = dev_to_mmc_card(dev); + + return mmc_power_save_host(card->host); +} + +static int mmc_runtime_resume(struct device *dev) +{ + struct mmc_card *card = dev_to_mmc_card(dev); + + return mmc_power_restore_host(card->host); +} + +static int mmc_runtime_idle(struct device *dev) +{ + return pm_runtime_suspend(dev); +} + +static const struct dev_pm_ops mmc_bus_pm_ops = { + .runtime_suspend = mmc_runtime_suspend, + .runtime_resume = mmc_runtime_resume, + .runtime_idle = mmc_runtime_idle, +}; + +#define MMC_PM_OPS_PTR (&mmc_bus_pm_ops) + +#else /* !CONFIG_PM_RUNTIME */ + +#define MMC_PM_OPS_PTR NULL + +#endif /* !CONFIG_PM_RUNTIME */ + static struct bus_type mmc_bus_type = { .name = "mmc", .dev_attrs = mmc_dev_attrs, @@ -146,6 +182,7 @@ static struct bus_type mmc_bus_type = { .remove = mmc_bus_remove, .suspend = mmc_bus_suspend, .resume = mmc_bus_resume, + .pm = MMC_PM_OPS_PTR, }; int mmc_register_bus(void) -- 1.6.3.3 Claude BROUAT UMG/MIPE/WSIV System Integrator Office: +33 (0)1 72 21 04 54 mailto: mailto:[email protected] Intel Corp. SAS 134, av du Général Eisenhower BP 73586 31100 TOULOUSE France --------------------------------------------------------------------- Intel Corporation SAS (French simplified joint stock company) Registered headquarters: "Les Montalets"- 2, rue de Paris, 92196 Meudon Cedex, France Registration Number: 302 456 199 R.C.S. NANTERRE Capital: 4,572,000 Euros This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
0018-mmc-add-runtime-PM-handlers.patch
Description: 0018-mmc-add-runtime-PM-handlers.patch
_______________________________________________ Meego-kernel mailing list [email protected] http://lists.meego.com/listinfo/meego-kernel
