]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
HID: i2c-hid: Reset ALPS touchpads on resume
authorKai-Heng Feng <kai.heng.feng@canonical.com>
Thu, 7 Nov 2019 14:28:11 +0000 (22:28 +0800)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 29 Jan 2020 04:47:27 +0000 (23:47 -0500)
BugLink: https://bugs.launchpad.net/bugs/1860602
commit fd70466d37bf3fe0118d18c56ddde85b428f86cf upstream.

Commit 52cf93e63ee6 ("HID: i2c-hid: Don't reset device upon system
resume") fixes many touchpads and touchscreens, however ALPS touchpads
start to trigger IRQ storm after system resume.

Since it's total silence from ALPS, let's bring the old behavior back
to ALPS touchpads.

Fixes: 52cf93e63ee6 ("HID: i2c-hid: Don't reset device upon system resume")
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/hid/i2c-hid/i2c-hid-core.c

index 4b7f930353a78e7dc16f52542aa44322dc8437d4..0edf9c2f001cff5dff3c0676e646523d86842888 100644 (file)
@@ -51,6 +51,7 @@
 #define I2C_HID_QUIRK_RESEND_REPORT_DESCR      BIT(2)
 #define I2C_HID_QUIRK_NO_RUNTIME_PM            BIT(3)
 #define I2C_HID_QUIRK_BOGUS_IRQ                        BIT(4)
+#define I2C_HID_QUIRK_RESET_ON_RESUME          BIT(5)
 
 /* flags */
 #define I2C_HID_STARTED                0
@@ -184,6 +185,8 @@ static const struct i2c_hid_quirks {
                I2C_HID_QUIRK_NO_RUNTIME_PM },
        { USB_VENDOR_ID_ELAN, HID_ANY_ID,
                 I2C_HID_QUIRK_BOGUS_IRQ },
+       { USB_VENDOR_ID_ALPS_JP, HID_ANY_ID,
+                I2C_HID_QUIRK_RESET_ON_RESUME },
        { 0, 0 }
 };
 
@@ -1261,8 +1264,15 @@ static int i2c_hid_resume(struct device *dev)
        /* Instead of resetting device, simply powers the device on. This
         * solves "incomplete reports" on Raydium devices 2386:3118 and
         * 2386:4B33
+        *
+        * However some ALPS touchpads generate IRQ storm without reset, so
+        * let's still reset them here.
         */
-       ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
+       if (ihid->quirks & I2C_HID_QUIRK_RESET_ON_RESUME)
+               ret = i2c_hid_hwreset(client);
+       else
+               ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
+
        if (ret)
                return ret;