* [PATCH v2 1/2] HID: i2c-hid: introduce re-power-on quirk
2024-10-31 7:31 [PATCH v2 0/2] HID: i2c-hid: re-power-on quirk for QTEC kbrd Aleksandrs Vinarskis
@ 2024-10-31 7:31 ` Aleksandrs Vinarskis
2024-10-31 7:31 ` [PATCH v2 2/2] HID: i2c-hid: introduce qtec vendor, enable " Aleksandrs Vinarskis
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Aleksandrs Vinarskis @ 2024-10-31 7:31 UTC (permalink / raw)
To: Jiri Kosina, Hans de Goede, linux-input, linux-kernel
Cc: Benjamin Tissoires, Bryan.Kemp, laurentiu.tudor1,
Aleksandrs Vinarskis
It appears some keyboards from vendor 'QTEC' will not work properly until
suspend & resume.
Empirically narrowed down to solution of re-sending power on command
_after_ initialization was completed before the end of initial probing.
Signed-off-by: Aleksandrs Vinarskis <alex.vinarskis@gmail.com>
---
drivers/hid/i2c-hid/i2c-hid-core.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c
index 43664a24176f..ad386ae878ef 100644
--- a/drivers/hid/i2c-hid/i2c-hid-core.c
+++ b/drivers/hid/i2c-hid/i2c-hid-core.c
@@ -51,6 +51,7 @@
#define I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET BIT(4)
#define I2C_HID_QUIRK_NO_SLEEP_ON_SUSPEND BIT(5)
#define I2C_HID_QUIRK_DELAY_WAKEUP_AFTER_RESUME BIT(6)
+#define I2C_HID_QUIRK_RE_POWER_ON BIT(7)
/* Command opcodes */
#define I2C_HID_OPCODE_RESET 0x01
@@ -1069,7 +1070,11 @@ static int i2c_hid_core_register_hid(struct i2c_hid *ihid)
return ret;
}
- return 0;
+ /* At least some QTEC devices need this after initialization */
+ if (ihid->quirks & I2C_HID_QUIRK_RE_POWER_ON)
+ ret = i2c_hid_set_power(ihid, I2C_HID_PWR_ON);
+
+ return ret;
}
static int i2c_hid_core_probe_panel_follower(struct i2c_hid *ihid)
--
2.45.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH v2 2/2] HID: i2c-hid: introduce qtec vendor, enable re-power-on quirk
2024-10-31 7:31 [PATCH v2 0/2] HID: i2c-hid: re-power-on quirk for QTEC kbrd Aleksandrs Vinarskis
2024-10-31 7:31 ` [PATCH v2 1/2] HID: i2c-hid: introduce re-power-on quirk Aleksandrs Vinarskis
@ 2024-10-31 7:31 ` Aleksandrs Vinarskis
2024-10-31 16:26 ` [PATCH v2 0/2] HID: i2c-hid: re-power-on quirk for QTEC kbrd Tudor, Laurentiu
2024-12-11 14:06 ` Jiri Kosina
3 siblings, 0 replies; 5+ messages in thread
From: Aleksandrs Vinarskis @ 2024-10-31 7:31 UTC (permalink / raw)
To: Jiri Kosina, Hans de Goede, linux-input, linux-kernel
Cc: Benjamin Tissoires, Bryan.Kemp, laurentiu.tudor1,
Aleksandrs Vinarskis
This solves keyboard not working until suspend&resume issue on Dell XPS
9345 13" (codenamed 'tributo').
Signed-off-by: Aleksandrs Vinarskis <alex.vinarskis@gmail.com>
---
drivers/hid/hid-ids.h | 2 ++
drivers/hid/i2c-hid/i2c-hid-core.c | 5 +++++
2 files changed, 7 insertions(+)
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 30728997f4c0..cc9b9bdca117 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -1088,6 +1088,8 @@
#define USB_VENDOR_ID_PRODIGE 0x05af
#define USB_DEVICE_ID_PRODIGE_CORDLESS 0x3062
+#define I2C_VENDOR_ID_QTEC 0x6243
+
#define USB_VENDOR_ID_QUANTA 0x0408
#define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH 0x3000
#define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001 0x3001
diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c
index ad386ae878ef..29c75e390a7d 100644
--- a/drivers/hid/i2c-hid/i2c-hid-core.c
+++ b/drivers/hid/i2c-hid/i2c-hid-core.c
@@ -136,6 +136,11 @@ static const struct i2c_hid_quirks {
I2C_HID_QUIRK_BAD_INPUT_SIZE },
{ I2C_VENDOR_ID_CIRQUE, I2C_PRODUCT_ID_CIRQUE_1063,
I2C_HID_QUIRK_NO_SLEEP_ON_SUSPEND },
+ /*
+ * Without additional power on command, at least some QTEC devices send garbage
+ */
+ { I2C_VENDOR_ID_QTEC, HID_ANY_ID,
+ I2C_HID_QUIRK_RE_POWER_ON },
/*
* Sending the wakeup after reset actually break ELAN touchscreen controller
*/
--
2.45.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* RE: [PATCH v2 0/2] HID: i2c-hid: re-power-on quirk for QTEC kbrd
2024-10-31 7:31 [PATCH v2 0/2] HID: i2c-hid: re-power-on quirk for QTEC kbrd Aleksandrs Vinarskis
2024-10-31 7:31 ` [PATCH v2 1/2] HID: i2c-hid: introduce re-power-on quirk Aleksandrs Vinarskis
2024-10-31 7:31 ` [PATCH v2 2/2] HID: i2c-hid: introduce qtec vendor, enable " Aleksandrs Vinarskis
@ 2024-10-31 16:26 ` Tudor, Laurentiu
2024-12-11 14:06 ` Jiri Kosina
3 siblings, 0 replies; 5+ messages in thread
From: Tudor, Laurentiu @ 2024-10-31 16:26 UTC (permalink / raw)
To: Aleksandrs Vinarskis, Jiri Kosina, Hans de Goede,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Benjamin Tissoires, Kemp, Bryan
Internal Use - Confidential
> -----Original Message-----
> From: Aleksandrs Vinarskis <alex.vinarskis@gmail.com>
> Sent: Thursday, October 31, 2024 9:32 AM
>
> Resolve keyboard not working out of the box for Dell XPS 9345 13"
> codenamed 'tributo'. X1E80100-based laptop's initial support is currently being
> upstreamed [1].
>
> In present state, keyboard is succesfully initialized, however attempt to type
> anything throws 'incomplete report' errors. When utilizing
> I2C_HID_QUIRK_BAD_INPUT_SIZE quirk the error is gone, however raw data
> coming from the keyboard is always the same, no matter the key pressed. Issue
> 'resolves' itself when suspending and resuming the device.
>
> It appears that calling power on command one more time after device
> initialization before finishing off the probing fixes this weird behavior, and
> keyboard works right away.
>
> Introduce a new quirk for such behaviour, and enable it for particular
> keyboard.
> Vendor is shown as 'QTEC', however device id is reported as 0000. Given that
> vendor was not present before, using HID_ANY_ID to match the device should
> be okay in this case.
>
> In v1 it was suggested to make a dedicated i2c-of-qtec driver, but I was not sure
> how to proceed at the time. I have now drafted a dedicated driver, and it really
> is just probe method being extended to call powerup command again. Given
> that a similarly 'ugly' quirk was just merged to i2c-hid-core.c for a Goodix
> device [2], and that (IMO) creating a dedicated driver for such a small change
> without any plan on extending it will be just polluting, I am asking you to
> consider this change again. Alternatively, if it is yet still strongly preferred to
> have a dedicated driver to include this quirk, please let me know so I can
> proceed accordingly.
>
> --------
For the series:
Reviewed-by: Laurentiu Tudor <Laurentiu.Tudor1@dell.com>
Tested-by: Laurentiu Tudor <Laurentiu.Tudor1@dell.com>
---
Thanks & Best Regards, Laurentiu
> Changes to V1:
> * Rebase on top of latest linux-next
> * Update coverletter's reasoning and links
> * link:
> https://urldefense.com/v3/__https://lore.kernel.org/all/20240925100303.911
> 2-1-
> alex.vinarskis@gmail.com/__;!!LpKI!hTYUmNdAbx06nnU3DlrMQn9PGzi4y9Ne
> SOTjPf2SPO67ore1XymZjywoQN19RvKaVHbNs5VLc9_77mwvQAT8em7dODeJ
> $ [lore[.]kernel[.]org]
>
> Aleksandrs Vinarskis (2):
> HID: i2c-hid: introduce re-power-on quirk
> HID: i2c-hid: introduce qtec vendor, enable re-power-on quirk
>
> drivers/hid/hid-ids.h | 2 ++
> drivers/hid/i2c-hid/i2c-hid-core.c | 12 +++++++++++-
> 2 files changed, 13 insertions(+), 1 deletion(-)
>
> --
> 2.45.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 0/2] HID: i2c-hid: re-power-on quirk for QTEC kbrd
2024-10-31 7:31 [PATCH v2 0/2] HID: i2c-hid: re-power-on quirk for QTEC kbrd Aleksandrs Vinarskis
` (2 preceding siblings ...)
2024-10-31 16:26 ` [PATCH v2 0/2] HID: i2c-hid: re-power-on quirk for QTEC kbrd Tudor, Laurentiu
@ 2024-12-11 14:06 ` Jiri Kosina
3 siblings, 0 replies; 5+ messages in thread
From: Jiri Kosina @ 2024-12-11 14:06 UTC (permalink / raw)
To: Aleksandrs Vinarskis
Cc: Hans de Goede, linux-input, linux-kernel, Benjamin Tissoires,
Bryan.Kemp, laurentiu.tudor1
On Thu, 31 Oct 2024, Aleksandrs Vinarskis wrote:
> Resolve keyboard not working out of the box for Dell XPS 9345 13"
> codenamed 'tributo'. X1E80100-based laptop's initial support is currently
> being upstreamed [1].
>
> In present state, keyboard is succesfully initialized, however attempt to type
> anything throws 'incomplete report' errors. When utilizing
> I2C_HID_QUIRK_BAD_INPUT_SIZE quirk the error is gone, however raw data coming
> from the keyboard is always the same, no matter the key pressed. Issue
> 'resolves' itself when suspending and resuming the device.
>
> It appears that calling power on command one more time after device
> initialization before finishing off the probing fixes this weird behavior, and
> keyboard works right away.
>
> Introduce a new quirk for such behaviour, and enable it for particular keyboard.
> Vendor is shown as 'QTEC', however device id is reported as 0000. Given that
> vendor was not present before, using HID_ANY_ID to match the device should be
> okay in this case.
>
> In v1 it was suggested to make a dedicated i2c-of-qtec driver, but I was not
> sure how to proceed at the time. I have now drafted a dedicated driver, and it
> really is just probe method being extended to call powerup command again. Given
> that a similarly 'ugly' quirk was just merged to i2c-hid-core.c for a Goodix
> device [2], and that (IMO) creating a dedicated driver for such a small change
> without any plan on extending it will be just polluting, I am asking you to
> consider this change again. Alternatively, if it is yet still strongly
> preferred to have a dedicated driver to include this quirk, please let me know
> so I can proceed accordingly.
>
> [1] https://lore.kernel.org/all/20241003211139.9296-1-alex.vinarskis@gmail.com/
> [2] https://lore.kernel.org/all/20241007222629.172047-1-marynczakbartlomiej@gmail.com/
>
> --------
>
> Changes to V1:
> * Rebase on top of latest linux-next
> * Update coverletter's reasoning and links
> * link: https://lore.kernel.org/all/20240925100303.9112-1-alex.vinarskis@gmail.com/
Applied, thanks, and sorry for the delay.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 5+ messages in thread