Skip to contentSkip to conversation

Fix resume for ELAN2097 touchscreen.

PATCH In review Jim Broadus 3 participants 6 messages Feb 11, 2019 – Feb 16, 2019 HID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix resume for ELAN2097 touchscreen.

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.

---
 drivers/hid/hid-ids.h              |  1 +
 drivers/hid/i2c-hid/i2c-hid-core.c | 20 ++++++++++++++------
 2 files changed, 15 insertions(+), 6 deletions(-)
drivers/hid/hid-ids.h +1 -0
index 24f846d67478..38cc7033712a 100644
@@ -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
drivers/hid/i2c-hid/i2c-hid-core.c +14 -6
index c5edfa966343..fdbad29b4406 100644
@@ -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;
 
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 5 lines · Jim Broadus

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:

Quoted 8 lines
[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.

This should be fixed in hid.git#for-5.1/i2c-hid already by commit 1475af255e18f. Could you please confirm that?

Quoted 65 lines
---
 drivers/hid/hid-ids.h              |  1 +
 drivers/hid/i2c-hid/i2c-hid-core.c | 20 ++++++++++++++------
 2 files changed, 15 insertions(+), 6 deletions(-)
drivers/hid/hid-ids.h +1 -0
index 24f846d67478..38cc7033712a 100644
@@ -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
drivers/hid/i2c-hid/i2c-hid-core.c +14 -6
index c5edfa966343..fdbad29b4406 100644
@@ -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;
 
Signature · 1 line
2.20.1
Signature · 2 lines
Jiri Kosina
SUSE Labs
#2 lore raw
Quoted 12 lines · Jiri Kosina
Quoted 9 lines · Jim Broadus

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)
Quoted 8 lines
Quoted 4 lines

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

This should be fixed in hid.git#for-5.1/i2c-hid already by commit 1475af255e18f. Could you please confirm that?

Hi Jiri. That change mutes the log messages, but I'm still counting around 35000 interrupts per second after resume and touch does not work. With the reset, the device works properly.

Jim

Quoted 70 lines
Quoted 63 lines
---
 drivers/hid/hid-ids.h              |  1 +
 drivers/hid/i2c-hid/i2c-hid-core.c | 20 ++++++++++++++------
 2 files changed, 15 insertions(+), 6 deletions(-)
drivers/hid/hid-ids.h +1 -0
index 24f846d67478..38cc7033712a 100644
@@ -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
drivers/hid/i2c-hid/i2c-hid-core.c +14 -7
index c5edfa966343..fdbad29b4406 100644
@@ -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;
 
--
Quoted 2 lines

2.20.1

--
Jiri Kosina
SUSE Labs

maintainer
#3 lore raw
Quoted 7 lines · james broadus
Quoted 3 lines

This should be fixed in hid.git#for-5.1/i2c-hid already by commit 1475af255e18f. Could you please confirm that?

Hi Jiri. That change mutes the log messages, but I'm still counting around 35000 interrupts per second after resume and touch does not work. With the reset, the device works properly.

Ah, I see. Should your patch then actually replace 1475af255e18f?

Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs
#4 lore raw

Hi Jiri and James,

Quoted 8 lines · Jiri Kosina
Quoted 4 lines · james broadus
Quoted 3 lines

This should be fixed in hid.git#for-5.1/i2c-hid already by commit 1475af255e18f. Could you please confirm that?

Quoted 5 lines
Quoted 3 lines

Hi Jiri. That change mutes the log messages, but I'm still counting around 35000 interrupts per second after resume and touch does not work. With the reset, the device works properly.

Ah, I see. Should your patch then actually replace 1475af255e18f?

Sorry for the late reply, was off because of Lunar new year.

Commit 1475af255e18f is to silence the message when using the touchpad, so it’s different to this patch.

I’ve seen similar bugs happens on new platforms that defaults S2Idle (Modern Standby), but user uses S3 instead.
On those systems, S3 was never tested, so the BIOS doesn’t cut the touchpad’s power off during S3, and the IRQ line wasn’t getting properly reset.

So if the platform defaults to S2Idle but user wants to use S3, this issue happens. If that’s the case, maybe it’s better to report to the platform vendor.

Kai-Heng

Quoted 7 lines

Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs
#5 lore raw

Happy new year.

I think you might be right. I found some discussions about Dell disabling S3 support in a recent bios due to a C-state bug. I'll try to investigate a bit more this weekend.

Jim

Quoted 37 lines · Kai-Heng Feng

Hi Jiri and James,

Quoted 8 lines · Jiri Kosina
Quoted 4 lines · james broadus
Quoted 3 lines

This should be fixed in hid.git#for-5.1/i2c-hid already by commit 1475af255e18f. Could you please confirm that?

Quoted 5 lines
Quoted 3 lines

Hi Jiri. That change mutes the log messages, but I'm still counting around 35000 interrupts per second after resume and touch does not work. With the reset, the device works properly.

Ah, I see. Should your patch then actually replace 1475af255e18f?

Sorry for the late reply, was off because of Lunar new year.

Commit 1475af255e18f is to silence the message when using the touchpad, so it’s different to this patch.

I’ve seen similar bugs happens on new platforms that defaults S2Idle (Modern Standby), but user uses S3 instead.
On those systems, S3 was never tested, so the BIOS doesn’t cut the touchpad’s power off during S3, and the IRQ line wasn’t getting properly reset.

So if the platform defaults to S2Idle but user wants to use S3, this issue happens. If that’s the case, maybe it’s better to report to the platform vendor.

Kai-Heng

Quoted 7 lines

Thanks,

--
Jiri Kosina
SUSE Labs