|
|
0068283 |
From 109571cf3ec78a39477eedd6b11927f52cbcb1e8 Mon Sep 17 00:00:00 2001
|
|
|
0068283 |
From: Andrew Duggan <aduggan@synaptics.com>
|
|
|
0068283 |
Date: Fri, 11 Jul 2014 16:34:18 -0700
|
|
|
0068283 |
Subject: [PATCH] HID: i2c-hid: call the hid driver's suspend and resume
|
|
|
0068283 |
callbacks
|
|
|
0068283 |
|
|
|
0068283 |
Currently, the i2c-hid driver does not call the suspend, resume, and
|
|
|
0068283 |
reset_resume callbacks in the hid_driver struct when those events occur.
|
|
|
0068283 |
This means that HID drivers for i2c-hid devices will not be able to execute
|
|
|
0068283 |
commands which may be needed during suspend or resume. One example is when a
|
|
|
0068283 |
touchpad using the hid-multitouch driver gets reset by i2c-hid coming out of
|
|
|
0068283 |
resume. Since the reset_resume callback never gets called the device is never
|
|
|
0068283 |
put back into the correct input mode. This patch calls the suspend and resume
|
|
|
0068283 |
callbacks and tries to duplicate the functionality of the usb-hid driver.
|
|
|
0068283 |
|
|
|
0068283 |
Bugzilla: 1143812
|
|
|
0068283 |
Upstream-status: 3.17
|
|
|
0068283 |
|
|
|
0068283 |
Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
|
|
|
0068283 |
Signed-off-by: Vincent Huang <vincent.huang@tw.synaptics.com>
|
|
|
0068283 |
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
|
|
|
0068283 |
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
|
|
|
0068283 |
---
|
|
|
0068283 |
drivers/hid/i2c-hid/i2c-hid.c | 15 ++++++++++++++-
|
|
|
0068283 |
1 file changed, 14 insertions(+), 1 deletion(-)
|
|
|
0068283 |
|
|
|
0068283 |
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
|
|
|
0068283 |
index 21aafc8f48c8..747d54421e73 100644
|
|
|
0068283 |
--- a/drivers/hid/i2c-hid/i2c-hid.c
|
|
|
0068283 |
+++ b/drivers/hid/i2c-hid/i2c-hid.c
|
|
|
0068283 |
@@ -1054,21 +1054,29 @@ static int i2c_hid_remove(struct i2c_client *client)
|
|
|
0068283 |
static int i2c_hid_suspend(struct device *dev)
|
|
|
0068283 |
{
|
|
|
0068283 |
struct i2c_client *client = to_i2c_client(dev);
|
|
|
0068283 |
+ struct i2c_hid *ihid = i2c_get_clientdata(client);
|
|
|
0068283 |
+ struct hid_device *hid = ihid->hid;
|
|
|
0068283 |
+ int ret = 0;
|
|
|
0068283 |
|
|
|
0068283 |
disable_irq(client->irq);
|
|
|
0068283 |
if (device_may_wakeup(&client->dev))
|
|
|
0068283 |
enable_irq_wake(client->irq);
|
|
|
0068283 |
|
|
|
0068283 |
+ if (hid->driver && hid->driver->suspend)
|
|
|
0068283 |
+ ret = hid->driver->suspend(hid, PMSG_SUSPEND);
|
|
|
0068283 |
+
|
|
|
0068283 |
/* Save some power */
|
|
|
0068283 |
i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
|
|
|
0068283 |
|
|
|
0068283 |
- return 0;
|
|
|
0068283 |
+ return ret;
|
|
|
0068283 |
}
|
|
|
0068283 |
|
|
|
0068283 |
static int i2c_hid_resume(struct device *dev)
|
|
|
0068283 |
{
|
|
|
0068283 |
int ret;
|
|
|
0068283 |
struct i2c_client *client = to_i2c_client(dev);
|
|
|
0068283 |
+ struct i2c_hid *ihid = i2c_get_clientdata(client);
|
|
|
0068283 |
+ struct hid_device *hid = ihid->hid;
|
|
|
0068283 |
|
|
|
0068283 |
enable_irq(client->irq);
|
|
|
0068283 |
ret = i2c_hid_hwreset(client);
|
|
|
0068283 |
@@ -1078,6 +1086,11 @@ static int i2c_hid_resume(struct device *dev)
|
|
|
0068283 |
if (device_may_wakeup(&client->dev))
|
|
|
0068283 |
disable_irq_wake(client->irq);
|
|
|
0068283 |
|
|
|
0068283 |
+ if (hid->driver && hid->driver->reset_resume) {
|
|
|
0068283 |
+ ret = hid->driver->reset_resume(hid);
|
|
|
0068283 |
+ return ret;
|
|
|
0068283 |
+ }
|
|
|
0068283 |
+
|
|
|
0068283 |
return 0;
|
|
|
0068283 |
}
|
|
|
0068283 |
#endif
|
|
|
0068283 |
--
|
|
|
0068283 |
2.1.0
|
|
|
0068283 |
|