Skip to contentSkip to conversation

HID: i2c-hid: Skip ELAN power-on command after reset

PATCH In review Johnny Chuang 5 participants 6 messages Apr 13, 2021 – May 7, 2021 HID

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 HID: i2c-hid: Skip ELAN power-on command after reset

Fixes 43b7029f475e ("HID: i2c-hid: Send power-on command after reset").

For ELAN touchscreen, we found our boot code of IC was not flexible enough to receive and handle this command.
Once the FW main code of our controller is crashed for some reason, the controller could not be enumerated successfully to be recognized by the system host. therefore, it lost touch functionality.

Add quirk for skip send power-on command after reset.
It will impact to ELAN touchscreen and touchpad on HID over I2C projects.

---
Changes in V3:
- intent the comment at qurik entry
- add Fixes:flag for previous commit id

Changes in v2:
- move comment to quirk entry

---
 drivers/hid/i2c-hid/i2c-hid-core.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/hid/i2c-hid/i2c-hid-core.c +9 -1
index 9993133..32e3287 100644
@@ -45,6 +45,7 @@
 #define I2C_HID_QUIRK_BOGUS_IRQ			BIT(4)
 #define I2C_HID_QUIRK_RESET_ON_RESUME		BIT(5)
 #define I2C_HID_QUIRK_BAD_INPUT_SIZE		BIT(6)
+#define I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET	BIT(7)
 
 
 /* flags */
@@ -178,6 +179,12 @@ static const struct i2c_hid_quirks {
 		 I2C_HID_QUIRK_RESET_ON_RESUME },
 	{ USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720,
 		I2C_HID_QUIRK_BAD_INPUT_SIZE },
+	/*
+	 * Sending the wakeup after reset actually break ELAN touchscreen controller
+	 * Add I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET to skip wakeup after reset
+	 */
+	{ USB_VENDOR_ID_ELAN, HID_ANY_ID,
+		 I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET },
 	{ 0, 0 }
 };
 
@@ -461,7 +468,8 @@ static int i2c_hid_hwreset(struct i2c_client *client)
 	}
 
 	/* At least some SIS devices need this after reset */
-	ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
+	if (!(ihid->quirks & I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET))
+		ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
 
 out_unlock:
 	mutex_unlock(&ihid->reset_lock);
Signature · 1 line
2.7.4
Reviewed-by on v3 1/1
#1 lore raw
Quoted 12 lines · Johnny Chuang
Fixes 43b7029f475e ("HID: i2c-hid: Send power-on command after reset").

For ELAN touchscreen, we found our boot code of IC was not flexible enough to receive and handle this command.
Once the FW main code of our controller is crashed for some reason, the controller could not be enumerated successfully to be recognized by the system host. therefore, it lost touch functionality.

Add quirk for skip send power-on command after reset.
It will impact to ELAN touchscreen and touchpad on HID over I2C projects.

Quoted 8 lines

---
Changes in V3:
- intent the comment at qurik entry
- add Fixes:flag for previous commit id

Changes in v2:
- move comment to quirk entry

Harry Cutts
Chrome OS Touch/Input team

Quoted 42 lines
---
 drivers/hid/i2c-hid/i2c-hid-core.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/hid/i2c-hid/i2c-hid-core.c +9 -2
index 9993133..32e3287 100644
@@ -45,6 +45,7 @@
 #define I2C_HID_QUIRK_BOGUS_IRQ                        BIT(4)
 #define I2C_HID_QUIRK_RESET_ON_RESUME          BIT(5)
 #define I2C_HID_QUIRK_BAD_INPUT_SIZE           BIT(6)
+#define I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET    BIT(7)
 
 
 /* flags */
@@ -178,6 +179,12 @@ static const struct i2c_hid_quirks {
                 I2C_HID_QUIRK_RESET_ON_RESUME },
        { USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720,
                I2C_HID_QUIRK_BAD_INPUT_SIZE },
+       /*
+        * Sending the wakeup after reset actually break ELAN touchscreen controller
+        * Add I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET to skip wakeup after reset
+        */
+       { USB_VENDOR_ID_ELAN, HID_ANY_ID,
+                I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET },
        { 0, 0 }
 };
 
@@ -461,7 +468,8 @@ static int i2c_hid_hwreset(struct i2c_client *client)
        }
 
        /* At least some SIS devices need this after reset */
-       ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
+       if (!(ihid->quirks & I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET))
+               ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
 
 out_unlock:
        mutex_unlock(&ihid->reset_lock);
--

2.7.4

Reviewed-by Tested-by on v3 1/1
#2 lore raw
In reply to Johnny Chuang

Hi,

Quoted 2 lines · Johnny Chuang
Fixes 43b7029f475e ("HID: i2c-hid: Send power-on command after reset").

Note that the "Fixes" tag actually belongs down at the end. It also shouldn't have a "." at the end. Presumably the maintainer can adjust this when landing?

Quoted 10 lines

For ELAN touchscreen, we found our boot code of IC was not flexible enough to receive and handle this command.
Once the FW main code of our controller is crashed for some reason, the controller could not be enumerated successfully to be recognized by the system host. therefore, it lost touch functionality.

Add quirk for skip send power-on command after reset.
It will impact to ELAN touchscreen and touchpad on HID over I2C projects.

