[Meego-kernel] [PATCH 18/26] mmc: add runtime PM handlers
Brouat, Claude
claude.brouat at intel.com
Wed Oct 20 10:35:19 PDT 2010
>From 7f7a877143abc25a02879918a79d87c736268bb4 Mon Sep 17 00:00:00 2001
From: Denis Robert <denis.robert at intel.com>
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 <ohad at wizery.com>
Signed-off-by: Denis Robert <denis.robert at intel.com>
Signed-off-by: Claude Brouat <claude.brouat at intel.com>
---
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:claude.brouat at intel.com
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.meego.com/pipermail/meego-kernel/attachments/20101020/50ee406c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0018-mmc-add-runtime-PM-handlers.patch
Type: application/octet-stream
Size: 2195 bytes
Desc: 0018-mmc-add-runtime-PM-handlers.patch
URL: <http://lists.meego.com/pipermail/meego-kernel/attachments/20101020/50ee406c/attachment.obj>
More information about the Meego-kernel
mailing list