--- v2
+++ v1
@@ -14,12 +14,12 @@
---
drivers/input/touchscreen/Kconfig | 14 +
drivers/input/touchscreen/Makefile | 1 +
- drivers/input/touchscreen/cyttsp5.c | 1135 +++++++++++++++++++++++++++
- 3 files changed, 1150 insertions(+)
+ drivers/input/touchscreen/cyttsp5.c | 1129 +++++++++++++++++++++++++++
+ 3 files changed, 1144 insertions(+)
create mode 100644 drivers/input/touchscreen/cyttsp5.c
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
-index d4e74738c5a8..92c8b15b0025 100644
+index d4e74738c5a8..231cb0c1750b 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -284,6 +284,20 @@ config TOUCHSCREEN_CYTTSP4_SPI
@@ -28,7 +28,7 @@
+config TOUCHSCREEN_CYTTSP5
+ tristate "Cypress TrueTouch Gen5 Touchscreen Driver"
-+ depends on OF && I2C
++ depends on OF
+ select REGMAP_I2C
+ select CRC_ITU_T
+ help
@@ -57,10 +57,10 @@
obj-$(CONFIG_TOUCHSCREEN_DYNAPRO) += dynapro.o
diff --git a/drivers/input/touchscreen/cyttsp5.c b/drivers/input/touchscreen/cyttsp5.c
new file mode 100644
-index 000000000000..77938cb0c4bb
+index 000000000000..9406dbb5af6d
--- /dev/null
+++ b/drivers/input/touchscreen/cyttsp5.c
-@@ -0,0 +1,1135 @@
+@@ -0,0 +1,1129 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Parade TrueTouch(TM) Standard Product V5 Module.
@@ -102,7 +102,6 @@
+#define HID_OUTPUT_BL_LAUNCH_APP_SIZE 11
+#define HID_OUTPUT_GET_SYSINFO 0x2
+#define HID_OUTPUT_GET_SYSINFO_SIZE 5
-+#define HID_OUTPUT_MAX_CMD_SIZE 12
+
+#define HID_DESC_REG 0x1
+#define HID_INPUT_REG 0x3
@@ -152,8 +151,6 @@
+#define TOUCH_INPUT_HEADER_SIZE 7
+#define BTN_REPORT_SIZE 9
+#define BTN_INPUT_HEADER_SIZE 5
-+
-+#define MAX_CY_TCH_T_IDS 32
+
+/* All usage pages for Touch Report */
+#define TOUCH_REPORT_USAGE_PG_X 0x00010030
@@ -306,11 +303,7 @@
+static int cyttsp5_write(struct cyttsp5 *ts, unsigned int reg, u8 *data,
+ size_t size)
+{
-+ u8 cmd[HID_OUTPUT_MAX_CMD_SIZE];
-+
-+ if (size + 1 > HID_OUTPUT_MAX_CMD_SIZE) {
-+ return -ENOMEM;
-+ }
++ u8 cmd[size + 1];
+
+ /* High bytes of register address needed as first byte of cmd */
+ cmd[0] = HI_BYTE(reg);
@@ -372,8 +365,9 @@
+ int bofs)
+{
+ int nbyte;
-+
-+ for (nbyte = 0, *axis = 0; nbyte < size; nbyte++)
++ int next;
++
++ for (nbyte = 0, *axis = 0, next = 0; nbyte < size; nbyte++)
+ *axis = *axis + ((xy_data[nbyte] >> bofs) << (nbyte * 8));
+
+ *axis &= max - 1;
@@ -399,11 +393,11 @@
+{
+ struct cyttsp5_sysinfo *si = &ts->sysinfo;
+ int i, t = 0;
-+ DECLARE_BITMAP(ids, MAX_CY_TCH_T_IDS);
++ DECLARE_BITMAP(ids, si->tch_abs[CY_TCH_T].max);
+ u8 *tch_addr;
+ int tmp;
+
-+ bitmap_zero(ids, MAX_CY_TCH_T_IDS);
++ bitmap_zero(ids, si->tch_abs[CY_TCH_T].max);
+ memset(tch->abs, 0, sizeof(tch->abs));
+
+ for (i = 0; i < num_cur_tch; i++) {
@@ -1038,7 +1032,7 @@
+
+#ifdef CONFIG_OF
+static const struct of_device_id cyttsp5_of_match[] = {
-+ { .compatible = "cypress,tt21000", },
++ { .compatible = "cypress,cyttsp5", },
+ { }
+};
+MODULE_DEVICE_TABLE(of, cyttsp5_of_match);