[PATCH] HID: i2c-hid: slower runtime PM operations on hantick touchpad

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This hantick HTIX5288 touchpad can quickly fall in a wrong state if
there are too many open/close operations. This will either make it stop
reporting any input, or will shift all the input reads by a few bytes,
making it impossible to decode.

Here, we synchronously block the the runtime suspend by 2.5 seconds;
this was found experimentally, and sleeping less will not result in a
non-working touchpad.

This quirk will also result in a non-responsive touchpad for 2.5s if
userspace closes, then opens a device quickly, but this was deemed an
appropriate compromise versus a non-working touchpad.

This fast repetition of sleep/wakeup is also more likely to happen when
using runtime PM, which is why the quirk is done there, and not for all
power downs, which would include suspend or module removal.

Signed-off-by: Anisse Astier <anisse@xxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
---

This patch feels a bit hack-ish, but I don't really know how to debug this
issue further.

I'm looking forward to your feedback.

Regards,

Anisse


 drivers/hid/i2c-hid/i2c-hid.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index 847b55ad0d60..f894d9225df6 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -48,6 +48,7 @@
 #define I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV	BIT(0)
 #define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET	BIT(1)
 #define I2C_HID_QUIRK_RESEND_REPORT_DESCR	BIT(2)
+#define I2C_HID_QUIRK_SLOW_DOWN_RUNTIME_PM	BIT(3)
 
 /* flags */
 #define I2C_HID_STARTED		0
@@ -172,6 +173,8 @@ static const struct i2c_hid_quirks {
 		I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV },
 	{ I2C_VENDOR_ID_HANTICK, I2C_PRODUCT_ID_HANTICK_5288,
 		I2C_HID_QUIRK_NO_IRQ_AFTER_RESET },
+	{ I2C_VENDOR_ID_HANTICK, I2C_PRODUCT_ID_HANTICK_5288,
+		I2C_HID_QUIRK_SLOW_DOWN_RUNTIME_PM },
 	{ USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS10FB_TOUCH,
 		I2C_HID_QUIRK_RESEND_REPORT_DESCR },
 	{ 0, 0 }
@@ -1259,6 +1262,10 @@ static int i2c_hid_resume(struct device *dev)
 static int i2c_hid_runtime_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
+	struct i2c_hid *ihid = i2c_get_clientdata(client);
+
+	if (ihid->quirks & I2C_HID_QUIRK_SLOW_DOWN_RUNTIME_PM)
+		msleep(2500);
 
 	i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
 	disable_irq(client->irq);
-- 
2.11.0




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux