Log
        HXD8/GTA01/GTA02:       In previous vanilla kernel, 2.6.18, call-back
function of i2c device could be entered. But i2c_device_suspend() in
i2c-core.c had some changes in 2.6.21 which result in suspend function
of i2c device such as PCF50606 can't work. 

Index: linux-2.6.21/drivers/i2c/chips/pcf50606.c
===================================================================
--- linux-2.6.21.orig/drivers/i2c/chips/pcf50606.c	2007-06-21 11:40:59.000000000 +0800
+++ linux-2.6.21/drivers/i2c/chips/pcf50606.c	2007-06-21 15:56:05.000000000 +0800
@@ -1777,9 +1777,8 @@
 #define INT1M_RESUMERS	(PCF50606_INT1_ALARM|PCF50606_INT1_ONKEYF|PCF50606_INT1_EXTONR)
 #define INT2M_RESUMERS	(PCF50606_INT2_CHGWD10S|PCF50606_INT2_CHGPROT|PCF50606_INT2_CHGERR)
 #define INT3M_RESUMERS	(PCF50606_INT3_LOWBAT|PCF50606_INT3_HIGHTMP|PCF50606_INT3_ACDINS)
-static int pcf50606_suspend(struct device *dev, pm_message_t state)
+static int pcf50606_suspend(struct i2c_client *client, pm_message_t state)
 {
-	struct i2c_client *client = to_i2c_client(dev);
 	struct pcf50606_data *pcf = i2c_get_clientdata(client);
 	int i;
 
@@ -1834,9 +1833,8 @@
 	return 0;
 }
 
-static int pcf50606_resume(struct device *dev)
+static int pcf50606_resume(struct i2c_client *client)
 {
-	struct i2c_client *client = to_i2c_client(dev);
 	struct pcf50606_data *pcf = i2c_get_clientdata(client);
 
 	mutex_lock(&pcf->lock);
@@ -1871,12 +1869,12 @@
 static struct i2c_driver pcf50606_driver = {
 	.driver = {
 		.name	= "pcf50606",
-		.suspend= &pcf50606_suspend,
-		.resume	= &pcf50606_resume,
 	},
 	.id		= I2C_DRIVERID_PCF50606,
 	.attach_adapter	= &pcf50606_attach_adapter,
 	.detach_client	= &pcf50606_detach_client,
+	.suspend= &pcf50606_suspend,
+	.resume	= &pcf50606_resume,
 };
 
 /* platform driver, since i2c devices don't have platform_data */
Index: linux-2.6.21/drivers/i2c/chips/tsl256x.c
===================================================================
--- linux-2.6.21.orig/drivers/i2c/chips/tsl256x.c	2007-06-21 14:56:49.000000000 +0800
+++ linux-2.6.21/drivers/i2c/chips/tsl256x.c	2007-06-21 14:58:35.000000000 +0800
@@ -255,9 +255,8 @@
 }
 
 #ifdef CONFIG_PM
-static int tsl256x_suspend(struct device *dev, pm_message_t state)
+static int tsl256x_suspend(struct i2c_client *client, pm_message_t state)
 {
-	struct i2c_client *client = to_i2c_client(dev);
 	struct tsl256x_data *tsl256x = i2c_get_clientdata(client);
 
 	/* Power down TSL256X. */
@@ -266,9 +265,8 @@
 	return 0;
 }
 
-static int tsl256x_resume(struct device *dev)
+static int tsl256x_resume(struct i2c_client *client)
 {
-	struct i2c_client *client = to_i2c_client(dev);
 	struct tsl256x_data *tsl256x = i2c_get_clientdata(client);
 
 	/* Power up TSL256X. */
@@ -282,14 +280,14 @@
 	.driver = {
 		.name		= "tsl256x",
 		.owner		= THIS_MODULE,
-#ifdef CONFIG_PM
-		.suspend	= &tsl256x_suspend,
-		.resume		= &tsl256x_resume,
-#endif
 	},
 	.id				= I2C_DRIVERID_TSL256X,
 	.attach_adapter	= &tsl256x_attach_adapter,
-	.detach_client	= &tsl256x_detach_client,
+	.detach_client	= &tsl256x_detach_client,	
+#ifdef CONFIG_PM
+	.suspend	= &tsl256x_suspend,
+	.resume		= &tsl256x_resume,
+#endif
 };
 
 static int __init tsl256x_init(void)
Index: linux-2.6.21/drivers/i2c/chips/pcf50633.c
===================================================================
--- linux-2.6.21.orig/drivers/i2c/chips/pcf50633.c	2007-06-21 13:42:59.000000000 +0800
+++ linux-2.6.21/drivers/i2c/chips/pcf50633.c	2007-06-21 16:05:57.000000000 +0800
@@ -1524,9 +1524,8 @@
 			 PCF50633_INT4_HIGHTMP)
 #define INT5M_RESUMERS	(0)
 
-static int pcf50633_suspend(struct device *dev, pm_message_t state)
+static int pcf50633_suspend(struct i2c_client *client, pm_message_t state)
 {
-	struct i2c_client *client = to_i2c_client(dev);
 	struct pcf50633_data *pcf = i2c_get_clientdata(client);
 	int i;
 
@@ -1587,9 +1586,8 @@
 	return 0;
 }
 
-static int pcf50633_resume(struct device *dev)
+static int pcf50633_resume(struct i2c_client *client)
 {
-	struct i2c_client *client = to_i2c_client(dev);
 	struct pcf50633_data *pcf = i2c_get_clientdata(client);
 	int i;
 
@@ -1633,12 +1631,12 @@
 static struct i2c_driver pcf50633_driver = {
 	.driver = {
 		.name	= "pcf50633",
-		.suspend= &pcf50633_suspend,
-		.resume	= &pcf50633_resume,
 	},
 	.id		= I2C_DRIVERID_PCF50633,
 	.attach_adapter	= &pcf50633_attach_adapter,
 	.detach_client	= &pcf50633_detach_client,
+	.suspend= &pcf50633_suspend,
+	.resume	= &pcf50633_resume,
 };
 
 /* platform driver, since i2c devices don't have platform_data */

Reply via email to