i2c/tsl2550: Add power management added
authorRodolfo Giometti <giometti@enneenne.com>
Sun, 27 Jan 2008 17:14:45 +0000 (18:14 +0100)
committerJean Delvare <khali@hyperion.delvare>
Sun, 27 Jan 2008 17:14:45 +0000 (18:14 +0100)
Signed-off-by: Rodolfo Giometti <giometti@linux.it>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
drivers/i2c/chips/tsl2550.c

index 3de4b19ba08f3861876c41be08983ef0cc68d446..a10fd2791a69ab938eb214bd2376a02c76749959 100644 (file)
@@ -432,11 +432,32 @@ static int __devexit tsl2550_remove(struct i2c_client *client)
        return 0;
 }
 
+#ifdef CONFIG_PM
+
+static int tsl2550_suspend(struct i2c_client *client, pm_message_t mesg)
+{
+       return tsl2550_set_power_state(client, 0);
+}
+
+static int tsl2550_resume(struct i2c_client *client)
+{
+       return tsl2550_set_power_state(client, 1);
+}
+
+#else
+
+#define tsl2550_suspend                NULL
+#define tsl2550_resume         NULL
+
+#endif /* CONFIG_PM */
+
 static struct i2c_driver tsl2550_driver = {
        .driver = {
                .name   = TSL2550_DRV_NAME,
                .owner  = THIS_MODULE,
        },
+       .suspend = tsl2550_suspend,
+       .resume = tsl2550_resume,
        .probe  = tsl2550_probe,
        .remove = __devexit_p(tsl2550_remove),
 };