* [PATCH 0/1] Enable touchpad for Lenovo 13x ThinkBook Gen 4 (GT7868Q)
@ 2024-07-16 22:27 Dmitry Savin
2024-07-16 22:27 ` [PATCH 1/1] HID: multitouch: Add support for GT7868Q Dmitry Savin
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Savin @ 2024-07-16 22:27 UTC (permalink / raw)
To: jikos, bentiss, linux-input; +Cc: terry.wong2, Dmitry Savin
Hi,
This patch adds Goodix GT7868Q device support to hid-multitouch.
The device is used on Lenovo ThinkBook 13x Gen 4 series of laptops
and have incorrect descriptor that hid-parse fails to parse
hence device is not working.
Terry Wong made a driver (fixup) that uses report_fixup to correct
the values in the descriptor. This is mostly re-using hid-multitouch
code. With his permission, I added the fixup to the driver itself.
Open to the feedback if there's a better approach to solving
the issue.
https://github.com/ty2/goodix-gt7868q-linux-driver/blob/main/goodix-gt7868q.c
Dmitry Savin (1):
HID: multitouch: Add support for GT7868Q
drivers/hid/hid-ids.h | 2 ++
drivers/hid/hid-multitouch.c | 33 +++++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+)
--
2.45.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] HID: multitouch: Add support for GT7868Q
2024-07-16 22:27 [PATCH 0/1] Enable touchpad for Lenovo 13x ThinkBook Gen 4 (GT7868Q) Dmitry Savin
@ 2024-07-16 22:27 ` Dmitry Savin
2024-08-02 11:00 ` Jiri Kosina
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Savin @ 2024-07-16 22:27 UTC (permalink / raw)
To: jikos, bentiss, linux-input; +Cc: terry.wong2, Dmitry Savin
GT7868Q has incorrect data in the report and needs a fixup.
The change enables haptic touchpad on Lenovo ThinkBook 13x Gen 4
and has been tested on the device.
Signed-off-by: Dmitry Savin <envelsavinds@gmail.com>
---
drivers/hid/hid-ids.h | 2 ++
drivers/hid/hid-multitouch.c | 33 +++++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 72d56ee7ce1b..eebfca375bcd 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -520,6 +520,8 @@
#define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_E100 0xe100
#define I2C_VENDOR_ID_GOODIX 0x27c6
+#define I2C_DEVICE_ID_GOODIX_01E8 0x01e8
+#define I2C_DEVICE_ID_GOODIX_01E9 0x01e9
#define I2C_DEVICE_ID_GOODIX_01F0 0x01f0
#define USB_VENDOR_ID_GOODTOUCH 0x1aad
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 56fc78841f24..99812c0f830b 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -1441,6 +1441,30 @@ static int mt_event(struct hid_device *hid, struct hid_field *field,
return 0;
}
+static __u8 *mt_report_fixup(struct hid_device *hdev, __u8 *rdesc,
+ unsigned int *size)
+{
+ if (hdev->vendor == I2C_VENDOR_ID_GOODIX &&
+ (hdev->product == I2C_DEVICE_ID_GOODIX_01E8 ||
+ hdev->product == I2C_DEVICE_ID_GOODIX_01E9)) {
+ if (rdesc[607] == 0x15) {
+ rdesc[607] = 0x25;
+ dev_info(
+ &hdev->dev,
+ "GT7868Q report descriptor fixup is applied.\n");
+ } else {
+ dev_info(
+ &hdev->dev,
+ "The byte is not expected for fixing the report descriptor. \
+It's possible that the touchpad firmware is not suitable for applying the fix. \
+got: %x\n",
+ rdesc[607]);
+ }
+ }
+
+ return rdesc;
+}
+
static void mt_report(struct hid_device *hid, struct hid_report *report)
{
struct mt_device *td = hid_get_drvdata(hid);
@@ -2035,6 +2059,14 @@ static const struct hid_device_id mt_devices[] = {
MT_BT_DEVICE(USB_VENDOR_ID_FRUCTEL,
USB_DEVICE_ID_GAMETEL_MT_MODE) },
+ /* Goodix GT7868Q devices */
+ { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT_NSMU,
+ HID_DEVICE(BUS_I2C, HID_GROUP_ANY, I2C_VENDOR_ID_GOODIX,
+ I2C_DEVICE_ID_GOODIX_01E8) },
+ { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT_NSMU,
+ HID_DEVICE(BUS_I2C, HID_GROUP_ANY, I2C_VENDOR_ID_GOODIX,
+ I2C_DEVICE_ID_GOODIX_01E8) },
+
/* GoodTouch panels */
{ .driver_data = MT_CLS_NSMU,
MT_USB_DEVICE(USB_VENDOR_ID_GOODTOUCH,
@@ -2270,6 +2302,7 @@ static struct hid_driver mt_driver = {
.feature_mapping = mt_feature_mapping,
.usage_table = mt_grabbed_usages,
.event = mt_event,
+ .report_fixup = mt_report_fixup,
.report = mt_report,
.suspend = pm_ptr(mt_suspend),
.reset_resume = pm_ptr(mt_reset_resume),
--
2.45.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] HID: multitouch: Add support for GT7868Q
2024-07-16 22:27 ` [PATCH 1/1] HID: multitouch: Add support for GT7868Q Dmitry Savin
@ 2024-08-02 11:00 ` Jiri Kosina
0 siblings, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2024-08-02 11:00 UTC (permalink / raw)
To: Dmitry Savin; +Cc: bentiss, linux-input, terry.wong2
On Tue, 16 Jul 2024, Dmitry Savin wrote:
> GT7868Q has incorrect data in the report and needs a fixup.
> The change enables haptic touchpad on Lenovo ThinkBook 13x Gen 4
> and has been tested on the device.
>
> Signed-off-by: Dmitry Savin <envelsavinds@gmail.com>
Applied, thanks.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-02 11:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-16 22:27 [PATCH 0/1] Enable touchpad for Lenovo 13x ThinkBook Gen 4 (GT7868Q) Dmitry Savin
2024-07-16 22:27 ` [PATCH 1/1] HID: multitouch: Add support for GT7868Q Dmitry Savin
2024-08-02 11:00 ` Jiri Kosina
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).