This patch looks fine to me, thus:

I can confirm that after applying this patch I can recovery my borked touchscreen (which got borked by a failed firmware update ages ago):

#3 lore raw
Quoted 10 lines

Hi,

Quoted 2 lines · Johnny Chuang
Fixes 43b7029f475e ("HID: i2c-hid: Send power-on command after reset").

Note that the "Fixes" tag actually belongs down at the end. It also shouldn't have a "." at the end. Presumably the maintainer can adjust this when landing?

Hi Dmitry,
Could you help to review this patch and give an advice?

Quoted 20 lines
Quoted 11 lines

For ELAN touchscreen, we found our boot code of IC was not flexible enough to receive and handle this command.
Once the FW main code of our controller is crashed for some reason, the controller could not be enumerated successfully to be recognized by the system host. therefore, it lost touch functionality.

Add quirk for skip send power-on command after reset.
It will impact to ELAN touchscreen and touchpad on HID over I2C projects.

This patch looks fine to me, thus:

I can confirm that after applying this patch I can recovery my borked touchscreen (which got borked by a failed firmware update ages ago):

#4 lore raw
In reply to Doug Anderson
Quoted 7 lines
Quoted 7 lines

Hi,

Quoted 2 lines · Johnny Chuang
Fixes 43b7029f475e ("HID: i2c-hid: Send power-on command after reset").
Quoted 7 lines
Quoted 2 lines

Note that the "Fixes" tag actually belongs down at the end. It also shouldn't have a "." at the end. Presumably the maintainer can adjust this

when landing?

Quoted 1 line

Hi Dmitry,
Could you help to review this patch and give an advice?

Hi Sirs,
Could anyone help to review this patch and give an advice?

Quoted 21 lines
Quoted 21 lines
Quoted 8 lines

For ELAN touchscreen, we found our boot code of IC was not flexible enough to receive and handle this command.
Once the FW main code of our controller is crashed for some reason, the controller could not be enumerated successfully to be recognized by the system host. therefore, it lost touch functionality.

Quoted 4 lines

Add quirk for skip send power-on command after reset.
It will impact to ELAN touchscreen and touchpad on HID over I2C projects.

This patch looks fine to me, thus:

I can confirm that after applying this patch I can recovery my borked touchscreen (which got borked by a failed firmware update ages ago):

#5 lore raw
In reply to Johnny Chuang

Hi Johnny,

Apologies fo the delay.

When I first saw your patch I wondered why we need a special case for Elan. But then, we need a special case for SIS, as mentioned by 43b7029f475e. Given that this patch was in for a year and a half, and not many people seemed to complain about it, I decided to apply your patch.

Quoted 2 lines · Johnny Chuang
Fixes 43b7029f475e ("HID: i2c-hid: Send power-on command after reset").

As requested per Doug, I have moved that Fixes tag at the end, though I forgot to remove the extra '.' at the end :-(

Quoted 35 lines

For ELAN touchscreen, we found our boot code of IC was not flexible enough to receive and handle this command.
Once the FW main code of our controller is crashed for some reason, the controller could not be enumerated successfully to be recognized by the system host. therefore, it lost touch functionality.

Add quirk for skip send power-on command after reset.
It will impact to ELAN touchscreen and touchpad on HID over I2C projects.

---
Changes in V3:
- intent the comment at qurik entry
- add Fixes:flag for previous commit id

Changes in v2:
- move comment to quirk entry

---
 drivers/hid/i2c-hid/i2c-hid-core.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/hid/i2c-hid/i2c-hid-core.c +1 -0
index 9993133..32e3287 100644
@@ -45,6 +45,7 @@
 #define I2C_HID_QUIRK_BOGUS_IRQ                        BIT(4)
 #define I2C_HID_QUIRK_RESET_ON_RESUME          BIT(5)
 #define I2C_HID_QUIRK_BAD_INPUT_SIZE           BIT(6)
+#define I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET    BIT(7)
 
 
 /* flags */

drivers/hid/i2c-hid/i2c-hid-core.c static const struct i2c_hid_quirks { · line 184

Quoted 6 lines
drivers/hid/i2c-hid/i2c-hid-core.c +3 -0
@@ -178,6 +179,12 @@ static const struct i2c_hid_quirks {
                 I2C_HID_QUIRK_RESET_ON_RESUME },
        { USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720,
                I2C_HID_QUIRK_BAD_INPUT_SIZE },
+       /*
+        * Sending the wakeup after reset actually break ELAN touchscreen controller
+        * Add I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET to skip wakeup after reset

I removed that extra second line.

Also added Cc: stable, and pushed to for-5.13/upstream-fixes

Cheers,
Benjamin

Quoted 19 lines
drivers/hid/i2c-hid/i2c-hid-core.c +5 -2
+        */
+       { USB_VENDOR_ID_ELAN, HID_ANY_ID,
+                I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET },
        { 0, 0 }
 };
 
@@ -461,7 +468,8 @@ static int i2c_hid_hwreset(struct i2c_client *client)
        }
 
        /* At least some SIS devices need this after reset */
-       ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
+       if (!(ihid->quirks & I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET))
+               ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
 
 out_unlock:
        mutex_unlock(&ihid->reset_lock);
--

2.7.4