From 87f5a635f58e1decbf7de49cbd50902232ca2b4b Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Mon, 22 Sep 2014 08:56:35 -0400 Subject: [PATCH] Add patch to fix i2c-hid touchpad resume (rhbz 1143812) --- ...-the-hid-driver-s-suspend-and-resume.patch | 76 +++++++++++++++++++ kernel.spec | 9 +++ 2 files changed, 85 insertions(+) create mode 100644 HID-i2c-hid-call-the-hid-driver-s-suspend-and-resume.patch diff --git a/HID-i2c-hid-call-the-hid-driver-s-suspend-and-resume.patch b/HID-i2c-hid-call-the-hid-driver-s-suspend-and-resume.patch new file mode 100644 index 000000000..9fdc11b7f --- /dev/null +++ b/HID-i2c-hid-call-the-hid-driver-s-suspend-and-resume.patch @@ -0,0 +1,76 @@ +From 109571cf3ec78a39477eedd6b11927f52cbcb1e8 Mon Sep 17 00:00:00 2001 +From: Andrew Duggan +Date: Fri, 11 Jul 2014 16:34:18 -0700 +Subject: [PATCH] HID: i2c-hid: call the hid driver's suspend and resume + callbacks + +Currently, the i2c-hid driver does not call the suspend, resume, and +reset_resume callbacks in the hid_driver struct when those events occur. +This means that HID drivers for i2c-hid devices will not be able to execute +commands which may be needed during suspend or resume. One example is when a +touchpad using the hid-multitouch driver gets reset by i2c-hid coming out of +resume. Since the reset_resume callback never gets called the device is never +put back into the correct input mode. This patch calls the suspend and resume +callbacks and tries to duplicate the functionality of the usb-hid driver. + +Bugzilla: 1143812 +Upstream-status: 3.17 + +Signed-off-by: Andrew Duggan +Signed-off-by: Vincent Huang +Reviewed-by: Benjamin Tissoires +Signed-off-by: Jiri Kosina +--- + drivers/hid/i2c-hid/i2c-hid.c | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c +index 21aafc8f48c8..747d54421e73 100644 +--- a/drivers/hid/i2c-hid/i2c-hid.c ++++ b/drivers/hid/i2c-hid/i2c-hid.c +@@ -1054,21 +1054,29 @@ static int i2c_hid_remove(struct i2c_client *client) + static int i2c_hid_suspend(struct device *dev) + { + struct i2c_client *client = to_i2c_client(dev); ++ struct i2c_hid *ihid = i2c_get_clientdata(client); ++ struct hid_device *hid = ihid->hid; ++ int ret = 0; + + disable_irq(client->irq); + if (device_may_wakeup(&client->dev)) + enable_irq_wake(client->irq); + ++ if (hid->driver && hid->driver->suspend) ++ ret = hid->driver->suspend(hid, PMSG_SUSPEND); ++ + /* Save some power */ + i2c_hid_set_power(client, I2C_HID_PWR_SLEEP); + +- return 0; ++ return ret; + } + + static int i2c_hid_resume(struct device *dev) + { + int ret; + struct i2c_client *client = to_i2c_client(dev); ++ struct i2c_hid *ihid = i2c_get_clientdata(client); ++ struct hid_device *hid = ihid->hid; + + enable_irq(client->irq); + ret = i2c_hid_hwreset(client); +@@ -1078,6 +1086,11 @@ static int i2c_hid_resume(struct device *dev) + if (device_may_wakeup(&client->dev)) + disable_irq_wake(client->irq); + ++ if (hid->driver && hid->driver->reset_resume) { ++ ret = hid->driver->reset_resume(hid); ++ return ret; ++ } ++ + return 0; + } + #endif +-- +2.1.0 + diff --git a/kernel.spec b/kernel.spec index 93b38dd26..7e928579e 100644 --- a/kernel.spec +++ b/kernel.spec @@ -724,6 +724,9 @@ Patch26025: HID-picolcd-sanity-check-report-size-in-raw_event-ca.patch #CVE-2014-6410 rhbz 1141809 1141810 Patch26026: udf-Avoid-infinite-loop-when-processing-indirect-ICB.patch +#rhbz 1143812 +Patch26027: HID-i2c-hid-call-the-hid-driver-s-suspend-and-resume.patch + # git clone ssh://git.fedorahosted.org/git/kernel-arm64.git, git diff master...devel Patch30000: kernel-arm64.patch @@ -1416,6 +1419,9 @@ ApplyPatch HID-picolcd-sanity-check-report-size-in-raw_event-ca.patch #CVE-2014-6410 rhbz 1141809 1141810 ApplyPatch udf-Avoid-infinite-loop-when-processing-indirect-ICB.patch +#rhbz 1143812 +ApplyPatch HID-i2c-hid-call-the-hid-driver-s-suspend-and-resume.patch + %if 0%{?aarch64patches} ApplyPatch kernel-arm64.patch %ifnarch aarch64 # this is stupid, but i want to notice before secondary koji does. @@ -2234,6 +2240,9 @@ fi # ||----w | # || || %changelog +* Mon Sep 22 2014 Josh Boyer +- Add patch to fix i2c-hid touchpad resume (rhbz 1143812) + * Wed Sep 17 2014 Justin M. Forbes - 3.16.3-200 - Linux v3.16.3