* [patch] i2c bus power management support
@ 2004-10-08 10:44 Gerd Knorr
0 siblings, 0 replies; only message in thread
From: Gerd Knorr @ 2004-10-08 10:44 UTC (permalink / raw)
To: Andrew Morton, Greg KH, Kernel List
Hi,
The patch below adds power management support to the i2c bus.
It adds just two small functions which call down to the devices
power management functions if they are present, so the i2c device
drivers will receive the suspend and resume events.
Gerd
Index: linux-2.6.8/drivers/i2c/i2c-core.c
===================================================================
--- linux-2.6.8.orig/drivers/i2c/i2c-core.c 2004-08-18 12:11:55.000000000 +0200
+++ linux-2.6.8/drivers/i2c/i2c-core.c 2004-10-08 12:38:55.075642304 +0200
@@ -517,9 +517,29 @@ static int i2c_device_match(struct devic
return 1;
}
+static int i2c_bus_suspend(struct device * dev, u32 state)
+{
+ int rc = 0;
+
+ if (dev->driver && dev->driver->suspend)
+ rc = dev->driver->suspend(dev,state,0);
+ return rc;
+}
+
+static int i2c_bus_resume(struct device * dev)
+{
+ int rc = 0;
+
+ if (dev->driver && dev->driver->resume)
+ rc = dev->driver->resume(dev,0);
+ return rc;
+}
+
struct bus_type i2c_bus_type = {
.name = "i2c",
.match = i2c_device_match,
+ .suspend = i2c_bus_suspend,
+ .resume = i2c_bus_resume,
};
static int __init i2c_init(void)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-10-08 11:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-08 10:44 [patch] i2c bus power management support Gerd Knorr
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox