|
@@ -1,4 +1,4 @@
|
|
|
-From d71356f0e8252996fda27e4a03664da90efc577f Mon Sep 17 00:00:00 2001
|
|
|
+From 8ba654f7567c8ca06612be2e9e13cdfc411bca1b Mon Sep 17 00:00:00 2001
|
|
|
From: Dorian Stoll <dorian.stoll@tmsp.io>
|
|
|
Date: Thu, 30 Jul 2020 13:21:53 +0200
|
|
|
Subject: [PATCH] misc: mei: Add missing IPTS device IDs
|
|
@@ -34,9 +34,9 @@ index 5bf0d50d55a00..c13864512229f 100644
|
|
|
|
|
|
{MEI_PCI_DEVICE(MEI_DEV_ID_TGP_LP, MEI_ME_PCH15_CFG)},
|
|
|
--
|
|
|
-2.40.0
|
|
|
+2.40.1
|
|
|
|
|
|
-From 9775c66b44195a467fdaf96c5b71c5fc31391cdd Mon Sep 17 00:00:00 2001
|
|
|
+From 2b766dc35214fb33650cf5ba0ad170dd27d69624 Mon Sep 17 00:00:00 2001
|
|
|
From: Liban Hannan <liban.p@gmail.com>
|
|
|
Date: Tue, 12 Apr 2022 23:31:12 +0100
|
|
|
Subject: [PATCH] iommu: ipts: use IOMMU passthrough mode for IPTS
|
|
@@ -134,9 +134,9 @@ index d4b5d20bd6dda..3965979c7bd41 100644
|
|
|
{
|
|
|
if (risky_device(dev))
|
|
|
--
|
|
|
-2.40.0
|
|
|
+2.40.1
|
|
|
|
|
|
-From ea88c1babdb7cc5e158f59dd95e3d4ab994f3dd5 Mon Sep 17 00:00:00 2001
|
|
|
+From 44eddfd2fd4e7d69e3b9a8d8453e0b94ff29c787 Mon Sep 17 00:00:00 2001
|
|
|
From: Dorian Stoll <dorian.stoll@tmsp.io>
|
|
|
Date: Sun, 11 Dec 2022 12:00:59 +0100
|
|
|
Subject: [PATCH] hid: Add support for Intel Precise Touch and Stylus
|
|
@@ -2984,5 +2984,197 @@ index 0000000000000..a314843599fc3
|
|
|
+
|
|
|
+#endif /* IPTS_THREAD_H */
|
|
|
--
|
|
|
-2.40.0
|
|
|
+2.40.1
|
|
|
+
|
|
|
+From 47448c1cadd082840ccb3a7932c3fe34bd919777 Mon Sep 17 00:00:00 2001
|
|
|
+From: Dorian Stoll <dorian.stoll@tmsp.io>
|
|
|
+Date: Fri, 28 Apr 2023 15:41:12 +0200
|
|
|
+Subject: [PATCH] Update IPTS from module repo
|
|
|
+
|
|
|
+Changes:
|
|
|
+ * Fix redefinition error on AOSP clang
|
|
|
+ * Increase the polling frequency to reduce latency
|
|
|
+ * Don't allocate a new buffer for every HID report
|
|
|
+ * Always use the generic HID driver instead of forcing hid-multitouch
|
|
|
+
|
|
|
+Based on https://github.com/linux-surface/intel-precise-touch/commit/a2b675d72dbde80ebe36a5b6ceaebd596c030314
|
|
|
+
|
|
|
+Signed-off-by: Dorian Stoll <dorian.stoll@tmsp.io>
|
|
|
+Patchset: ipts
|
|
|
+---
|
|
|
+ drivers/hid/ipts/hid.c | 15 +++++----------
|
|
|
+ drivers/hid/ipts/receiver.c | 2 +-
|
|
|
+ drivers/hid/ipts/resources.c | 35 +++++++++++++++++++++++++++++++----
|
|
|
+ drivers/hid/ipts/resources.h | 3 +++
|
|
|
+ 4 files changed, 40 insertions(+), 15 deletions(-)
|
|
|
+
|
|
|
+diff --git a/drivers/hid/ipts/hid.c b/drivers/hid/ipts/hid.c
|
|
|
+index 6782394e8dde3..a2471219615bc 100644
|
|
|
+--- a/drivers/hid/ipts/hid.c
|
|
|
++++ b/drivers/hid/ipts/hid.c
|
|
|
+@@ -237,7 +237,6 @@ static struct hid_ll_driver ipts_hid_driver = {
|
|
|
+
|
|
|
+ int ipts_hid_input_data(struct ipts_context *ipts, u32 buffer)
|
|
|
+ {
|
|
|
+- int ret = 0;
|
|
|
+ u8 *temp = NULL;
|
|
|
+ struct ipts_hid_header *frame = NULL;
|
|
|
+ struct ipts_data_header *header = NULL;
|
|
|
+@@ -250,6 +249,9 @@ int ipts_hid_input_data(struct ipts_context *ipts, u32 buffer)
|
|
|
+
|
|
|
+ header = (struct ipts_data_header *)ipts->resources.data[buffer].address;
|
|
|
+
|
|
|
++ temp = ipts->resources.report.address;
|
|
|
++ memset(temp, 0, ipts->resources.report.size);
|
|
|
++
|
|
|
+ if (!header)
|
|
|
+ return -EFAULT;
|
|
|
+
|
|
|
+@@ -273,10 +275,6 @@ int ipts_hid_input_data(struct ipts_context *ipts, u32 buffer)
|
|
|
+ if (header->size + 3 + sizeof(struct ipts_hid_header) > IPTS_HID_REPORT_DATA_SIZE)
|
|
|
+ return -ERANGE;
|
|
|
+
|
|
|
+- temp = kzalloc(IPTS_HID_REPORT_DATA_SIZE, GFP_KERNEL);
|
|
|
+- if (!temp)
|
|
|
+- return -ENOMEM;
|
|
|
+-
|
|
|
+ /*
|
|
|
+ * Synthesize a HID report matching the devices that natively send HID reports
|
|
|
+ */
|
|
|
+@@ -288,10 +286,7 @@ int ipts_hid_input_data(struct ipts_context *ipts, u32 buffer)
|
|
|
+
|
|
|
+ memcpy(frame->data, header->data, header->size);
|
|
|
+
|
|
|
+- ret = hid_input_report(ipts->hid, HID_INPUT_REPORT, temp, IPTS_HID_REPORT_DATA_SIZE, 1);
|
|
|
+- kfree(temp);
|
|
|
+-
|
|
|
+- return ret;
|
|
|
++ return hid_input_report(ipts->hid, HID_INPUT_REPORT, temp, IPTS_HID_REPORT_DATA_SIZE, 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ int ipts_hid_init(struct ipts_context *ipts, struct ipts_device_info info)
|
|
|
+@@ -318,7 +313,7 @@ int ipts_hid_init(struct ipts_context *ipts, struct ipts_device_info info)
|
|
|
+
|
|
|
+ ipts->hid->vendor = info.vendor;
|
|
|
+ ipts->hid->product = info.product;
|
|
|
+- ipts->hid->group = HID_GROUP_MULTITOUCH;
|
|
|
++ ipts->hid->group = HID_GROUP_GENERIC;
|
|
|
+
|
|
|
+ snprintf(ipts->hid->name, sizeof(ipts->hid->name), "IPTS %04X:%04X", info.vendor,
|
|
|
+ info.product);
|
|
|
+diff --git a/drivers/hid/ipts/receiver.c b/drivers/hid/ipts/receiver.c
|
|
|
+index 77234f9e0e178..f56e9ed32d579 100644
|
|
|
+--- a/drivers/hid/ipts/receiver.c
|
|
|
++++ b/drivers/hid/ipts/receiver.c
|
|
|
+@@ -42,7 +42,7 @@ static void ipts_receiver_backoff(time64_t last, u32 n)
|
|
|
+ * n seconds, sleep longer to avoid wasting CPU cycles.
|
|
|
+ */
|
|
|
+ if (last + n > ktime_get_seconds())
|
|
|
+- msleep(20);
|
|
|
++ usleep_range(1 * USEC_PER_MSEC, 5 * USEC_PER_MSEC);
|
|
|
+ else
|
|
|
+ msleep(200);
|
|
|
+ }
|
|
|
+diff --git a/drivers/hid/ipts/resources.c b/drivers/hid/ipts/resources.c
|
|
|
+index 80ba5885bb55d..5e924d58c4880 100644
|
|
|
+--- a/drivers/hid/ipts/resources.c
|
|
|
++++ b/drivers/hid/ipts/resources.c
|
|
|
+@@ -9,6 +9,7 @@
|
|
|
+ #include <linux/dma-mapping.h>
|
|
|
+ #include <linux/types.h>
|
|
|
+
|
|
|
++#include "desc.h"
|
|
|
+ #include "resources.h"
|
|
|
+ #include "spec-device.h"
|
|
|
+
|
|
|
+@@ -49,16 +50,22 @@ int ipts_resources_init(struct ipts_resources *res, struct device *dev, size_t d
|
|
|
+ {
|
|
|
+ int ret = 0;
|
|
|
+
|
|
|
++ /*
|
|
|
++ * Some compilers (AOSP clang) complain about a redefined
|
|
|
++ * variable when this is declared inside of the for loop.
|
|
|
++ */
|
|
|
++ int i = 0;
|
|
|
++
|
|
|
+ if (!res)
|
|
|
+ return -EFAULT;
|
|
|
+
|
|
|
+- for (int i = 0; i < IPTS_BUFFERS; i++) {
|
|
|
++ for (i = 0; i < IPTS_BUFFERS; i++) {
|
|
|
+ ret = ipts_resources_alloc_buffer(&res->data[i], dev, ds);
|
|
|
+ if (ret)
|
|
|
+ goto err;
|
|
|
+ }
|
|
|
+
|
|
|
+- for (int i = 0; i < IPTS_BUFFERS; i++) {
|
|
|
++ for (i = 0; i < IPTS_BUFFERS; i++) {
|
|
|
+ ret = ipts_resources_alloc_buffer(&res->feedback[i], dev, fs);
|
|
|
+ if (ret)
|
|
|
+ goto err;
|
|
|
+@@ -80,6 +87,16 @@ int ipts_resources_init(struct ipts_resources *res, struct device *dev, size_t d
|
|
|
+ if (ret)
|
|
|
+ goto err;
|
|
|
+
|
|
|
++ if (!res->report.address) {
|
|
|
++ res->report.size = IPTS_HID_REPORT_DATA_SIZE;
|
|
|
++ res->report.address = kzalloc(res->report.size, GFP_KERNEL);
|
|
|
++
|
|
|
++ if (!res->report.address) {
|
|
|
++ ret = -ENOMEM;
|
|
|
++ goto err;
|
|
|
++ }
|
|
|
++ }
|
|
|
++
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ err:
|
|
|
+@@ -90,13 +107,19 @@ int ipts_resources_init(struct ipts_resources *res, struct device *dev, size_t d
|
|
|
+
|
|
|
+ int ipts_resources_free(struct ipts_resources *res)
|
|
|
+ {
|
|
|
++ /*
|
|
|
++ * Some compilers (AOSP clang) complain about a redefined
|
|
|
++ * variable when this is declared inside of the for loop.
|
|
|
++ */
|
|
|
++ int i = 0;
|
|
|
++
|
|
|
+ if (!res)
|
|
|
+ return -EFAULT;
|
|
|
+
|
|
|
+- for (int i = 0; i < IPTS_BUFFERS; i++)
|
|
|
++ for (i = 0; i < IPTS_BUFFERS; i++)
|
|
|
+ ipts_resources_free_buffer(&res->data[i]);
|
|
|
+
|
|
|
+- for (int i = 0; i < IPTS_BUFFERS; i++)
|
|
|
++ for (i = 0; i < IPTS_BUFFERS; i++)
|
|
|
+ ipts_resources_free_buffer(&res->feedback[i]);
|
|
|
+
|
|
|
+ ipts_resources_free_buffer(&res->doorbell);
|
|
|
+@@ -104,5 +127,9 @@ int ipts_resources_free(struct ipts_resources *res)
|
|
|
+ ipts_resources_free_buffer(&res->hid2me);
|
|
|
+ ipts_resources_free_buffer(&res->descriptor);
|
|
|
+
|
|
|
++ kfree(res->report.address);
|
|
|
++ res->report.address = NULL;
|
|
|
++ res->report.size = 0;
|
|
|
++
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+diff --git a/drivers/hid/ipts/resources.h b/drivers/hid/ipts/resources.h
|
|
|
+index 6cbb24a8a0543..e0c400f420b93 100644
|
|
|
+--- a/drivers/hid/ipts/resources.h
|
|
|
++++ b/drivers/hid/ipts/resources.h
|
|
|
+@@ -31,6 +31,9 @@ struct ipts_resources {
|
|
|
+ struct ipts_buffer hid2me;
|
|
|
+
|
|
|
+ struct ipts_buffer descriptor;
|
|
|
++
|
|
|
++ // Buffer for synthesizing HID reports
|
|
|
++ struct ipts_buffer report;
|
|
|
+ };
|
|
|
+
|
|
|
+ int ipts_resources_init(struct ipts_resources *res, struct device *dev, size_t ds, size_t fs);
|
|
|
+--
|
|
|
+2.40.1
|
|
|
|