public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jim Broadus <jbroadus@gmail.com>
To: kai.heng.feng@canonical.com, benjamin.tissoires@gmail.com,
	jkosina@suse.cz, linux-kernel@vger.kernel.org
Cc: Jim Broadus <jbroadus@gmail.com>
Subject: [PATCH] Fix resume for ELAN2097 touchscreen.
Date: Sun, 10 Feb 2019 23:00:40 -0800	[thread overview]
Message-ID: <20190211070040.4569-1-jbroadus@gmail.com> (raw)

Commit 52cf93e63ee6 ("HID: i2c-hid: Don't reset device upon system resume")
fixes the resume behavior of several devices. However, this breaks the
resume on the ELAN2097, used on Dell Inspiron laptops, with the same flood
of messages:

[27009.817110] i2c_hid i2c-ELAN2097:00: i2c_hid_get_input: incomplete report (67/65535)
[27009.818867] i2c_hid i2c-ELAN2097:00: i2c_hid_get_input: incomplete report (67/65535)
[27009.820623] i2c_hid i2c-ELAN2097:00: i2c_hid_get_input: incomplete report (67/65535)

This change adds a new I2C_HID_QUIRK_RESET_AFTER_RESUME and replaces the
original reset behavior for this device.

Signed-off-by: Jim Broadus <jbroadus@gmail.com>
---
 drivers/hid/hid-ids.h              |  1 +
 drivers/hid/i2c-hid/i2c-hid-core.c | 20 ++++++++++++++------
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 24f846d67478..38cc7033712a 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -387,6 +387,7 @@
 #define USB_DEVICE_ID_TOSHIBA_CLICK_L9W	0x0401
 #define USB_DEVICE_ID_HP_X2		0x074d
 #define USB_DEVICE_ID_HP_X2_10_COVER	0x0755
+#define USB_DEVICE_ID_ELAN2097		0x2504
 
 #define USB_VENDOR_ID_ELECOM		0x056e
 #define USB_DEVICE_ID_ELECOM_BM084	0x0061
diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c
index c5edfa966343..fdbad29b4406 100644
--- a/drivers/hid/i2c-hid/i2c-hid-core.c
+++ b/drivers/hid/i2c-hid/i2c-hid-core.c
@@ -50,6 +50,7 @@
 #define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET	BIT(1)
 #define I2C_HID_QUIRK_NO_RUNTIME_PM		BIT(2)
 #define I2C_HID_QUIRK_DELAY_AFTER_SLEEP		BIT(3)
+#define I2C_HID_QUIRK_RESET_AFTER_RESUME	BIT(4)
 
 /* flags */
 #define I2C_HID_STARTED		0
@@ -181,6 +182,8 @@ static const struct i2c_hid_quirks {
 		I2C_HID_QUIRK_NO_RUNTIME_PM },
 	{ I2C_VENDOR_ID_GOODIX, I2C_DEVICE_ID_GOODIX_01F0,
 		I2C_HID_QUIRK_NO_RUNTIME_PM },
+	{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN2097,
+		 I2C_HID_QUIRK_RESET_AFTER_RESUME },
 	{ 0, 0 }
 };
 
@@ -1279,12 +1282,17 @@ static int i2c_hid_resume(struct device *dev)
 
 	enable_irq(client->irq);
 
-	/* Instead of resetting device, simply powers the device on. This
-	 * solves "incomplete reports" on Raydium devices 2386:3118 and
-	 * 2386:4B33 and fixes various SIS touchscreens no longer sending
-	 * data after a suspend/resume.
-	 */
-	ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
+	if (ihid->quirks & I2C_HID_QUIRK_RESET_AFTER_RESUME) {
+		ret = i2c_hid_hwreset(client);
+	} else {
+		/* Instead of resetting device, simply powers the device on.
+		 * This solves "incomplete reports" on Raydium devices 2386:3118
+		 * and 2386:4B33 and fixes various SIS touchscreens no longer
+		 * sending data after a suspend/resume.
+		 */
+		ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
+	}
+
 	if (ret)
 		return ret;
 
-- 
2.20.1


             reply	other threads:[~2019-02-11  7:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-11  7:00 Jim Broadus [this message]
2019-02-13 23:37 ` [PATCH] Fix resume for ELAN2097 touchscreen Jiri Kosina
2019-02-15  7:21   ` james broadus
2019-02-15  7:35     ` Jiri Kosina
2019-02-15  9:24       ` Kai-Heng Feng
2019-02-16  1:42         ` Jim Broadus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190211070040.4569-1-jbroadus@gmail.com \
    --to=jbroadus@gmail.com \
    --cc=benjamin.tissoires@gmail.com \
    --cc=jkosina@suse.cz \
    --cc=kai.heng.feng@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox