summaryrefslogtreecommitdiff
path: root/drivers/input/touchscreen/elan_ts.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/touchscreen/elan_ts.c')
-rw-r--r--drivers/input/touchscreen/elan_ts.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/elan_ts.c b/drivers/input/touchscreen/elan_ts.c
index fd85c1b33b7c..9f200ebcbf7e 100644
--- a/drivers/input/touchscreen/elan_ts.c
+++ b/drivers/input/touchscreen/elan_ts.c
@@ -406,6 +406,33 @@ static const struct i2c_device_id elan_touch_id[] = {
{}
};
+static int elan_suspend(struct device *dev)
+{
+ return 0;
+}
+
+static int elan_resume(struct device *dev)
+{
+ uint8_t buf[IDX_PACKET_SIZE] = { 0 };
+
+ if (0 == elan_touch_detect_int_level()) {
+ dev_dbg(dev, "Got touch during suspend period.\n");
+ /*
+ * if touch screen during suspend, recv and drop the
+ * data, then touch interrupt pin will return high after
+ * receving data.
+ */
+ elan_touch_recv_data(elan_touch_data.client, buf);
+ }
+
+ return 0;
+}
+
+static const struct dev_pm_ops elan_dev_pm_ops = {
+ .suspend = elan_suspend,
+ .resume = elan_resume,
+};
+
static struct i2c_driver elan_touch_driver = {
.probe = elan_touch_probe,
.remove = elan_touch_remove,
@@ -413,6 +440,9 @@ static struct i2c_driver elan_touch_driver = {
.driver = {
.name = "elan-touch",
.owner = THIS_MODULE,
+#ifdef CONFIG_PM
+ .pm = &elan_dev_pm_ops,
+#endif
},
};