summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/vio.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-04-07 18:09:15 +1000
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-04-07 18:09:15 +1000
commita32aaf14513da776556ad9995de8d83cd76ae60a (patch)
tree4c78e27fe922a18cff088e41e0fe0c615a870cde /arch/powerpc/kernel/vio.c
parent8260cf6f40014860cb857f5245194900dd6c9b94 (diff)
powerpc/vio: Add power management support
Adds support for suspend/resume for VIO devices. This is needed for support for HMC initiated hibernation. Signed-off-by: Brian King <brking@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/vio.c')
-rw-r--r--arch/powerpc/kernel/vio.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 2a3428bef83..b8e311d64ad 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -1381,6 +1381,29 @@ static int vio_hotplug(struct device *dev, struct kobj_uevent_env *env)
return 0;
}
+static int vio_pm_suspend(struct device *dev)
+{
+ const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
+
+ if (pm && pm->suspend)
+ return pm->suspend(dev);
+ return 0;
+}
+
+static int vio_pm_resume(struct device *dev)
+{
+ const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
+
+ if (pm && pm->resume)
+ return pm->resume(dev);
+ return 0;
+}
+
+const struct dev_pm_ops vio_dev_pm_ops = {
+ .suspend = vio_pm_suspend,
+ .resume = vio_pm_resume,
+};
+
static struct bus_type vio_bus_type = {
.name = "vio",
.dev_attrs = vio_dev_attrs,
@@ -1388,6 +1411,7 @@ static struct bus_type vio_bus_type = {
.match = vio_bus_match,
.probe = vio_bus_probe,
.remove = vio_bus_remove,
+ .pm = &vio_dev_pm_ops,
};
/**