cyttsp: fix touchscreen not working after S3 resume
authorHong Liu <hong.liu@intel.com>
Mon, 25 Apr 2011 05:05:53 +0000 (13:05 +0800)
committermgross <mark.gross@intel.com>
Wed, 9 Nov 2011 20:37:48 +0000 (12:37 -0800)
BZ:1101

Gaurd the cyttsp core suspend function with the suspended state,
and move the legacy suspend/resume to the new dev_pm_ops.

Change-Id: Iaadd8935e94b27b8a985ac6b8bcf4de48a1ed7a5
Signed-off-by: Hong Liu <hong.liu@intel.com>
drivers/input/touchscreen/cyttsp_core.c
drivers/input/touchscreen/cyttsp_i2c.c

index 8673494..fe9ea9d 100644 (file)
@@ -1371,7 +1371,7 @@ int cyttsp_suspend(void *handle)
        dev_dbg(ts->pdev, "%s: enter\n", __func__);
        mutex_lock(&ts->mutex);
 
-       if (!ts->fw_loader_mode) {
+       if (!ts->fw_loader_mode && !ts->suspended) {
                if (ts->platform_data->use_timer) {
                        del_timer(&ts->timer);
                        cancel_work_sync(&ts->work);
index 2af3ad2..921a897 100644 (file)
@@ -121,18 +121,23 @@ static int __devexit cyttsp_i2c_remove(struct i2c_client *client)
        return 0;
 }
 
-#ifdef CONFIG_PM
-static int cyttsp_i2c_suspend(struct i2c_client *client, pm_message_t message)
+#ifdef CONFIG_PM_SLEEP
+static int cyttsp_i2c_suspend(struct device *dev)
 {
-       return cyttsp_suspend(dev_get_drvdata(&client->dev));
+       return cyttsp_suspend(dev_get_drvdata(dev));
 }
 
-static int cyttsp_i2c_resume(struct i2c_client *client)
+static int cyttsp_i2c_resume(struct device *dev)
 {
-       return cyttsp_resume(dev_get_drvdata(&client->dev));
+       return cyttsp_resume(dev_get_drvdata(dev));
 }
 #endif
 
+static const struct dev_pm_ops cyttsp_i2c_pm = {
+       SET_SYSTEM_SLEEP_PM_OPS(cyttsp_i2c_suspend,
+                               cyttsp_i2c_resume)
+};
+
 static const struct i2c_device_id cyttsp_i2c_id[] = {
        { "cy8ctma340", 0 },  { }
 };
@@ -141,14 +146,11 @@ static struct i2c_driver cyttsp_i2c_driver = {
        .driver = {
                .name = CY_I2C_NAME,
                .owner = THIS_MODULE,
+               .pm = &cyttsp_i2c_pm,
        },
        .probe = cyttsp_i2c_probe,
        .remove = __devexit_p(cyttsp_i2c_remove),
        .id_table = cyttsp_i2c_id,
-#ifdef CONFIG_PM
-       .suspend = cyttsp_i2c_suspend,
-       .resume = cyttsp_i2c_resume,
-#endif
 };
 
 static int cyttsp_i2c_init(void)