From 90d282aece9479fdb9969553487f5afd20c382b4 Mon Sep 17 00:00:00 2001 From: Denis Kirjanov Date: Jan 19 2021 15:02:32 +0000 Subject: Merge branch 'users/tiwai/SLE15-SP3/for-next' into SLE15-SP3 Pull Input subsystem updates from Takashi Iwai --- diff --git a/patches.suse/Input-elan_i2c-add-firmware-update-info-for-ICs-0x11.patch b/patches.suse/Input-elan_i2c-add-firmware-update-info-for-ICs-0x11.patch new file mode 100644 index 0000000..2200551 --- /dev/null +++ b/patches.suse/Input-elan_i2c-add-firmware-update-info-for-ICs-0x11.patch @@ -0,0 +1,54 @@ +From 8d73ec7411e084de8266bc3cb031d85a222458be Mon Sep 17 00:00:00 2001 +From: Jingle Wu +Date: Thu, 16 Jul 2020 22:55:57 -0700 +Subject: [PATCH] Input: elan_i2c - add firmware update info for ICs 0x11, 0x13, 0x14 +Git-commit: 8d73ec7411e084de8266bc3cb031d85a222458be +Patch-mainline: v5.9-rc1 +References: bsc#1180870 + +This adds firmware size and page sizes for ic types 0x11, 0x13 and 0x14. +IC 0x14 uses 512-byte firmware page size. + +Signed-off-by: Jingle Wu . +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/mouse/elan_i2c_core.c | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c +index e0f42def99aa..5c933e16abc1 100644 +--- a/drivers/input/mouse/elan_i2c_core.c ++++ b/drivers/input/mouse/elan_i2c_core.c +@@ -127,6 +127,15 @@ static int elan_get_fwinfo(u16 ic_type, u8 iap_version, u16 *validpage_count, + case 0x10: + *validpage_count = 1024; + break; ++ case 0x11: ++ *validpage_count = 1280; ++ break; ++ case 0x13: ++ *validpage_count = 2048; ++ break; ++ case 0x14: ++ *validpage_count = 1024; ++ break; + default: + /* unknown ic type clear value */ + *validpage_count = 0; +@@ -138,7 +147,10 @@ static int elan_get_fwinfo(u16 ic_type, u8 iap_version, u16 *validpage_count, + *signature_address = + (*validpage_count * ETP_FW_PAGE_SIZE) - ETP_FW_SIGNATURE_SIZE; + +- if (ic_type >= 0x0D && iap_version >= 1) { ++ if (ic_type == 0x14 && iap_version >= 2) { ++ *validpage_count /= 8; ++ *page_size = ETP_FW_PAGE_SIZE_512; ++ } else if (ic_type >= 0x0D && iap_version >= 1) { + *validpage_count /= 2; + *page_size = ETP_FW_PAGE_SIZE_128; + } else { +-- +2.26.2 + diff --git a/patches.suse/Input-elan_i2c-add-ic-type-0x15.patch b/patches.suse/Input-elan_i2c-add-ic-type-0x15.patch new file mode 100644 index 0000000..1cbc70d --- /dev/null +++ b/patches.suse/Input-elan_i2c-add-ic-type-0x15.patch @@ -0,0 +1,43 @@ +From 873a3a14a47e819bb2d1e3cf4dc8c59c200ec32b Mon Sep 17 00:00:00 2001 +From: Jingle Wu +Date: Wed, 29 Jul 2020 23:31:33 -0700 +Subject: [PATCH] Input: elan_i2c - add ic type 0x15 +Git-commit: 873a3a14a47e819bb2d1e3cf4dc8c59c200ec32b +Patch-mainline: v5.9-rc1 +References: bsc#1180870 + +The update firmware flow of ic type 0x15 is same with ic type 0x14. + +Signed-off-by: Jingle Wu +Link: https://lore.kernel.org/r/20200730060526.12439-1-jingle.wu@emc.com.tw +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/mouse/elan_i2c_core.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c +index 8a0f224da423..c599e21a8478 100644 +--- a/drivers/input/mouse/elan_i2c_core.c ++++ b/drivers/input/mouse/elan_i2c_core.c +@@ -138,6 +138,7 @@ static int elan_get_fwinfo(u16 ic_type, u8 iap_version, u16 *validpage_count, + *validpage_count = 2048; + break; + case 0x14: ++ case 0x15: + *validpage_count = 1024; + break; + default: +@@ -151,7 +152,7 @@ static int elan_get_fwinfo(u16 ic_type, u8 iap_version, u16 *validpage_count, + *signature_address = + (*validpage_count * ETP_FW_PAGE_SIZE) - ETP_FW_SIGNATURE_SIZE; + +- if (ic_type == 0x14 && iap_version >= 2) { ++ if ((ic_type == 0x14 || ic_type == 0x15) && iap_version >= 2) { + *validpage_count /= 8; + *page_size = ETP_FW_PAGE_SIZE_512; + } else if (ic_type >= 0x0D && iap_version >= 1) { +-- +2.26.2 + diff --git a/patches.suse/Input-elan_i2c-add-new-trackpoint-report-type-0x5F.patch b/patches.suse/Input-elan_i2c-add-new-trackpoint-report-type-0x5F.patch new file mode 100644 index 0000000..37e37d6 --- /dev/null +++ b/patches.suse/Input-elan_i2c-add-new-trackpoint-report-type-0x5F.patch @@ -0,0 +1,110 @@ +From 056115daede8d01f71732bc7d778fb85acee8eb6 Mon Sep 17 00:00:00 2001 +From: Jingle Wu +Date: Thu, 10 Dec 2020 23:40:09 -0800 +Subject: [PATCH] Input: elan_i2c - add new trackpoint report type 0x5F +Git-commit: 056115daede8d01f71732bc7d778fb85acee8eb6 +Patch-mainline: v5.11-rc1 +References: bsc#1180870 + +The 0x5F is a new trackpoint report type used by some modules. + +Signed-off-by: Jingle Wu +Link: https://lore.kernel.org/r/20201211071511.32349-1-jingle.wu@emc.com.tw +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/mouse/elan_i2c.h | 16 ++++++++++++++++ + drivers/input/mouse/elan_i2c_core.c | 13 +------------ + drivers/input/mouse/elan_i2c_smbus.c | 8 ++++++-- + 3 files changed, 23 insertions(+), 14 deletions(-) + +diff --git a/drivers/input/mouse/elan_i2c.h b/drivers/input/mouse/elan_i2c.h +index c75b00c45d75..84bb386e97fe 100644 +--- a/drivers/input/mouse/elan_i2c.h ++++ b/drivers/input/mouse/elan_i2c.h +@@ -28,6 +28,22 @@ + + #define ETP_FEATURE_REPORT_MK BIT(0) + ++#define ETP_REPORT_ID 0x5D ++#define ETP_TP_REPORT_ID 0x5E ++#define ETP_TP_REPORT_ID2 0x5F ++#define ETP_REPORT_ID2 0x60 /* High precision report */ ++ ++#define ETP_REPORT_ID_OFFSET 2 ++#define ETP_TOUCH_INFO_OFFSET 3 ++#define ETP_FINGER_DATA_OFFSET 4 ++#define ETP_HOVER_INFO_OFFSET 30 ++#define ETP_MK_DATA_OFFSET 33 /* For high precision reports */ ++ ++#define ETP_MAX_REPORT_LEN 39 ++ ++#define ETP_MAX_FINGERS 5 ++#define ETP_FINGER_DATA_LEN 5 ++ + /* IAP Firmware handling */ + #define ETP_PRODUCT_ID_FORMAT_STRING "%d.0" + #define ETP_FW_NAME "elan_i2c_" ETP_PRODUCT_ID_FORMAT_STRING ".bin" +diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c +index 65d21a050cea..3a8b9e890010 100644 +--- a/drivers/input/mouse/elan_i2c_core.c ++++ b/drivers/input/mouse/elan_i2c_core.c +@@ -46,18 +46,6 @@ + #define ETP_FINGER_WIDTH 15 + #define ETP_RETRY_COUNT 3 + +-#define ETP_MAX_FINGERS 5 +-#define ETP_FINGER_DATA_LEN 5 +-#define ETP_REPORT_ID 0x5D +-#define ETP_REPORT_ID2 0x60 /* High precision report */ +-#define ETP_TP_REPORT_ID 0x5E +-#define ETP_REPORT_ID_OFFSET 2 +-#define ETP_TOUCH_INFO_OFFSET 3 +-#define ETP_FINGER_DATA_OFFSET 4 +-#define ETP_HOVER_INFO_OFFSET 30 +-#define ETP_MK_DATA_OFFSET 33 /* For high precision reports */ +-#define ETP_MAX_REPORT_LEN 39 +- + /* The main device structure */ + struct elan_tp_data { + struct i2c_client *client; +@@ -1074,6 +1062,7 @@ static irqreturn_t elan_isr(int irq, void *dev_id) + elan_report_absolute(data, report, true); + break; + case ETP_TP_REPORT_ID: ++ case ETP_TP_REPORT_ID2: + elan_report_trackpoint(data, report); + break; + default: +diff --git a/drivers/input/mouse/elan_i2c_smbus.c b/drivers/input/mouse/elan_i2c_smbus.c +index 8ff823751f3b..1f38fab1825a 100644 +--- a/drivers/input/mouse/elan_i2c_smbus.c ++++ b/drivers/input/mouse/elan_i2c_smbus.c +@@ -45,6 +45,7 @@ + #define ETP_SMBUS_CALIBRATE_QUERY 0xC5 + + #define ETP_SMBUS_REPORT_LEN 32 ++#define ETP_SMBUS_REPORT_LEN2 7 + #define ETP_SMBUS_REPORT_OFFSET 2 + #define ETP_SMBUS_HELLOPACKET_LEN 5 + #define ETP_SMBUS_IAP_PASSWORD 0x1234 +@@ -497,10 +498,13 @@ static int elan_smbus_get_report(struct i2c_client *client, + return len; + } + +- if (len != ETP_SMBUS_REPORT_LEN) { ++ if (report[ETP_REPORT_ID_OFFSET] == ETP_TP_REPORT_ID2) ++ report_len = ETP_SMBUS_REPORT_LEN2; ++ ++ if (len != report_len) { + dev_err(&client->dev, + "wrong report length (%d vs %d expected)\n", +- len, ETP_SMBUS_REPORT_LEN); ++ len, report_len); + return -EIO; + } + +-- +2.26.2 + diff --git a/patches.suse/Input-elan_i2c-add-support-for-different-firmware-pa.patch b/patches.suse/Input-elan_i2c-add-support-for-different-firmware-pa.patch new file mode 100644 index 0000000..5ad8172 --- /dev/null +++ b/patches.suse/Input-elan_i2c-add-support-for-different-firmware-pa.patch @@ -0,0 +1,242 @@ +From 059d6c2de6fd521d4d4a39d127eece3de114b767 Mon Sep 17 00:00:00 2001 +From: Jingle Wu +Date: Thu, 16 Jul 2020 21:32:23 -0700 +Subject: [PATCH] Input: elan_i2c - add support for different firmware page sizes +Git-commit: 059d6c2de6fd521d4d4a39d127eece3de114b767 +Patch-mainline: v5.9-rc1 +References: bsc#1180870 + +Prepare driver for devices that use different sizes of firmware pages. + +Signed-off-by: Jingle Wu +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/mouse/elan_i2c.h | 4 +++- + drivers/input/mouse/elan_i2c_core.c | 24 +++++++++++++--------- + drivers/input/mouse/elan_i2c_i2c.c | 30 ++++++++++++++++++---------- + drivers/input/mouse/elan_i2c_smbus.c | 8 ++++---- + 4 files changed, 41 insertions(+), 25 deletions(-) + +diff --git a/drivers/input/mouse/elan_i2c.h b/drivers/input/mouse/elan_i2c.h +index a9074ac9364f..b504f560a666 100644 +--- a/drivers/input/mouse/elan_i2c.h ++++ b/drivers/input/mouse/elan_i2c.h +@@ -33,6 +33,8 @@ + #define ETP_FW_IAP_PAGE_ERR (1 << 5) + #define ETP_FW_IAP_INTF_ERR (1 << 4) + #define ETP_FW_PAGE_SIZE 64 ++#define ETP_FW_PAGE_SIZE_128 128 ++#define ETP_FW_PAGE_SIZE_512 512 + #define ETP_FW_SIGNATURE_SIZE 6 + + struct i2c_client; +@@ -73,7 +75,7 @@ struct elan_transport_ops { + int (*iap_reset)(struct i2c_client *client); + + int (*prepare_fw_update)(struct i2c_client *client); +- int (*write_fw_block)(struct i2c_client *client, ++ int (*write_fw_block)(struct i2c_client *client, u16 fw_page_size, + const u8 *page, u16 checksum, int idx); + int (*finish_fw_update)(struct i2c_client *client, + struct completion *reset_done); +diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c +index f1dade60f407..46f334bcfc0e 100644 +--- a/drivers/input/mouse/elan_i2c_core.c ++++ b/drivers/input/mouse/elan_i2c_core.c +@@ -89,7 +89,8 @@ struct elan_tp_data { + u8 mode; + u16 ic_type; + u16 fw_validpage_count; +- u16 fw_signature_address; ++ u16 fw_page_size; ++ u32 fw_signature_address; + + bool irq_wake; + +@@ -101,7 +102,7 @@ struct elan_tp_data { + }; + + static int elan_get_fwinfo(u16 ic_type, u16 *validpage_count, +- u16 *signature_address) ++ u32 *signature_address, u16 *page_size) + { + switch (ic_type) { + case 0x00: +@@ -130,12 +131,15 @@ static int elan_get_fwinfo(u16 ic_type, u16 *validpage_count, + /* unknown ic type clear value */ + *validpage_count = 0; + *signature_address = 0; ++ *page_size = 0; + return -ENXIO; + } + + *signature_address = + (*validpage_count * ETP_FW_PAGE_SIZE) - ETP_FW_SIGNATURE_SIZE; + ++ *page_size = ETP_FW_PAGE_SIZE; ++ + return 0; + } + +@@ -336,7 +340,8 @@ static int elan_query_device_info(struct elan_tp_data *data) + return error; + + error = elan_get_fwinfo(data->ic_type, &data->fw_validpage_count, +- &data->fw_signature_address); ++ &data->fw_signature_address, ++ &data->fw_page_size); + if (error) + dev_warn(&data->client->dev, + "unexpected iap version %#04x (ic type: %#04x), firmware update will not work\n", +@@ -424,14 +429,14 @@ static int elan_query_device_parameters(struct elan_tp_data *data) + * IAP firmware updater related routines + ********************************************************** + */ +-static int elan_write_fw_block(struct elan_tp_data *data, ++static int elan_write_fw_block(struct elan_tp_data *data, u16 page_size, + const u8 *page, u16 checksum, int idx) + { + int retry = ETP_RETRY_COUNT; + int error; + + do { +- error = data->ops->write_fw_block(data->client, ++ error = data->ops->write_fw_block(data->client, page_size, + page, checksum, idx); + if (!error) + return 0; +@@ -460,15 +465,16 @@ static int __elan_update_firmware(struct elan_tp_data *data, + + iap_start_addr = get_unaligned_le16(&fw->data[ETP_IAP_START_ADDR * 2]); + +- boot_page_count = (iap_start_addr * 2) / ETP_FW_PAGE_SIZE; ++ boot_page_count = (iap_start_addr * 2) / data->fw_page_size; + for (i = boot_page_count; i < data->fw_validpage_count; i++) { + u16 checksum = 0; +- const u8 *page = &fw->data[i * ETP_FW_PAGE_SIZE]; ++ const u8 *page = &fw->data[i * data->fw_page_size]; + +- for (j = 0; j < ETP_FW_PAGE_SIZE; j += 2) ++ for (j = 0; j < data->fw_page_size; j += 2) + checksum += ((page[j + 1] << 8) | page[j]); + +- error = elan_write_fw_block(data, page, checksum, i); ++ error = elan_write_fw_block(data, data->fw_page_size, ++ page, checksum, i); + if (error) { + dev_err(dev, "write page %d fail: %d\n", i, error); + return error; +diff --git a/drivers/input/mouse/elan_i2c_i2c.c b/drivers/input/mouse/elan_i2c_i2c.c +index 317166a264e6..4dfc3c2b4706 100644 +--- a/drivers/input/mouse/elan_i2c_i2c.c ++++ b/drivers/input/mouse/elan_i2c_i2c.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -592,45 +593,52 @@ static int elan_i2c_prepare_fw_update(struct i2c_client *client) + return 0; + } + +-static int elan_i2c_write_fw_block(struct i2c_client *client, ++static int elan_i2c_write_fw_block(struct i2c_client *client, u16 fw_page_size, + const u8 *page, u16 checksum, int idx) + { + struct device *dev = &client->dev; +- u8 page_store[ETP_FW_PAGE_SIZE + 4]; ++ u8 *page_store; + u8 val[3]; + u16 result; + int ret, error; + ++ page_store = kmalloc(fw_page_size + 4, GFP_KERNEL); ++ if (!page_store) ++ return -ENOMEM; ++ + page_store[0] = ETP_I2C_IAP_REG_L; + page_store[1] = ETP_I2C_IAP_REG_H; +- memcpy(&page_store[2], page, ETP_FW_PAGE_SIZE); ++ memcpy(&page_store[2], page, fw_page_size); + /* recode checksum at last two bytes */ +- put_unaligned_le16(checksum, &page_store[ETP_FW_PAGE_SIZE + 2]); ++ put_unaligned_le16(checksum, &page_store[fw_page_size + 2]); + +- ret = i2c_master_send(client, page_store, sizeof(page_store)); +- if (ret != sizeof(page_store)) { ++ ret = i2c_master_send(client, page_store, fw_page_size + 4); ++ if (ret != fw_page_size + 4) { + error = ret < 0 ? ret : -EIO; + dev_err(dev, "Failed to write page %d: %d\n", idx, error); +- return error; ++ goto exit; + } + + /* Wait for F/W to update one page ROM data. */ +- msleep(35); ++ msleep(fw_page_size == ETP_FW_PAGE_SIZE_512 ? 50 : 35); + + error = elan_i2c_read_cmd(client, ETP_I2C_IAP_CTRL_CMD, val); + if (error) { + dev_err(dev, "Failed to read IAP write result: %d\n", error); +- return error; ++ goto exit; + } + + result = le16_to_cpup((__le16 *)val); + if (result & (ETP_FW_IAP_PAGE_ERR | ETP_FW_IAP_INTF_ERR)) { + dev_err(dev, "IAP reports failed write: %04hx\n", + result); +- return -EIO; ++ error = -EIO; ++ goto exit; + } + +- return 0; ++exit: ++ kfree(page_store); ++ return error; + } + + static int elan_i2c_finish_fw_update(struct i2c_client *client, +diff --git a/drivers/input/mouse/elan_i2c_smbus.c b/drivers/input/mouse/elan_i2c_smbus.c +index 8c3185d54c73..59eec1a2ed5c 100644 +--- a/drivers/input/mouse/elan_i2c_smbus.c ++++ b/drivers/input/mouse/elan_i2c_smbus.c +@@ -414,7 +414,7 @@ static int elan_smbus_prepare_fw_update(struct i2c_client *client) + } + + +-static int elan_smbus_write_fw_block(struct i2c_client *client, ++static int elan_smbus_write_fw_block(struct i2c_client *client, u16 fw_page_size, + const u8 *page, u16 checksum, int idx) + { + struct device *dev = &client->dev; +@@ -429,7 +429,7 @@ static int elan_smbus_write_fw_block(struct i2c_client *client, + */ + error = i2c_smbus_write_block_data(client, + ETP_SMBUS_WRITE_FW_BLOCK, +- ETP_FW_PAGE_SIZE / 2, ++ fw_page_size / 2, + page); + if (error) { + dev_err(dev, "Failed to write page %d (part %d): %d\n", +@@ -439,8 +439,8 @@ static int elan_smbus_write_fw_block(struct i2c_client *client, + + error = i2c_smbus_write_block_data(client, + ETP_SMBUS_WRITE_FW_BLOCK, +- ETP_FW_PAGE_SIZE / 2, +- page + ETP_FW_PAGE_SIZE / 2); ++ fw_page_size / 2, ++ page + fw_page_size / 2); + if (error) { + dev_err(dev, "Failed to write page %d (part %d): %d\n", + idx, 2, error); +-- +2.26.2 + diff --git a/patches.suse/Input-elan_i2c-add-support-for-high-resolution-repor.patch b/patches.suse/Input-elan_i2c-add-support-for-high-resolution-repor.patch new file mode 100644 index 0000000..373ba33 --- /dev/null +++ b/patches.suse/Input-elan_i2c-add-support-for-high-resolution-repor.patch @@ -0,0 +1,415 @@ +From 04d5ce620f794f1df69b5f1b9ad62910fea547f1 Mon Sep 17 00:00:00 2001 +From: Jingle Wu +Date: Mon, 20 Jul 2020 12:46:10 -0700 +Subject: [PATCH] Input: elan_i2c - add support for high resolution reports +Git-commit: 04d5ce620f794f1df69b5f1b9ad62910fea547f1 +Patch-mainline: v5.9-rc1 +References: bsc#1180870 + +Newer controllers (identified as "pattern" version 2) send higher +resolution reports, with 16-bit X and Y coordinates (previous generations +used 12-bit values). These new high resolution reports use report ID of +0x60. + +SMbus controllers use the same buffer size for both the new and old +reports, and because of that high resolution reports no longer carry +area of contact data with SMbus. + +Signed-off-by: Jingle Wu +Link: https://lore.kernel.org/r/20200710054116.5529-1-jingle.wu@emc.com.tw +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/mouse/elan_i2c.h | 8 +- + drivers/input/mouse/elan_i2c_core.c | 126 +++++++++++++++++++++-------------- + drivers/input/mouse/elan_i2c_i2c.c | 34 ++++++--- + drivers/input/mouse/elan_i2c_smbus.c | 17 ++++ + 4 files changed, 126 insertions(+), 59 deletions(-) + +--- a/drivers/input/mouse/elan_i2c.h ++++ b/drivers/input/mouse/elan_i2c.h +@@ -26,6 +26,8 @@ + + #define ETP_CALIBRATE_MAX_LEN 3 + ++#define ETP_FEATURE_REPORT_MK BIT(0) ++ + /* IAP Firmware handling */ + #define ETP_PRODUCT_ID_FORMAT_STRING "%d.0" + #define ETP_FW_NAME "elan_i2c_" ETP_PRODUCT_ID_FORMAT_STRING ".bin" +@@ -82,7 +84,11 @@ struct elan_transport_ops { + int (*finish_fw_update)(struct i2c_client *client, + struct completion *reset_done); + +- int (*get_report)(struct i2c_client *client, u8 *report); ++ int (*get_report_features)(struct i2c_client *client, u8 pattern, ++ unsigned int *features, ++ unsigned int *report_len); ++ int (*get_report)(struct i2c_client *client, u8 *report, ++ unsigned int report_len); + int (*get_pressure_adjustment)(struct i2c_client *client, + int *adjustment); + int (*get_pattern)(struct i2c_client *client, u8 *pattern); +--- a/drivers/input/mouse/elan_i2c_core.c ++++ b/drivers/input/mouse/elan_i2c_core.c +@@ -50,12 +50,14 @@ + #define ETP_MAX_FINGERS 5 + #define ETP_FINGER_DATA_LEN 5 + #define ETP_REPORT_ID 0x5D ++#define ETP_REPORT_ID2 0x60 /* High precision report */ + #define ETP_TP_REPORT_ID 0x5E + #define ETP_REPORT_ID_OFFSET 2 + #define ETP_TOUCH_INFO_OFFSET 3 + #define ETP_FINGER_DATA_OFFSET 4 + #define ETP_HOVER_INFO_OFFSET 30 +-#define ETP_MAX_REPORT_LEN 34 ++#define ETP_MK_DATA_OFFSET 33 /* For high precision reports */ ++#define ETP_MAX_REPORT_LEN 39 + + /* The main device structure */ + struct elan_tp_data { +@@ -85,6 +87,8 @@ struct elan_tp_data { + u8 sm_version; + u8 iap_version; + u16 fw_checksum; ++ unsigned int report_features; ++ unsigned int report_len; + int pressure_adjustment; + u8 mode; + u16 ic_type; +@@ -359,6 +363,12 @@ static int elan_query_device_info(struct + if (error) + return error; + ++ error = data->ops->get_report_features(data->client, data->pattern, ++ &data->report_features, ++ &data->report_len); ++ if (error) ++ return error; ++ + error = elan_get_fwinfo(data->ic_type, data->iap_version, + &data->fw_validpage_count, + &data->fw_signature_address, +@@ -371,16 +381,21 @@ static int elan_query_device_info(struct + return 0; + } + +-static unsigned int elan_convert_resolution(u8 val) ++static unsigned int elan_convert_resolution(u8 val, u8 pattern) + { + /* +- * (value from firmware) * 10 + 790 = dpi +- * ++ * pattern <= 0x01: ++ * (value from firmware) * 10 + 790 = dpi ++ * else ++ * ((value from firmware) + 3) * 100 = dpi ++ */ ++ int res = pattern <= 0x01 ? ++ (int)(char)val * 10 + 790 : ((int)(char)val + 3) * 100; ++ /* + * We also have to convert dpi to dots/mm (*10/254 to avoid floating + * point). + */ +- +- return ((int)(char)val * 10 + 790) * 10 / 254; ++ return res * 10 / 254; + } + + static int elan_query_device_parameters(struct elan_tp_data *data) +@@ -429,8 +444,8 @@ static int elan_query_device_parameters( + if (error) + return error; + +- data->x_res = elan_convert_resolution(hw_x_res); +- data->y_res = elan_convert_resolution(hw_y_res); ++ data->x_res = elan_convert_resolution(hw_x_res, data->pattern); ++ data->y_res = elan_convert_resolution(hw_y_res, data->pattern); + } else { + data->x_res = (data->max_x + 1) / x_mm; + data->y_res = (data->max_y + 1) / y_mm; +@@ -908,24 +923,22 @@ static const struct attribute_group *ela + * Elan isr functions + ****************************************************************** + */ +-static void elan_report_contact(struct elan_tp_data *data, +- int contact_num, bool contact_valid, +- u8 *finger_data) ++static void elan_report_contact(struct elan_tp_data *data, int contact_num, ++ bool contact_valid, bool high_precision, ++ u8 *packet, u8 *finger_data) + { + struct input_dev *input = data->input; + unsigned int pos_x, pos_y; +- unsigned int pressure, mk_x, mk_y; +- unsigned int area_x, area_y, major, minor; +- unsigned int scaled_pressure; ++ unsigned int pressure, scaled_pressure; + + if (contact_valid) { +- pos_x = ((finger_data[0] & 0xf0) << 4) | +- finger_data[1]; +- pos_y = ((finger_data[0] & 0x0f) << 8) | +- finger_data[2]; +- mk_x = (finger_data[3] & 0x0f); +- mk_y = (finger_data[3] >> 4); +- pressure = finger_data[4]; ++ if (high_precision) { ++ pos_x = get_unaligned_be16(&finger_data[0]); ++ pos_y = get_unaligned_be16(&finger_data[2]); ++ } else { ++ pos_x = ((finger_data[0] & 0xf0) << 4) | finger_data[1]; ++ pos_y = ((finger_data[0] & 0x0f) << 8) | finger_data[2]; ++ } + + if (pos_x > data->max_x || pos_y > data->max_y) { + dev_dbg(input->dev.parent, +@@ -935,18 +948,8 @@ static void elan_report_contact(struct e + return; + } + +- /* +- * To avoid treating large finger as palm, let's reduce the +- * width x and y per trace. +- */ +- area_x = mk_x * (data->width_x - ETP_FWIDTH_REDUCE); +- area_y = mk_y * (data->width_y - ETP_FWIDTH_REDUCE); +- +- major = max(area_x, area_y); +- minor = min(area_x, area_y); +- ++ pressure = finger_data[4]; + scaled_pressure = pressure + data->pressure_adjustment; +- + if (scaled_pressure > ETP_MAX_PRESSURE) + scaled_pressure = ETP_MAX_PRESSURE; + +@@ -955,16 +958,37 @@ static void elan_report_contact(struct e + input_report_abs(input, ABS_MT_POSITION_X, pos_x); + input_report_abs(input, ABS_MT_POSITION_Y, data->max_y - pos_y); + input_report_abs(input, ABS_MT_PRESSURE, scaled_pressure); +- input_report_abs(input, ABS_TOOL_WIDTH, mk_x); +- input_report_abs(input, ABS_MT_TOUCH_MAJOR, major); +- input_report_abs(input, ABS_MT_TOUCH_MINOR, minor); ++ ++ if (data->report_features & ETP_FEATURE_REPORT_MK) { ++ unsigned int mk_x, mk_y, area_x, area_y; ++ u8 mk_data = high_precision ? ++ packet[ETP_MK_DATA_OFFSET + contact_num] : ++ finger_data[3]; ++ ++ mk_x = mk_data & 0x0f; ++ mk_y = mk_data >> 4; ++ ++ /* ++ * To avoid treating large finger as palm, let's reduce ++ * the width x and y per trace. ++ */ ++ area_x = mk_x * (data->width_x - ETP_FWIDTH_REDUCE); ++ area_y = mk_y * (data->width_y - ETP_FWIDTH_REDUCE); ++ ++ input_report_abs(input, ABS_TOOL_WIDTH, mk_x); ++ input_report_abs(input, ABS_MT_TOUCH_MAJOR, ++ max(area_x, area_y)); ++ input_report_abs(input, ABS_MT_TOUCH_MINOR, ++ min(area_x, area_y)); ++ } + } else { + input_mt_slot(input, contact_num); + input_mt_report_slot_inactive(input); + } + } + +-static void elan_report_absolute(struct elan_tp_data *data, u8 *packet) ++static void elan_report_absolute(struct elan_tp_data *data, u8 *packet, ++ bool high_precision) + { + struct input_dev *input = data->input; + u8 *finger_data = &packet[ETP_FINGER_DATA_OFFSET]; +@@ -975,11 +999,12 @@ static void elan_report_absolute(struct + + pm_wakeup_event(&data->client->dev, 0); + +- hover_event = hover_info & 0x40; +- for (i = 0; i < ETP_MAX_FINGERS; i++) { +- contact_valid = tp_info & (1U << (3 + i)); +- elan_report_contact(data, i, contact_valid, finger_data); ++ hover_event = hover_info & BIT(6); + ++ for (i = 0; i < ETP_MAX_FINGERS; i++) { ++ contact_valid = tp_info & BIT(3 + i); ++ elan_report_contact(data, i, contact_valid, high_precision, ++ packet, finger_data); + if (contact_valid) + finger_data += ETP_FINGER_DATA_LEN; + } +@@ -1037,13 +1062,16 @@ static irqreturn_t elan_isr(int irq, voi + goto out; + } + +- error = data->ops->get_report(data->client, report); ++ error = data->ops->get_report(data->client, report, data->report_len); + if (error) + goto out; + + switch (report[ETP_REPORT_ID_OFFSET]) { + case ETP_REPORT_ID: +- elan_report_absolute(data, report); ++ elan_report_absolute(data, report, false); ++ break; ++ case ETP_REPORT_ID2: ++ elan_report_absolute(data, report, true); + break; + case ETP_TP_REPORT_ID: + elan_report_trackpoint(data, report); +@@ -1134,7 +1162,9 @@ static int elan_setup_input_device(struc + input_abs_set_res(input, ABS_X, data->x_res); + input_abs_set_res(input, ABS_Y, data->y_res); + input_set_abs_params(input, ABS_PRESSURE, 0, ETP_MAX_PRESSURE, 0, 0); +- input_set_abs_params(input, ABS_TOOL_WIDTH, 0, ETP_FINGER_WIDTH, 0, 0); ++ if (data->report_features & ETP_FEATURE_REPORT_MK) ++ input_set_abs_params(input, ABS_TOOL_WIDTH, ++ 0, ETP_FINGER_WIDTH, 0, 0); + input_set_abs_params(input, ABS_DISTANCE, 0, 1, 0, 0); + + /* And MT parameters */ +@@ -1144,10 +1174,12 @@ static int elan_setup_input_device(struc + input_abs_set_res(input, ABS_MT_POSITION_Y, data->y_res); + input_set_abs_params(input, ABS_MT_PRESSURE, 0, + ETP_MAX_PRESSURE, 0, 0); +- input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, +- ETP_FINGER_WIDTH * max_width, 0, 0); +- input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0, +- ETP_FINGER_WIDTH * min_width, 0, 0); ++ if (data->report_features & ETP_FEATURE_REPORT_MK) { ++ input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, ++ 0, ETP_FINGER_WIDTH * max_width, 0, 0); ++ input_set_abs_params(input, ABS_MT_TOUCH_MINOR, ++ 0, ETP_FINGER_WIDTH * min_width, 0, 0); ++ } + + data->input = input; + +--- a/drivers/input/mouse/elan_i2c_i2c.c ++++ b/drivers/input/mouse/elan_i2c_i2c.c +@@ -60,6 +60,8 @@ + #define ETP_I2C_IAP_TYPE_CMD 0x0304 + + #define ETP_I2C_REPORT_LEN 34 ++#define ETP_I2C_REPORT_LEN_ID2 39 ++#define ETP_I2C_REPORT_MAX_LEN 39 + #define ETP_I2C_DESC_LENGTH 30 + #define ETP_I2C_REPORT_DESC_LENGTH 158 + #define ETP_I2C_INF_LENGTH 2 +@@ -394,7 +396,7 @@ static int elan_i2c_get_max(struct i2c_c + return error; + } + +- *max_x = le16_to_cpup((__le16 *)val) & 0x0fff; ++ *max_x = le16_to_cpup((__le16 *)val); + + error = elan_i2c_read_cmd(client, ETP_I2C_MAX_Y_AXIS_CMD, val); + if (error) { +@@ -402,7 +404,7 @@ static int elan_i2c_get_max(struct i2c_c + return error; + } + +- *max_y = le16_to_cpup((__le16 *)val) & 0x0fff; ++ *max_y = le16_to_cpup((__le16 *)val); + + return 0; + } +@@ -674,12 +676,12 @@ static int elan_i2c_finish_fw_update(str + struct completion *completion) + { + struct device *dev = &client->dev; +- int error; ++ int error = 0; + int len; +- u8 buffer[ETP_I2C_REPORT_LEN]; ++ u8 buffer[ETP_I2C_REPORT_MAX_LEN]; + +- len = i2c_master_recv(client, buffer, ETP_I2C_REPORT_LEN); +- if (len != ETP_I2C_REPORT_LEN) { ++ len = i2c_master_recv(client, buffer, ETP_I2C_REPORT_MAX_LEN); ++ if (len <= 0) { + error = len < 0 ? len : -EIO; + dev_warn(dev, "failed to read I2C data after FW WDT reset: %d (%d)\n", + error, len); +@@ -713,20 +715,31 @@ static int elan_i2c_finish_fw_update(str + return 0; + } + +-static int elan_i2c_get_report(struct i2c_client *client, u8 *report) ++static int elan_i2c_get_report_features(struct i2c_client *client, u8 pattern, ++ unsigned int *features, ++ unsigned int *report_len) ++{ ++ *features = ETP_FEATURE_REPORT_MK; ++ *report_len = pattern <= 0x01 ? ++ ETP_I2C_REPORT_LEN : ETP_I2C_REPORT_LEN_ID2; ++ return 0; ++} ++ ++static int elan_i2c_get_report(struct i2c_client *client, ++ u8 *report, unsigned int report_len) + { + int len; + +- len = i2c_master_recv(client, report, ETP_I2C_REPORT_LEN); ++ len = i2c_master_recv(client, report, report_len); + if (len < 0) { + dev_err(&client->dev, "failed to read report data: %d\n", len); + return len; + } + +- if (len != ETP_I2C_REPORT_LEN) { ++ if (len != report_len) { + dev_err(&client->dev, + "wrong report length (%d vs %d expected)\n", +- len, ETP_I2C_REPORT_LEN); ++ len, report_len); + return -EIO; + } + +@@ -763,5 +776,6 @@ const struct elan_transport_ops elan_i2c + + .get_pattern = elan_i2c_get_pattern, + ++ .get_report_features = elan_i2c_get_report_features, + .get_report = elan_i2c_get_report, + }; +--- a/drivers/input/mouse/elan_i2c_smbus.c ++++ b/drivers/input/mouse/elan_i2c_smbus.c +@@ -469,7 +469,21 @@ static int elan_smbus_write_fw_block(str + return 0; + } + +-static int elan_smbus_get_report(struct i2c_client *client, u8 *report) ++static int elan_smbus_get_report_features(struct i2c_client *client, u8 pattern, ++ unsigned int *features, ++ unsigned int *report_len) ++{ ++ /* ++ * SMBus controllers with pattern 2 lack area info, as newer ++ * high-precision packets use that space for coordinates. ++ */ ++ *features = pattern <= 0x01 ? ETP_FEATURE_REPORT_MK : 0; ++ *report_len = ETP_SMBUS_REPORT_LEN; ++ return 0; ++} ++ ++static int elan_smbus_get_report(struct i2c_client *client, ++ u8 *report, unsigned int report_len) + { + int len; + +@@ -534,6 +548,7 @@ const struct elan_transport_ops elan_smb + .write_fw_block = elan_smbus_write_fw_block, + .finish_fw_update = elan_smbus_finish_fw_update, + ++ .get_report_features = elan_smbus_get_report_features, + .get_report = elan_smbus_get_report, + .get_pattern = elan_smbus_get_pattern, + }; diff --git a/patches.suse/Input-elan_i2c-do-not-constantly-re-query-pattern-ID.patch b/patches.suse/Input-elan_i2c-do-not-constantly-re-query-pattern-ID.patch new file mode 100644 index 0000000..2b6b86c --- /dev/null +++ b/patches.suse/Input-elan_i2c-do-not-constantly-re-query-pattern-ID.patch @@ -0,0 +1,178 @@ +From 3d712af637e19a1c139c2b586c08b2a56bdff8c8 Mon Sep 17 00:00:00 2001 +From: Dmitry Torokhov +Date: Mon, 20 Jul 2020 14:56:54 -0700 +Subject: [PATCH] Input: elan_i2c - do not constantly re-query pattern ID +Git-commit: 3d712af637e19a1c139c2b586c08b2a56bdff8c8 +Patch-mainline: v5.9-rc1 +References: bsc#1180870 + +We do not need to constantly re-query pattern ID, we can instead query it +once and then pass to methods that need it. + +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/mouse/elan_i2c.h | 5 +++-- + drivers/input/mouse/elan_i2c_core.c | 19 +++++++++++-------- + drivers/input/mouse/elan_i2c_i2c.c | 27 ++++++--------------------- + drivers/input/mouse/elan_i2c_smbus.c | 7 +++---- + 4 files changed, 23 insertions(+), 35 deletions(-) + +diff --git a/drivers/input/mouse/elan_i2c.h b/drivers/input/mouse/elan_i2c.h +index de10a78f0fc9..6e6f13a4489c 100644 +--- a/drivers/input/mouse/elan_i2c.h ++++ b/drivers/input/mouse/elan_i2c.h +@@ -57,8 +57,9 @@ struct elan_transport_ops { + int (*get_baseline_data)(struct i2c_client *client, + bool max_baseliune, u8 *value); + +- int (*get_version)(struct i2c_client *client, bool iap, u8 *version); +- int (*get_sm_version)(struct i2c_client *client, ++ int (*get_version)(struct i2c_client *client, u8 pattern, bool iap, ++ u8 *version); ++ int (*get_sm_version)(struct i2c_client *client, u8 pattern, + u16 *ic_type, u8 *version, u8 *clickpad); + int (*get_checksum)(struct i2c_client *client, bool iap, u16 *csum); + int (*get_product_id)(struct i2c_client *client, u16 *id); +diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c +index 5c933e16abc1..3230aaf63dab 100644 +--- a/drivers/input/mouse/elan_i2c_core.c ++++ b/drivers/input/mouse/elan_i2c_core.c +@@ -236,8 +236,13 @@ static int elan_query_product(struct elan_tp_data *data) + if (error) + return error; + +- error = data->ops->get_sm_version(data->client, &data->ic_type, +- &data->sm_version, &data->clickpad); ++ error = data->ops->get_pattern(data->client, &data->pattern); ++ if (error) ++ return error; ++ ++ error = data->ops->get_sm_version(data->client, data->pattern, ++ &data->ic_type, &data->sm_version, ++ &data->clickpad); + if (error) + return error; + +@@ -334,7 +339,8 @@ static int elan_query_device_info(struct elan_tp_data *data) + { + int error; + +- error = data->ops->get_version(data->client, false, &data->fw_version); ++ error = data->ops->get_version(data->client, data->pattern, false, ++ &data->fw_version); + if (error) + return error; + +@@ -343,7 +349,8 @@ static int elan_query_device_info(struct elan_tp_data *data) + if (error) + return error; + +- error = data->ops->get_version(data->client, true, &data->iap_version); ++ error = data->ops->get_version(data->client, data->pattern, ++ true, &data->iap_version); + if (error) + return error; + +@@ -352,10 +359,6 @@ static int elan_query_device_info(struct elan_tp_data *data) + if (error) + return error; + +- error = data->ops->get_pattern(data->client, &data->pattern); +- if (error) +- return error; +- + error = elan_get_fwinfo(data->ic_type, data->iap_version, + &data->fw_validpage_count, + &data->fw_signature_address, +diff --git a/drivers/input/mouse/elan_i2c_i2c.c b/drivers/input/mouse/elan_i2c_i2c.c +index 4dfac2ea5084..b84e3bbe62b5 100644 +--- a/drivers/input/mouse/elan_i2c_i2c.c ++++ b/drivers/input/mouse/elan_i2c_i2c.c +@@ -266,22 +266,15 @@ static int elan_i2c_get_pattern(struct i2c_client *client, u8 *pattern) + } + + static int elan_i2c_get_version(struct i2c_client *client, +- bool iap, u8 *version) ++ u8 pattern, bool iap, u8 *version) + { + int error; +- u8 pattern_ver; + u16 cmd; + u8 val[3]; + +- error = elan_i2c_get_pattern(client, &pattern_ver); +- if (error) { +- dev_err(&client->dev, "failed to get pattern version\n"); +- return error; +- } +- + if (!iap) + cmd = ETP_I2C_FW_VERSION_CMD; +- else if (pattern_ver == 0) ++ else if (pattern == 0) + cmd = ETP_I2C_IAP_VERSION_P0_CMD; + else + cmd = ETP_I2C_IAP_VERSION_CMD; +@@ -293,28 +286,20 @@ static int elan_i2c_get_version(struct i2c_client *client, + return error; + } + +- if (pattern_ver >= 0x01) ++ if (pattern >= 0x01) + *version = iap ? val[1] : val[0]; + else + *version = val[0]; + return 0; + } + +-static int elan_i2c_get_sm_version(struct i2c_client *client, +- u16 *ic_type, u8 *version, +- u8 *clickpad) ++static int elan_i2c_get_sm_version(struct i2c_client *client, u8 pattern, ++ u16 *ic_type, u8 *version, u8 *clickpad) + { + int error; +- u8 pattern_ver; + u8 val[3]; + +- error = elan_i2c_get_pattern(client, &pattern_ver); +- if (error) { +- dev_err(&client->dev, "failed to get pattern version\n"); +- return error; +- } +- +- if (pattern_ver >= 0x01) { ++ if (pattern >= 0x01) { + error = elan_i2c_read_cmd(client, ETP_I2C_IC_TYPE_CMD, val); + if (error) { + dev_err(&client->dev, "failed to get ic type: %d\n", +diff --git a/drivers/input/mouse/elan_i2c_smbus.c b/drivers/input/mouse/elan_i2c_smbus.c +index 97c2c46be5f6..f7af8b7b345f 100644 +--- a/drivers/input/mouse/elan_i2c_smbus.c ++++ b/drivers/input/mouse/elan_i2c_smbus.c +@@ -147,7 +147,7 @@ static int elan_smbus_get_baseline_data(struct i2c_client *client, + } + + static int elan_smbus_get_version(struct i2c_client *client, +- bool iap, u8 *version) ++ u8 pattern, bool iap, u8 *version) + { + int error; + u8 val[I2C_SMBUS_BLOCK_MAX] = {0}; +@@ -166,9 +166,8 @@ static int elan_smbus_get_version(struct i2c_client *client, + return 0; + } + +-static int elan_smbus_get_sm_version(struct i2c_client *client, +- u16 *ic_type, u8 *version, +- u8 *clickpad) ++static int elan_smbus_get_sm_version(struct i2c_client *client, u8 pattern, ++ u16 *ic_type, u8 *version, u8 *clickpad) + { + int error; + u8 val[I2C_SMBUS_BLOCK_MAX] = {0}; +-- +2.26.2 + diff --git a/patches.suse/Input-elan_i2c-fix-detecting-IAP-version-on-older-co.patch b/patches.suse/Input-elan_i2c-fix-detecting-IAP-version-on-older-co.patch new file mode 100644 index 0000000..33c9a1e --- /dev/null +++ b/patches.suse/Input-elan_i2c-fix-detecting-IAP-version-on-older-co.patch @@ -0,0 +1,62 @@ +From df10cc8db1e13cfcbd851e02881e2ef815d21b37 Mon Sep 17 00:00:00 2001 +From: Jingle Wu +Date: Wed, 15 Jul 2020 22:02:19 -0700 +Subject: [PATCH] Input: elan_i2c - fix detecting IAP version on older controllers +Git-commit: df10cc8db1e13cfcbd851e02881e2ef815d21b37 +Patch-mainline: v5.9-rc1 +References: bsc#1180870 + +Older controllers in bootloader mode need a different command to retrieve +the IAP version. + +Signed-off-by: Jingle Wu +Link: https://lore.kernel.org/r/20200714105641.15151-1-jingle.wu@emc.com.tw +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/mouse/elan_i2c_i2c.c | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/drivers/input/mouse/elan_i2c_i2c.c b/drivers/input/mouse/elan_i2c_i2c.c +index bb499f0d0925..317166a264e6 100644 +--- a/drivers/input/mouse/elan_i2c_i2c.c ++++ b/drivers/input/mouse/elan_i2c_i2c.c +@@ -44,6 +44,7 @@ + #define ETP_I2C_PRESSURE_CMD 0x010A + #define ETP_I2C_IAP_VERSION_CMD 0x0110 + #define ETP_I2C_IC_TYPE_P0_CMD 0x0110 ++#define ETP_I2C_IAP_VERSION_P0_CMD 0x0111 + #define ETP_I2C_SET_CMD 0x0300 + #define ETP_I2C_POWER_CMD 0x0307 + #define ETP_I2C_FW_CHECKSUM_CMD 0x030F +@@ -266,6 +267,7 @@ static int elan_i2c_get_version(struct i2c_client *client, + { + int error; + u8 pattern_ver; ++ u16 cmd; + u8 val[3]; + + error = elan_i2c_get_pattern(client, &pattern_ver); +@@ -274,10 +276,14 @@ static int elan_i2c_get_version(struct i2c_client *client, + return error; + } + +- error = elan_i2c_read_cmd(client, +- iap ? ETP_I2C_IAP_VERSION_CMD : +- ETP_I2C_FW_VERSION_CMD, +- val); ++ if (!iap) ++ cmd = ETP_I2C_FW_VERSION_CMD; ++ else if (pattern_ver == 0) ++ cmd = ETP_I2C_IAP_VERSION_P0_CMD; ++ else ++ cmd = ETP_I2C_IAP_VERSION_CMD; ++ ++ error = elan_i2c_read_cmd(client, cmd, val); + if (error) { + dev_err(&client->dev, "failed to get %s version: %d\n", + iap ? "IAP" : "FW", error); +-- +2.26.2 + diff --git a/patches.suse/Input-elan_i2c-fix-firmware-update-on-newer-ICs.patch b/patches.suse/Input-elan_i2c-fix-firmware-update-on-newer-ICs.patch new file mode 100644 index 0000000..2ef1f7e --- /dev/null +++ b/patches.suse/Input-elan_i2c-fix-firmware-update-on-newer-ICs.patch @@ -0,0 +1,114 @@ +From ae3d6083acf60116d4f409677452399547ed2009 Mon Sep 17 00:00:00 2001 +From: "jingle.wu" +Date: Wed, 11 Nov 2020 20:06:24 -0800 +Subject: [PATCH] Input: elan_i2c - fix firmware update on newer ICs +Git-commit: ae3d6083acf60116d4f409677452399547ed2009 +Patch-mainline: v5.10-rc5 +References: bsc#1180870 + +The argument to iap page type command depends on the firmware page size. + +Fixes: bfd9b92bc8f9 ("Input: elan_i2c - handle firmware updated on newer ICs") +Signed-off-by: Jingle Wu +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/mouse/elan_i2c.h | 2 +- + drivers/input/mouse/elan_i2c_core.c | 3 ++- + drivers/input/mouse/elan_i2c_i2c.c | 10 +++++----- + drivers/input/mouse/elan_i2c_smbus.c | 2 +- + 4 files changed, 9 insertions(+), 8 deletions(-) + +diff --git a/drivers/input/mouse/elan_i2c.h b/drivers/input/mouse/elan_i2c.h +index c75b00c45d75..36e3cd908671 100644 +--- a/drivers/input/mouse/elan_i2c.h ++++ b/drivers/input/mouse/elan_i2c.h +@@ -78,7 +78,7 @@ struct elan_transport_ops { + int (*iap_reset)(struct i2c_client *client); + + int (*prepare_fw_update)(struct i2c_client *client, u16 ic_type, +- u8 iap_version); ++ u8 iap_version, u16 fw_page_size); + int (*write_fw_block)(struct i2c_client *client, u16 fw_page_size, + const u8 *page, u16 checksum, int idx); + int (*finish_fw_update)(struct i2c_client *client, +diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c +index c599e21a8478..61ed3f5ca219 100644 +--- a/drivers/input/mouse/elan_i2c_core.c ++++ b/drivers/input/mouse/elan_i2c_core.c +@@ -497,7 +497,8 @@ static int __elan_update_firmware(struct elan_tp_data *data, + u16 sw_checksum = 0, fw_checksum = 0; + + error = data->ops->prepare_fw_update(client, data->ic_type, +- data->iap_version); ++ data->iap_version, ++ data->fw_page_size); + if (error) + return error; + +diff --git a/drivers/input/mouse/elan_i2c_i2c.c b/drivers/input/mouse/elan_i2c_i2c.c +index 5a496d4ffa49..13dc097eb6c6 100644 +--- a/drivers/input/mouse/elan_i2c_i2c.c ++++ b/drivers/input/mouse/elan_i2c_i2c.c +@@ -517,7 +517,7 @@ static int elan_i2c_set_flash_key(struct i2c_client *client) + return 0; + } + +-static int elan_read_write_iap_type(struct i2c_client *client) ++static int elan_read_write_iap_type(struct i2c_client *client, u16 fw_page_size) + { + int error; + u16 constant; +@@ -526,7 +526,7 @@ static int elan_read_write_iap_type(struct i2c_client *client) + + do { + error = elan_i2c_write_cmd(client, ETP_I2C_IAP_TYPE_CMD, +- ETP_I2C_IAP_TYPE_REG); ++ fw_page_size / 2); + if (error) { + dev_err(&client->dev, + "cannot write iap type: %d\n", error); +@@ -543,7 +543,7 @@ static int elan_read_write_iap_type(struct i2c_client *client) + constant = le16_to_cpup((__le16 *)val); + dev_dbg(&client->dev, "iap type reg: 0x%04x\n", constant); + +- if (constant == ETP_I2C_IAP_TYPE_REG) ++ if (constant == fw_page_size / 2) + return 0; + + } while (--retry > 0); +@@ -553,7 +553,7 @@ static int elan_read_write_iap_type(struct i2c_client *client) + } + + static int elan_i2c_prepare_fw_update(struct i2c_client *client, u16 ic_type, +- u8 iap_version) ++ u8 iap_version, u16 fw_page_size) + { + struct device *dev = &client->dev; + int error; +@@ -594,7 +594,7 @@ static int elan_i2c_prepare_fw_update(struct i2c_client *client, u16 ic_type, + } + + if (ic_type >= 0x0D && iap_version >= 1) { +- error = elan_read_write_iap_type(client); ++ error = elan_read_write_iap_type(client, fw_page_size); + if (error) + return error; + } +diff --git a/drivers/input/mouse/elan_i2c_smbus.c b/drivers/input/mouse/elan_i2c_smbus.c +index 8ff823751f3b..1820f1cfc1dc 100644 +--- a/drivers/input/mouse/elan_i2c_smbus.c ++++ b/drivers/input/mouse/elan_i2c_smbus.c +@@ -340,7 +340,7 @@ static int elan_smbus_set_flash_key(struct i2c_client *client) + } + + static int elan_smbus_prepare_fw_update(struct i2c_client *client, u16 ic_type, +- u8 iap_version) ++ u8 iap_version, u16 fw_page_size) + { + struct device *dev = &client->dev; + int len; +-- +2.26.2 + diff --git a/patches.suse/Input-elan_i2c-handle-devices-with-patterns-above-1.patch b/patches.suse/Input-elan_i2c-handle-devices-with-patterns-above-1.patch new file mode 100644 index 0000000..7a317b5 --- /dev/null +++ b/patches.suse/Input-elan_i2c-handle-devices-with-patterns-above-1.patch @@ -0,0 +1,45 @@ +From 40d8aa97131d16fe880cd48f8faabcd6a45019c4 Mon Sep 17 00:00:00 2001 +From: Jingle Wu +Date: Wed, 15 Jul 2020 22:12:08 -0700 +Subject: [PATCH] Input: elan_i2c - handle devices with patterns above 1 +Git-commit: 40d8aa97131d16fe880cd48f8faabcd6a45019c4 +Patch-mainline: v5.9-rc1 +References: bsc#1180870 + +Extend fetching and parsing parameters of the controllers to devices with +"patterns" above 1 (which currently should be handled in the same fashion +as devices with pattern 1). + +Signed-off-by: Jingle Wu +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/mouse/elan_i2c_i2c.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/input/mouse/elan_i2c_i2c.c b/drivers/input/mouse/elan_i2c_i2c.c +index bceb4bc32697..bb499f0d0925 100644 +--- a/drivers/input/mouse/elan_i2c_i2c.c ++++ b/drivers/input/mouse/elan_i2c_i2c.c +@@ -284,7 +284,7 @@ static int elan_i2c_get_version(struct i2c_client *client, + return error; + } + +- if (pattern_ver == 0x01) ++ if (pattern_ver >= 0x01) + *version = iap ? val[1] : val[0]; + else + *version = val[0]; +@@ -305,7 +305,7 @@ static int elan_i2c_get_sm_version(struct i2c_client *client, + return error; + } + +- if (pattern_ver == 0x01) { ++ if (pattern_ver >= 0x01) { + error = elan_i2c_read_cmd(client, ETP_I2C_IC_TYPE_CMD, val); + if (error) { + dev_err(&client->dev, "failed to get ic type: %d\n", +-- +2.26.2 + diff --git a/patches.suse/Input-elan_i2c-handle-firmware-not-implementing-get-.patch b/patches.suse/Input-elan_i2c-handle-firmware-not-implementing-get-.patch new file mode 100644 index 0000000..20c8959 --- /dev/null +++ b/patches.suse/Input-elan_i2c-handle-firmware-not-implementing-get-.patch @@ -0,0 +1,41 @@ +From 77da21c5d3c698f5c9ce41d57c137244bc8b7b93 Mon Sep 17 00:00:00 2001 +From: Jingle Wu +Date: Wed, 15 Jul 2020 17:40:27 -0700 +Subject: [PATCH] Input: elan_i2c - handle firmware not implementing "get pattern" command +Git-commit: 77da21c5d3c698f5c9ce41d57c137244bc8b7b93 +Patch-mainline: v5.9-rc1 +References: bsc#1180870 + +Not all versions of firmware implement "get pattern" command. When +encountering those assume that the controllers use older pattern. + +Signed-off-by: Jingle Wu +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/mouse/elan_i2c_i2c.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/drivers/input/mouse/elan_i2c_i2c.c b/drivers/input/mouse/elan_i2c_i2c.c +index 058b35b1f9a9..0d8a6a1b30d7 100644 +--- a/drivers/input/mouse/elan_i2c_i2c.c ++++ b/drivers/input/mouse/elan_i2c_i2c.c +@@ -249,7 +249,13 @@ static int elan_i2c_get_pattern(struct i2c_client *client, u8 *pattern) + dev_err(&client->dev, "failed to get pattern: %d\n", error); + return error; + } +- *pattern = val[1]; ++ ++ /* ++ * Not all versions of firmware implement "get pattern" command. ++ * When this command is not implemented the device will respond ++ * with 0xFF 0xFF, which we will treat as "old" pattern 0. ++ */ ++ *pattern = val[0] == 0xFF && val[1] == 0xFF ? 0 : val[1]; + + return 0; + } +-- +2.26.2 + diff --git a/patches.suse/Input-elan_i2c-handle-firmware-updated-on-newer-ICs.patch b/patches.suse/Input-elan_i2c-handle-firmware-updated-on-newer-ICs.patch new file mode 100644 index 0000000..7f58d72 --- /dev/null +++ b/patches.suse/Input-elan_i2c-handle-firmware-updated-on-newer-ICs.patch @@ -0,0 +1,172 @@ +From bfd9b92bc8f9a3777961d27a08f62872a21ac507 Mon Sep 17 00:00:00 2001 +From: Jingle Wu +Date: Thu, 16 Jul 2020 22:49:09 -0700 +Subject: [PATCH] Input: elan_i2c - handle firmware updated on newer ICs +Git-commit: bfd9b92bc8f9a3777961d27a08f62872a21ac507 +Patch-mainline: v5.9-rc1 +References: bsc#1180870 + +Newer ICs with IC type value starting with 0x0D and newer bootloader code +use 128-byte firmware pages. Their bootloader also needs to be switched to +proper mode before executing firmware update. + +Signed-off-by: Jingle Wu +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/mouse/elan_i2c.h | 3 +- + drivers/input/mouse/elan_i2c_core.c | 15 ++++++--- + drivers/input/mouse/elan_i2c_i2c.c | 46 +++++++++++++++++++++++++++- + drivers/input/mouse/elan_i2c_smbus.c | 3 +- + 4 files changed, 60 insertions(+), 7 deletions(-) + +diff --git a/drivers/input/mouse/elan_i2c.h b/drivers/input/mouse/elan_i2c.h +index b504f560a666..de10a78f0fc9 100644 +--- a/drivers/input/mouse/elan_i2c.h ++++ b/drivers/input/mouse/elan_i2c.h +@@ -74,7 +74,8 @@ struct elan_transport_ops { + int (*iap_get_mode)(struct i2c_client *client, enum tp_mode *mode); + int (*iap_reset)(struct i2c_client *client); + +- int (*prepare_fw_update)(struct i2c_client *client); ++ int (*prepare_fw_update)(struct i2c_client *client, u16 ic_type, ++ u8 iap_version); + int (*write_fw_block)(struct i2c_client *client, u16 fw_page_size, + const u8 *page, u16 checksum, int idx); + int (*finish_fw_update)(struct i2c_client *client, +diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c +index 46f334bcfc0e..e0f42def99aa 100644 +--- a/drivers/input/mouse/elan_i2c_core.c ++++ b/drivers/input/mouse/elan_i2c_core.c +@@ -101,7 +101,7 @@ struct elan_tp_data { + bool middle_button; + }; + +-static int elan_get_fwinfo(u16 ic_type, u16 *validpage_count, ++static int elan_get_fwinfo(u16 ic_type, u8 iap_version, u16 *validpage_count, + u32 *signature_address, u16 *page_size) + { + switch (ic_type) { +@@ -138,7 +138,12 @@ static int elan_get_fwinfo(u16 ic_type, u16 *validpage_count, + *signature_address = + (*validpage_count * ETP_FW_PAGE_SIZE) - ETP_FW_SIGNATURE_SIZE; + +- *page_size = ETP_FW_PAGE_SIZE; ++ if (ic_type >= 0x0D && iap_version >= 1) { ++ *validpage_count /= 2; ++ *page_size = ETP_FW_PAGE_SIZE_128; ++ } else { ++ *page_size = ETP_FW_PAGE_SIZE; ++ } + + return 0; + } +@@ -339,7 +344,8 @@ static int elan_query_device_info(struct elan_tp_data *data) + if (error) + return error; + +- error = elan_get_fwinfo(data->ic_type, &data->fw_validpage_count, ++ error = elan_get_fwinfo(data->ic_type, data->iap_version, ++ &data->fw_validpage_count, + &data->fw_signature_address, + &data->fw_page_size); + if (error) +@@ -459,7 +465,8 @@ static int __elan_update_firmware(struct elan_tp_data *data, + u16 boot_page_count; + u16 sw_checksum = 0, fw_checksum = 0; + +- error = data->ops->prepare_fw_update(client); ++ error = data->ops->prepare_fw_update(client, data->ic_type, ++ data->iap_version); + if (error) + return error; + +diff --git a/drivers/input/mouse/elan_i2c_i2c.c b/drivers/input/mouse/elan_i2c_i2c.c +index 4dfc3c2b4706..4dfac2ea5084 100644 +--- a/drivers/input/mouse/elan_i2c_i2c.c ++++ b/drivers/input/mouse/elan_i2c_i2c.c +@@ -56,6 +56,8 @@ + #define ETP_I2C_CALIBRATE_CMD 0x0316 + #define ETP_I2C_MAX_BASELINE_CMD 0x0317 + #define ETP_I2C_MIN_BASELINE_CMD 0x0318 ++#define ETP_I2C_IAP_TYPE_REG 0x0040 ++#define ETP_I2C_IAP_TYPE_CMD 0x0304 + + #define ETP_I2C_REPORT_LEN 34 + #define ETP_I2C_DESC_LENGTH 30 +@@ -528,7 +530,43 @@ static int elan_i2c_set_flash_key(struct i2c_client *client) + return 0; + } + +-static int elan_i2c_prepare_fw_update(struct i2c_client *client) ++static int elan_read_write_iap_type(struct i2c_client *client) ++{ ++ int error; ++ u16 constant; ++ u8 val[3]; ++ int retry = 3; ++ ++ do { ++ error = elan_i2c_write_cmd(client, ETP_I2C_IAP_TYPE_CMD, ++ ETP_I2C_IAP_TYPE_REG); ++ if (error) { ++ dev_err(&client->dev, ++ "cannot write iap type: %d\n", error); ++ return error; ++ } ++ ++ error = elan_i2c_read_cmd(client, ETP_I2C_IAP_TYPE_CMD, val); ++ if (error) { ++ dev_err(&client->dev, ++ "failed to read iap type register: %d\n", ++ error); ++ return error; ++ } ++ constant = le16_to_cpup((__le16 *)val); ++ dev_dbg(&client->dev, "iap type reg: 0x%04x\n", constant); ++ ++ if (constant == ETP_I2C_IAP_TYPE_REG) ++ return 0; ++ ++ } while (--retry > 0); ++ ++ dev_err(&client->dev, "cannot set iap type\n"); ++ return -EIO; ++} ++ ++static int elan_i2c_prepare_fw_update(struct i2c_client *client, u16 ic_type, ++ u8 iap_version) + { + struct device *dev = &client->dev; + int error; +@@ -568,6 +606,12 @@ static int elan_i2c_prepare_fw_update(struct i2c_client *client) + return -EIO; + } + ++ if (ic_type >= 0x0D && iap_version >= 1) { ++ error = elan_read_write_iap_type(client); ++ if (error) ++ return error; ++ } ++ + /* Set flash key again */ + error = elan_i2c_set_flash_key(client); + if (error) +diff --git a/drivers/input/mouse/elan_i2c_smbus.c b/drivers/input/mouse/elan_i2c_smbus.c +index 59eec1a2ed5c..97c2c46be5f6 100644 +--- a/drivers/input/mouse/elan_i2c_smbus.c ++++ b/drivers/input/mouse/elan_i2c_smbus.c +@@ -340,7 +340,8 @@ static int elan_smbus_set_flash_key(struct i2c_client *client) + return 0; + } + +-static int elan_smbus_prepare_fw_update(struct i2c_client *client) ++static int elan_smbus_prepare_fw_update(struct i2c_client *client, u16 ic_type, ++ u8 iap_version) + { + struct device *dev = &client->dev; + int len; +-- +2.26.2 + diff --git a/patches.suse/Input-elan_i2c-make-fetching-IC-type-of-older-contro.patch b/patches.suse/Input-elan_i2c-make-fetching-IC-type-of-older-contro.patch new file mode 100644 index 0000000..a01fd4e --- /dev/null +++ b/patches.suse/Input-elan_i2c-make-fetching-IC-type-of-older-contro.patch @@ -0,0 +1,81 @@ +From fc7c882aa9b1643273c4bb77d31163355dcbc0b8 Mon Sep 17 00:00:00 2001 +From: Jingle Wu +Date: Wed, 15 Jul 2020 22:25:59 -0700 +Subject: [PATCH] Input: elan_i2c - make fetching IC type of older controllers more robust +Git-commit: fc7c882aa9b1643273c4bb77d31163355dcbc0b8 +Patch-mainline: v5.9-rc1 +References: bsc#1180870 + +On older controllers IC type is reported in the 2nd byte of +ETP_I2C_OSM_VERSION_CMD, however if controller's firmware is not flashed +correctly it may return incorrect data. Fortunately there is also +ETP_I2C_IAP_VERSION_P0_CMD command that can be used when controller in +either normal or IAP mode, and which is guaranteed to return accurate data, +so let's use it. + +Signed-off-by: Jingle Wu +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/mouse/elan_i2c_core.c | 8 +------- + drivers/input/mouse/elan_i2c_i2c.c | 10 +++++++++- + 2 files changed, 10 insertions(+), 8 deletions(-) + +diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c +index 8719da540383..f1dade60f407 100644 +--- a/drivers/input/mouse/elan_i2c_core.c ++++ b/drivers/input/mouse/elan_i2c_core.c +@@ -312,7 +312,6 @@ static int elan_initialize(struct elan_tp_data *data) + static int elan_query_device_info(struct elan_tp_data *data) + { + int error; +- u16 ic_type; + + error = data->ops->get_version(data->client, false, &data->fw_version); + if (error) +@@ -336,12 +335,7 @@ static int elan_query_device_info(struct elan_tp_data *data) + if (error) + return error; + +- if (data->pattern == 0x01) +- ic_type = data->ic_type; +- else +- ic_type = data->iap_version; +- +- error = elan_get_fwinfo(ic_type, &data->fw_validpage_count, ++ error = elan_get_fwinfo(data->ic_type, &data->fw_validpage_count, + &data->fw_signature_address); + if (error) + dev_warn(&data->client->dev, +diff --git a/drivers/input/mouse/elan_i2c_i2c.c b/drivers/input/mouse/elan_i2c_i2c.c +index 0d8a6a1b30d7..bceb4bc32697 100644 +--- a/drivers/input/mouse/elan_i2c_i2c.c ++++ b/drivers/input/mouse/elan_i2c_i2c.c +@@ -43,6 +43,7 @@ + #define ETP_I2C_RESOLUTION_CMD 0x0108 + #define ETP_I2C_PRESSURE_CMD 0x010A + #define ETP_I2C_IAP_VERSION_CMD 0x0110 ++#define ETP_I2C_IC_TYPE_P0_CMD 0x0110 + #define ETP_I2C_SET_CMD 0x0300 + #define ETP_I2C_POWER_CMD 0x0307 + #define ETP_I2C_FW_CHECKSUM_CMD 0x030F +@@ -330,7 +331,14 @@ static int elan_i2c_get_sm_version(struct i2c_client *client, + return error; + } + *version = val[0]; +- *ic_type = val[1]; ++ ++ error = elan_i2c_read_cmd(client, ETP_I2C_IC_TYPE_P0_CMD, val); ++ if (error) { ++ dev_err(&client->dev, "failed to get ic type: %d\n", ++ error); ++ return error; ++ } ++ *ic_type = val[0]; + + error = elan_i2c_read_cmd(client, ETP_I2C_NSM_VERSION_CMD, + val); +-- +2.26.2 + diff --git a/patches.suse/Input-elan_i2c-switch-to-using-devm_add_action_or_re.patch b/patches.suse/Input-elan_i2c-switch-to-using-devm_add_action_or_re.patch new file mode 100644 index 0000000..d0dc8ed --- /dev/null +++ b/patches.suse/Input-elan_i2c-switch-to-using-devm_add_action_or_re.patch @@ -0,0 +1,36 @@ +From 2e75cfaa32c113568994eda716a0bdddc92b376e Mon Sep 17 00:00:00 2001 +From: Dmitry Torokhov +Date: Sat, 13 Jul 2019 01:18:14 -0700 +Subject: [PATCH] Input: elan_i2c - switch to using devm_add_action_or_reset() +Git-commit: 2e75cfaa32c113568994eda716a0bdddc92b376e +Patch-mainline: v5.4-rc1 +References: bsc#1180870 + +Instead of manually disabling regulators when devm_add_action() fails we can +use devm_add_action_or_reset() which does it for us. + +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/mouse/elan_i2c_core.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c +index b549d032da93..8719da540383 100644 +--- a/drivers/input/mouse/elan_i2c_core.c ++++ b/drivers/input/mouse/elan_i2c_core.c +@@ -1187,9 +1187,8 @@ static int elan_probe(struct i2c_client *client, + return error; + } + +- error = devm_add_action(dev, elan_disable_regulator, data); ++ error = devm_add_action_or_reset(dev, elan_disable_regulator, data); + if (error) { +- regulator_disable(data->vcc); + dev_err(dev, "Failed to add disable regulator action: %d\n", + error); + return error; +-- +2.26.2 + diff --git a/patches.suse/Input-elan_i2c-switch-to-using-devm_device_add_group.patch b/patches.suse/Input-elan_i2c-switch-to-using-devm_device_add_group.patch new file mode 100644 index 0000000..bedf6a1 --- /dev/null +++ b/patches.suse/Input-elan_i2c-switch-to-using-devm_device_add_group.patch @@ -0,0 +1,61 @@ +From 9609b904c7eb411020d367d1f0904d0691819592 Mon Sep 17 00:00:00 2001 +From: Dmitry Torokhov +Date: Sat, 13 Jul 2019 01:13:16 -0700 +Subject: [PATCH] Input: elan_i2c - switch to using devm_device_add_groups() +Git-commit: 9609b904c7eb411020d367d1f0904d0691819592 +Patch-mainline: v5.4-rc1 +References: bsc#1180870 + +Instead of installing custom devm cleanup action to remove attribute +groups on failure, let's use the dedicated devm API. + +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/mouse/elan_i2c_core.c | 17 +---------------- + 1 file changed, 1 insertion(+), 16 deletions(-) + +diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c +index d9b103a81a79..b549d032da93 100644 +--- a/drivers/input/mouse/elan_i2c_core.c ++++ b/drivers/input/mouse/elan_i2c_core.c +@@ -1138,13 +1138,6 @@ static void elan_disable_regulator(void *_data) + regulator_disable(data->vcc); + } + +-static void elan_remove_sysfs_groups(void *_data) +-{ +- struct elan_tp_data *data = _data; +- +- sysfs_remove_groups(&data->client->dev.kobj, elan_sysfs_groups); +-} +- + static int elan_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) + { +@@ -1269,20 +1262,12 @@ static int elan_probe(struct i2c_client *client, + return error; + } + +- error = sysfs_create_groups(&dev->kobj, elan_sysfs_groups); ++ error = devm_device_add_groups(dev, elan_sysfs_groups); + if (error) { + dev_err(dev, "failed to create sysfs attributes: %d\n", error); + return error; + } + +- error = devm_add_action(dev, elan_remove_sysfs_groups, data); +- if (error) { +- elan_remove_sysfs_groups(data); +- dev_err(dev, "Failed to add sysfs cleanup action: %d\n", +- error); +- return error; +- } +- + error = input_register_device(data->input); + if (error) { + dev_err(dev, "failed to register input device: %d\n", error); +-- +2.26.2 + diff --git a/patches.suse/Input-elan_i2c_core-move-header-inclusion-inside.patch b/patches.suse/Input-elan_i2c_core-move-header-inclusion-inside.patch new file mode 100644 index 0000000..7997e92 --- /dev/null +++ b/patches.suse/Input-elan_i2c_core-move-header-inclusion-inside.patch @@ -0,0 +1,49 @@ +From c7f0169e3bd274e576f6aaeee86ad2adf7bb14b5 Mon Sep 17 00:00:00 2001 +From: Lee Jones +Date: Tue, 17 Nov 2020 13:46:18 -0800 +Subject: [PATCH] Input: elan_i2c_core - move header inclusion inside +Mime-version: 1.0 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: 8bit +Git-commit: c7f0169e3bd274e576f6aaeee86ad2adf7bb14b5 +Patch-mainline: v5.11-rc1 +References: bsc#1180870 + +The same clause as its use. + +Fixes the following W=1 kernel build warning(s): + + include/linux/input/elan-i2c-ids.h:26:36: warning: ‘elan_acpi_id’ defined but not used [-Wunused-const-variable=] + +Signed-off-by: Lee Jones +Link: https://lore.kernel.org/r/20201112104420.GG1997862@dell +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/mouse/elan_i2c_core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c +index c599e21a8478..65d21a050cea 100644 +--- a/drivers/input/mouse/elan_i2c_core.c ++++ b/drivers/input/mouse/elan_i2c_core.c +@@ -34,7 +34,6 @@ + #include + #include + #include +-#include + #include + #include + +@@ -1413,6 +1412,7 @@ static const struct i2c_device_id elan_id[] = { + MODULE_DEVICE_TABLE(i2c, elan_id); + + #ifdef CONFIG_ACPI ++#include + MODULE_DEVICE_TABLE(acpi, elan_acpi_id); + #endif + +-- +2.26.2 + diff --git a/patches.suse/Input-elantech-demote-obvious-abuse-of-kernel-doc-he.patch b/patches.suse/Input-elantech-demote-obvious-abuse-of-kernel-doc-he.patch new file mode 100644 index 0000000..6f3717a --- /dev/null +++ b/patches.suse/Input-elantech-demote-obvious-abuse-of-kernel-doc-he.patch @@ -0,0 +1,39 @@ +From 93107bc736f4eb1d57a26c56eda9bb89b86d1ef0 Mon Sep 17 00:00:00 2001 +From: Lee Jones +Date: Sun, 8 Nov 2020 22:09:03 -0800 +Subject: [PATCH] Input: elantech - demote obvious abuse of kernel-doc header +Git-commit: 93107bc736f4eb1d57a26c56eda9bb89b86d1ef0 +Patch-mainline: v5.11-rc1 +References: bsc#1180870 + +Fixes the following W=1 kernel build warning(s): + + drivers/input/mouse/elantech.c:1837: warning: Function parameter or member 'psmouse' not described in 'elantech_setup_smbus' + drivers/input/mouse/elantech.c:1837: warning: Function parameter or member 'info' not described in 'elantech_setup_smbus' + drivers/input/mouse/elantech.c:1837: warning: Function parameter or member 'leave_breadcrumbs' not described in 'elantech_setup_smbus' + +Signed-off-by: Lee Jones +Link: https://lore.kernel.org/r/20201104162427.2984742-13-lee.jones@linaro.org +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/mouse/elantech.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c +index 90f8765f9efc..47cd0e7f79bd 100644 +--- a/drivers/input/mouse/elantech.c ++++ b/drivers/input/mouse/elantech.c +@@ -1827,7 +1827,7 @@ static int elantech_create_smbus(struct psmouse *psmouse, + leave_breadcrumbs); + } + +-/** ++/* + * elantech_setup_smbus - called once the PS/2 devices are enumerated + * and decides to instantiate a SMBus InterTouch device. + */ +-- +2.26.2 + diff --git a/patches.suse/Input-elantech-fix-protocol-errors-for-some-trackpoi.patch b/patches.suse/Input-elantech-fix-protocol-errors-for-some-trackpoi.patch new file mode 100644 index 0000000..c8c2db5 --- /dev/null +++ b/patches.suse/Input-elantech-fix-protocol-errors-for-some-trackpoi.patch @@ -0,0 +1,206 @@ +From e4c9062717feda88900b566463228d1c4910af6d Mon Sep 17 00:00:00 2001 +From: "jingle.wu" +Date: Thu, 10 Dec 2020 23:49:16 -0800 +Subject: [PATCH] Input: elantech - fix protocol errors for some trackpoints in SMBus mode +Git-commit: e4c9062717feda88900b566463228d1c4910af6d +Patch-mainline: v5.11-rc1 +References: bsc#1180870 + +There are some version of Elan trackpads that send incorrect data when +in SMbus mode, unless they are switched to use 0x5f reports instead of +standard 0x5e. This patch implements querying device to retrieve chips +identifying data, and switching it, when needed to the alternative +report. + +Signed-off-by: Jingle Wu +Link: https://lore.kernel.org/r/20201211071531.32413-1-jingle.wu@emc.com.tw +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/mouse/elantech.c | 99 +++++++++++++++++++++++++++++++++- + drivers/input/mouse/elantech.h | 4 ++ + 2 files changed, 101 insertions(+), 2 deletions(-) + +diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c +index 47cd0e7f79bd..97381e2e03ba 100644 +--- a/drivers/input/mouse/elantech.c ++++ b/drivers/input/mouse/elantech.c +@@ -89,6 +89,47 @@ static int elantech_ps2_command(struct psmouse *psmouse, + return rc; + } + ++/* ++ * Send an Elantech style special command to read 3 bytes from a register ++ */ ++static int elantech_read_reg_params(struct psmouse *psmouse, u8 reg, u8 *param) ++{ ++ if (elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || ++ elantech_ps2_command(psmouse, NULL, ETP_REGISTER_READWRITE) || ++ elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || ++ elantech_ps2_command(psmouse, NULL, reg) || ++ elantech_ps2_command(psmouse, param, PSMOUSE_CMD_GETINFO)) { ++ psmouse_err(psmouse, ++ "failed to read register %#02x\n", reg); ++ return -EIO; ++ } ++ ++ return 0; ++} ++ ++/* ++ * Send an Elantech style special command to write a register with a parameter ++ */ ++static int elantech_write_reg_params(struct psmouse *psmouse, u8 reg, u8 *param) ++{ ++ if (elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || ++ elantech_ps2_command(psmouse, NULL, ETP_REGISTER_READWRITE) || ++ elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || ++ elantech_ps2_command(psmouse, NULL, reg) || ++ elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || ++ elantech_ps2_command(psmouse, NULL, param[0]) || ++ elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || ++ elantech_ps2_command(psmouse, NULL, param[1]) || ++ elantech_ps2_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11)) { ++ psmouse_err(psmouse, ++ "failed to write register %#02x with value %#02x%#02x\n", ++ reg, param[0], param[1]); ++ return -EIO; ++ } ++ ++ return 0; ++} ++ + /* + * Send an Elantech style special command to read a value from a register + */ +@@ -1529,19 +1570,35 @@ static const struct dmi_system_id no_hw_res_dmi_table[] = { + { } + }; + ++/* ++ * Change Report id 0x5E to 0x5F. ++ */ ++static int elantech_change_report_id(struct psmouse *psmouse) ++{ ++ unsigned char param[2] = { 0x10, 0x03 }; ++ ++ if (elantech_write_reg_params(psmouse, 0x7, param) || ++ elantech_read_reg_params(psmouse, 0x7, param) || ++ param[0] != 0x10 || param[1] != 0x03) { ++ psmouse_err(psmouse, "Unable to change report ID to 0x5f.\n"); ++ return -EIO; ++ } ++ ++ return 0; ++} + /* + * determine hardware version and set some properties according to it. + */ + static int elantech_set_properties(struct elantech_device_info *info) + { + /* This represents the version of IC body. */ +- int ver = (info->fw_version & 0x0f0000) >> 16; ++ info->ic_version = (info->fw_version & 0x0f0000) >> 16; + + /* Early version of Elan touchpads doesn't obey the rule. */ + if (info->fw_version < 0x020030 || info->fw_version == 0x020600) + info->hw_version = 1; + else { +- switch (ver) { ++ switch (info->ic_version) { + case 2: + case 4: + info->hw_version = 2; +@@ -1557,6 +1614,11 @@ static int elantech_set_properties(struct elantech_device_info *info) + } + } + ++ /* Get information pattern for hw_version 4 */ ++ info->pattern = 0x00; ++ if (info->ic_version == 0x0f && (info->fw_version & 0xff) <= 0x02) ++ info->pattern = info->fw_version & 0xff; ++ + /* decide which send_cmd we're gonna use early */ + info->send_cmd = info->hw_version >= 3 ? elantech_send_cmd : + synaptics_send_cmd; +@@ -1598,6 +1660,7 @@ static int elantech_query_info(struct psmouse *psmouse, + { + unsigned char param[3]; + unsigned char traces; ++ unsigned char ic_body[3]; + + memset(info, 0, sizeof(*info)); + +@@ -1640,6 +1703,21 @@ static int elantech_query_info(struct psmouse *psmouse, + info->samples[2]); + } + ++ if (info->pattern > 0x00 && info->ic_version == 0xf) { ++ if (info->send_cmd(psmouse, ETP_ICBODY_QUERY, ic_body)) { ++ psmouse_err(psmouse, "failed to query ic body\n"); ++ return -EINVAL; ++ } ++ info->ic_version = be16_to_cpup((__be16 *)ic_body); ++ psmouse_info(psmouse, ++ "Elan ic body: %#04x, current fw version: %#02x\n", ++ info->ic_version, ic_body[2]); ++ } ++ ++ info->product_id = be16_to_cpup((__be16 *)info->samples); ++ if (info->pattern == 0x00) ++ info->product_id &= 0xff; ++ + if (info->samples[1] == 0x74 && info->hw_version == 0x03) { + /* + * This module has a bug which makes absolute mode +@@ -1654,6 +1732,23 @@ static int elantech_query_info(struct psmouse *psmouse, + /* The MSB indicates the presence of the trackpoint */ + info->has_trackpoint = (info->capabilities[0] & 0x80) == 0x80; + ++ if (info->has_trackpoint && info->ic_version == 0x0011 && ++ (info->product_id == 0x08 || info->product_id == 0x09 || ++ info->product_id == 0x0d || info->product_id == 0x0e)) { ++ /* ++ * This module has a bug which makes trackpoint in SMBus ++ * mode return invalid data unless trackpoint is switched ++ * from using 0x5e reports to 0x5f. If we are not able to ++ * make the switch, let's abort initialization so we'll be ++ * using standard PS/2 protocol. ++ */ ++ if (elantech_change_report_id(psmouse)) { ++ psmouse_info(psmouse, ++ "Trackpoint report is broken, forcing standard PS/2 protocol\n"); ++ return -ENODEV; ++ } ++ } ++ + info->x_res = 31; + info->y_res = 31; + if (info->hw_version == 4) { +diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h +index e0a3e59d4f1b..571e6ca11d33 100644 +--- a/drivers/input/mouse/elantech.h ++++ b/drivers/input/mouse/elantech.h +@@ -18,6 +18,7 @@ + #define ETP_CAPABILITIES_QUERY 0x02 + #define ETP_SAMPLE_QUERY 0x03 + #define ETP_RESOLUTION_QUERY 0x04 ++#define ETP_ICBODY_QUERY 0x05 + + /* + * Command values for register reading or writing +@@ -140,7 +141,10 @@ struct elantech_device_info { + unsigned char samples[3]; + unsigned char debug; + unsigned char hw_version; ++ unsigned char pattern; + unsigned int fw_version; ++ unsigned int ic_version; ++ unsigned int product_id; + unsigned int x_min; + unsigned int y_min; + unsigned int x_max; +-- +2.26.2 + diff --git a/patches.suse/Input-elantech-remove-redundant-assignments-to-varia.patch b/patches.suse/Input-elantech-remove-redundant-assignments-to-varia.patch new file mode 100644 index 0000000..ed6ddd2 --- /dev/null +++ b/patches.suse/Input-elantech-remove-redundant-assignments-to-varia.patch @@ -0,0 +1,56 @@ +From 05b8465025466f30300941a16d4bbf53c755c3f1 Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Mon, 6 Jul 2020 17:38:16 -0700 +Subject: [PATCH] Input: elantech - remove redundant assignments to variable error +Git-commit: 05b8465025466f30300941a16d4bbf53c755c3f1 +Patch-mainline: v5.9-rc1 +References: bsc#1180870 + +The variable error is being initialized with a value that is +never read and it is being updated later with a new value. The +initialization is redundant and can be removed. + +Addresses-coverity: ("Unused value") +Signed-off-by: Colin Ian King +Link: https://lore.kernel.org/r/20200603140431.131347-1-colin.king@canonical.com +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/mouse/elantech.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c +index 2d8434b7b623..e4f394cc0520 100644 +--- a/drivers/input/mouse/elantech.c ++++ b/drivers/input/mouse/elantech.c +@@ -1897,7 +1897,7 @@ static bool elantech_use_host_notify(struct psmouse *psmouse, + int elantech_init_smbus(struct psmouse *psmouse) + { + struct elantech_device_info info; +- int error = -EINVAL; ++ int error; + + psmouse_reset(psmouse); + +@@ -2015,7 +2015,7 @@ static int elantech_setup_ps2(struct psmouse *psmouse, + int elantech_init_ps2(struct psmouse *psmouse) + { + struct elantech_device_info info; +- int error = -EINVAL; ++ int error; + + psmouse_reset(psmouse); + +@@ -2036,7 +2036,7 @@ int elantech_init_ps2(struct psmouse *psmouse) + int elantech_init(struct psmouse *psmouse) + { + struct elantech_device_info info; +- int error = -EINVAL; ++ int error; + + psmouse_reset(psmouse); + +-- +2.26.2 + diff --git a/patches.suse/Input-introduce-input_mt_report_slot_inactive.patch b/patches.suse/Input-introduce-input_mt_report_slot_inactive.patch new file mode 100644 index 0000000..60311bb --- /dev/null +++ b/patches.suse/Input-introduce-input_mt_report_slot_inactive.patch @@ -0,0 +1,245 @@ +From 5fc70e350edd30fb22d2f9b4e6d680c5471890ff Mon Sep 17 00:00:00 2001 +From: Jiada Wang +Date: Mon, 11 May 2020 13:12:13 -0700 +Subject: [PATCH] Input: introduce input_mt_report_slot_inactive() +Git-commit: 5fc70e350edd30fb22d2f9b4e6d680c5471890ff +Patch-mainline: v5.8-rc1 +References: bsc#1180870 + +input_mt_report_slot_state() ignores "tool" argument when the slot is +closed, which has caused a bit of confusion. Let's introduce +input_mt_report_slot_inactive() to report inactive slot state. + +Suggested-by: Dmitry Torokhov +Signed-off-by: Jiada Wang +Link: https://lore.kernel.org/r/20200508055656.96389-2-jiada_wang@mentor.com +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/hid/hid-alps.c | 3 +-- + drivers/hid/hid-multitouch.c | 6 ++---- + drivers/input/misc/xen-kbdfront.c | 2 +- + drivers/input/mouse/elan_i2c_core.c | 2 +- + drivers/input/touchscreen/atmel_mxt_ts.c | 7 +++---- + drivers/input/touchscreen/cyttsp4_core.c | 5 ++--- + drivers/input/touchscreen/cyttsp_core.c | 2 +- + drivers/input/touchscreen/melfas_mip4.c | 4 ++-- + drivers/input/touchscreen/mms114.c | 2 +- + drivers/input/touchscreen/raspberrypi-ts.c | 2 +- + drivers/input/touchscreen/stmfts.c | 2 +- + include/linux/input/mt.h | 5 +++++ + 12 files changed, 21 insertions(+), 21 deletions(-) + +diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c +index fa704153cb00..28588f74425e 100644 +--- a/drivers/hid/hid-alps.c ++++ b/drivers/hid/hid-alps.c +@@ -387,8 +387,7 @@ static int u1_raw_event(struct alps_dev *hdata, u8 *data, int size) + input_report_abs(hdata->input, + ABS_MT_PRESSURE, z); + } else { +- input_mt_report_slot_state(hdata->input, +- MT_TOOL_FINGER, 0); ++ input_mt_report_slot_inactive(hdata->input); + } + } + +diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c +index 362805ddf377..e2ce790ff4a4 100644 +--- a/drivers/hid/hid-multitouch.c ++++ b/drivers/hid/hid-multitouch.c +@@ -896,7 +896,7 @@ static void mt_release_pending_palms(struct mt_device *td, + clear_bit(slotnum, app->pending_palm_slots); + + input_mt_slot(input, slotnum); +- input_mt_report_slot_state(input, MT_TOOL_PALM, false); ++ input_mt_report_slot_inactive(input); + + need_sync = true; + } +@@ -1640,9 +1640,7 @@ static void mt_release_contacts(struct hid_device *hid) + if (mt) { + for (i = 0; i < mt->num_slots; i++) { + input_mt_slot(input_dev, i); +- input_mt_report_slot_state(input_dev, +- MT_TOOL_FINGER, +- false); ++ input_mt_report_slot_inactive(input_dev); + } + input_mt_sync_frame(input_dev); + input_sync(input_dev); +diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c +index 24bc5c5d876f..a1bba722b234 100644 +--- a/drivers/input/misc/xen-kbdfront.c ++++ b/drivers/input/misc/xen-kbdfront.c +@@ -146,7 +146,7 @@ static void xenkbd_handle_mt_event(struct xenkbd_info *info, + break; + + case XENKBD_MT_EV_UP: +- input_mt_report_slot_state(info->mtouch, MT_TOOL_FINGER, false); ++ input_mt_report_slot_inactive(info->mtouch); + break; + + case XENKBD_MT_EV_SYN: +diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c +index 8719da540383..3f9354baac4b 100644 +--- a/drivers/input/mouse/elan_i2c_core.c ++++ b/drivers/input/mouse/elan_i2c_core.c +@@ -938,7 +938,7 @@ static void elan_report_contact(struct elan_tp_data *data, + input_report_abs(input, ABS_MT_TOUCH_MINOR, minor); + } else { + input_mt_slot(input, contact_num); +- input_mt_report_slot_state(input, MT_TOOL_FINGER, false); ++ input_mt_report_slot_inactive(input); + } + } + +diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c +index ae60442efda0..a2189739e30f 100644 +--- a/drivers/input/touchscreen/atmel_mxt_ts.c ++++ b/drivers/input/touchscreen/atmel_mxt_ts.c +@@ -822,8 +822,7 @@ static void mxt_proc_t9_message(struct mxt_data *data, u8 *message) + * have happened. + */ + if (status & MXT_T9_RELEASE) { +- input_mt_report_slot_state(input_dev, +- MT_TOOL_FINGER, 0); ++ input_mt_report_slot_inactive(input_dev); + mxt_input_sync(data); + } + +@@ -839,7 +838,7 @@ static void mxt_proc_t9_message(struct mxt_data *data, u8 *message) + input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, area); + } else { + /* Touch no longer active, close out slot */ +- input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, 0); ++ input_mt_report_slot_inactive(input_dev); + } + + data->update_input = true; +@@ -947,7 +946,7 @@ static void mxt_proc_t100_message(struct mxt_data *data, u8 *message) + dev_dbg(dev, "[%u] release\n", id); + + /* close out slot */ +- input_mt_report_slot_state(input_dev, 0, 0); ++ input_mt_report_slot_inactive(input_dev); + } + + data->update_input = true; +diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c +index 6bcffc930384..02a73d9a4def 100644 +--- a/drivers/input/touchscreen/cyttsp4_core.c ++++ b/drivers/input/touchscreen/cyttsp4_core.c +@@ -744,8 +744,7 @@ static void cyttsp4_report_slot_liftoff(struct cyttsp4_mt_data *md, + + for (t = 0; t < max_slots; t++) { + input_mt_slot(md->input, t); +- input_mt_report_slot_state(md->input, +- MT_TOOL_FINGER, false); ++ input_mt_report_slot_inactive(md->input); + } + } + +@@ -845,7 +844,7 @@ static void cyttsp4_final_sync(struct input_dev *input, int max_slots, int *ids) + if (ids[t]) + continue; + input_mt_slot(input, t); +- input_mt_report_slot_state(input, MT_TOOL_FINGER, false); ++ input_mt_report_slot_inactive(input); + } + + input_sync(input); +diff --git a/drivers/input/touchscreen/cyttsp_core.c b/drivers/input/touchscreen/cyttsp_core.c +index 3f5d463dbeed..697aa2c158f7 100644 +--- a/drivers/input/touchscreen/cyttsp_core.c ++++ b/drivers/input/touchscreen/cyttsp_core.c +@@ -340,7 +340,7 @@ static void cyttsp_report_tchdata(struct cyttsp *ts) + continue; + + input_mt_slot(input, i); +- input_mt_report_slot_state(input, MT_TOOL_FINGER, false); ++ input_mt_report_slot_inactive(input); + } + + input_sync(input); +diff --git a/drivers/input/touchscreen/melfas_mip4.c b/drivers/input/touchscreen/melfas_mip4.c +index 247c3aaba2d8..f67efdd040b2 100644 +--- a/drivers/input/touchscreen/melfas_mip4.c ++++ b/drivers/input/touchscreen/melfas_mip4.c +@@ -391,7 +391,7 @@ static void mip4_clear_input(struct mip4_ts *ts) + /* Screen */ + for (i = 0; i < MIP4_MAX_FINGERS; i++) { + input_mt_slot(ts->input, i); +- input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, 0); ++ input_mt_report_slot_inactive(ts->input); + } + + /* Keys */ +@@ -534,7 +534,7 @@ static void mip4_report_touch(struct mip4_ts *ts, u8 *packet) + } else { + /* Release event */ + input_mt_slot(ts->input, id); +- input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, 0); ++ input_mt_report_slot_inactive(ts->input); + } + + input_mt_sync_frame(ts->input); +diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c +index b3dda1722bae..d5e2d2a139a2 100644 +--- a/drivers/input/touchscreen/mms114.c ++++ b/drivers/input/touchscreen/mms114.c +@@ -559,7 +559,7 @@ static int __maybe_unused mms114_suspend(struct device *dev) + /* Release all touch */ + for (id = 0; id < MMS114_MAX_TOUCH; id++) { + input_mt_slot(input_dev, id); +- input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, false); ++ input_mt_report_slot_inactive(input_dev); + } + + input_mt_report_pointer_emulation(input_dev, true); +diff --git a/drivers/input/touchscreen/raspberrypi-ts.c b/drivers/input/touchscreen/raspberrypi-ts.c +index 0e2e08f3f433..ef6aaed217cf 100644 +--- a/drivers/input/touchscreen/raspberrypi-ts.c ++++ b/drivers/input/touchscreen/raspberrypi-ts.c +@@ -100,7 +100,7 @@ static void rpi_ts_poll(struct input_dev *input) + released_ids = ts->known_ids & ~modified_ids; + for_each_set_bit(i, &released_ids, RPI_TS_MAX_SUPPORTED_POINTS) { + input_mt_slot(input, i); +- input_mt_report_slot_state(input, MT_TOOL_FINGER, 0); ++ input_mt_report_slot_inactive(input); + modified_ids &= ~(BIT(i)); + } + ts->known_ids = modified_ids; +diff --git a/drivers/input/touchscreen/stmfts.c b/drivers/input/touchscreen/stmfts.c +index b6f95f20f924..b54cc64e4ea6 100644 +--- a/drivers/input/touchscreen/stmfts.c ++++ b/drivers/input/touchscreen/stmfts.c +@@ -198,7 +198,7 @@ static void stmfts_report_contact_release(struct stmfts_data *sdata, + u8 slot_id = (event[0] & STMFTS_MASK_TOUCH_ID) >> 4; + + input_mt_slot(sdata->input, slot_id); +- input_mt_report_slot_state(sdata->input, MT_TOOL_FINGER, false); ++ input_mt_report_slot_inactive(sdata->input); + + input_sync(sdata->input); + } +diff --git a/include/linux/input/mt.h b/include/linux/input/mt.h +index 9e409bb13642..3b8580bd33c1 100644 +--- a/include/linux/input/mt.h ++++ b/include/linux/input/mt.h +@@ -100,6 +100,11 @@ static inline bool input_is_mt_axis(int axis) + bool input_mt_report_slot_state(struct input_dev *dev, + unsigned int tool_type, bool active); + ++static inline void input_mt_report_slot_inactive(struct input_dev *dev) ++{ ++ input_mt_report_slot_state(dev, 0, false); ++} ++ + void input_mt_report_finger_count(struct input_dev *dev, int count); + void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count); + void input_mt_drop_unused(struct input_dev *dev); +-- +2.26.2 + diff --git a/patches.suse/Input-psmouse-drop-all-unneeded-functions-from-mouse.patch b/patches.suse/Input-psmouse-drop-all-unneeded-functions-from-mouse.patch new file mode 100644 index 0000000..6dc9edb --- /dev/null +++ b/patches.suse/Input-psmouse-drop-all-unneeded-functions-from-mouse.patch @@ -0,0 +1,310 @@ +From cfd8579ddc02d8c5024bae7106ba37079653b3d2 Mon Sep 17 00:00:00 2001 +From: Hui Wang +Date: Tue, 20 Aug 2019 12:07:01 -0700 +Subject: [PATCH] Input: psmouse - drop all unneeded functions from mouse headers +Git-commit: cfd8579ddc02d8c5024bae7106ba37079653b3d2 +Patch-mainline: v5.4-rc1 +References: bsc#1180870 + +Recently we had a building error if we enable the MOUSE_PS2_ALPS while +disable the MOUSE_PS2_TRACKPOINT, and was fixed by 49e6979e7e92 +("input: psmouse - fix build error of multiple definition"). + +We could improve that fix by dropping all unneeded functions and +CONFIG_MOUSE_ guards from the header, it is safe to do that since +those functions are not directly called by psmouse-base.c anymore. + +Signed-off-by: Hui Wang +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/mouse/alps.h | 11 ----------- + drivers/input/mouse/byd.h | 11 ----------- + drivers/input/mouse/cypress_ps2.h | 11 ----------- + drivers/input/mouse/elantech.h | 18 ++---------------- + drivers/input/mouse/hgpk.h | 13 +++---------- + drivers/input/mouse/lifebook.h | 13 +++---------- + drivers/input/mouse/logips2pp.h | 7 ------- + drivers/input/mouse/sentelic.h | 11 ----------- + drivers/input/mouse/touchkit_ps2.h | 8 -------- + drivers/input/mouse/trackpoint.h | 8 -------- + drivers/input/mouse/vmmouse.h | 11 ----------- + 11 files changed, 8 insertions(+), 114 deletions(-) + +diff --git a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h +index f4bab629739c..0a1048cf23f6 100644 +--- a/drivers/input/mouse/alps.h ++++ b/drivers/input/mouse/alps.h +@@ -323,18 +323,7 @@ struct alps_data { + + #define ALPS_QUIRK_TRACKSTICK_BUTTONS 1 /* trakcstick buttons in trackstick packet */ + +-#ifdef CONFIG_MOUSE_PS2_ALPS + int alps_detect(struct psmouse *psmouse, bool set_properties); + int alps_init(struct psmouse *psmouse); +-#else +-inline int alps_detect(struct psmouse *psmouse, bool set_properties) +-{ +- return -ENOSYS; +-} +-inline int alps_init(struct psmouse *psmouse) +-{ +- return -ENOSYS; +-} +-#endif /* CONFIG_MOUSE_PS2_ALPS */ + + #endif +diff --git a/drivers/input/mouse/byd.h b/drivers/input/mouse/byd.h +index 8cb90d904186..ff2771e2dd2e 100644 +--- a/drivers/input/mouse/byd.h ++++ b/drivers/input/mouse/byd.h +@@ -2,18 +2,7 @@ + #ifndef _BYD_H + #define _BYD_H + +-#ifdef CONFIG_MOUSE_PS2_BYD + int byd_detect(struct psmouse *psmouse, bool set_properties); + int byd_init(struct psmouse *psmouse); +-#else +-static inline int byd_detect(struct psmouse *psmouse, bool set_properties) +-{ +- return -ENOSYS; +-} +-static inline int byd_init(struct psmouse *psmouse) +-{ +- return -ENOSYS; +-} +-#endif /* CONFIG_MOUSE_PS2_BYD */ + + #endif /* _BYD_H */ +diff --git a/drivers/input/mouse/cypress_ps2.h b/drivers/input/mouse/cypress_ps2.h +index 1eaddd818004..bb4979d06bf9 100644 +--- a/drivers/input/mouse/cypress_ps2.h ++++ b/drivers/input/mouse/cypress_ps2.h +@@ -170,18 +170,7 @@ struct cytp_data { + }; + + +-#ifdef CONFIG_MOUSE_PS2_CYPRESS + int cypress_detect(struct psmouse *psmouse, bool set_properties); + int cypress_init(struct psmouse *psmouse); +-#else +-inline int cypress_detect(struct psmouse *psmouse, bool set_properties) +-{ +- return -ENOSYS; +-} +-inline int cypress_init(struct psmouse *psmouse) +-{ +- return -ENOSYS; +-} +-#endif /* CONFIG_MOUSE_PS2_CYPRESS */ + + #endif /* _CYPRESS_PS2_H */ +diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h +index 46343998522b..e0a3e59d4f1b 100644 +--- a/drivers/input/mouse/elantech.h ++++ b/drivers/input/mouse/elantech.h +@@ -184,32 +184,18 @@ struct elantech_data { + void (*original_set_rate)(struct psmouse *psmouse, unsigned int rate); + }; + +-#ifdef CONFIG_MOUSE_PS2_ELANTECH + int elantech_detect(struct psmouse *psmouse, bool set_properties); + int elantech_init_ps2(struct psmouse *psmouse); ++ ++#ifdef CONFIG_MOUSE_PS2_ELANTECH + int elantech_init(struct psmouse *psmouse); + #else +-static inline int elantech_detect(struct psmouse *psmouse, bool set_properties) +-{ +- return -ENOSYS; +-} + static inline int elantech_init(struct psmouse *psmouse) + { + return -ENOSYS; + } +-static inline int elantech_init_ps2(struct psmouse *psmouse) +-{ +- return -ENOSYS; +-} + #endif /* CONFIG_MOUSE_PS2_ELANTECH */ + +-#if defined(CONFIG_MOUSE_PS2_ELANTECH_SMBUS) + int elantech_init_smbus(struct psmouse *psmouse); +-#else +-static inline int elantech_init_smbus(struct psmouse *psmouse) +-{ +- return -ENOSYS; +-} +-#endif /* CONFIG_MOUSE_PS2_ELANTECH_SMBUS */ + + #endif +diff --git a/drivers/input/mouse/hgpk.h b/drivers/input/mouse/hgpk.h +index 98b7b384229b..ce041591f1a8 100644 +--- a/drivers/input/mouse/hgpk.h ++++ b/drivers/input/mouse/hgpk.h +@@ -47,22 +47,15 @@ struct hgpk_data { + int xsaw_secondary, ysaw_secondary; /* jumpiness detection */ + }; + +-#ifdef CONFIG_MOUSE_PS2_OLPC +-void hgpk_module_init(void); + int hgpk_detect(struct psmouse *psmouse, bool set_properties); + int hgpk_init(struct psmouse *psmouse); ++ ++#ifdef CONFIG_MOUSE_PS2_OLPC ++void hgpk_module_init(void); + #else + static inline void hgpk_module_init(void) + { + } +-static inline int hgpk_detect(struct psmouse *psmouse, bool set_properties) +-{ +- return -ENODEV; +-} +-static inline int hgpk_init(struct psmouse *psmouse) +-{ +- return -ENODEV; +-} + #endif + + #endif +diff --git a/drivers/input/mouse/lifebook.h b/drivers/input/mouse/lifebook.h +index 573f2ca1983d..d989cca62dd6 100644 +--- a/drivers/input/mouse/lifebook.h ++++ b/drivers/input/mouse/lifebook.h +@@ -8,22 +8,15 @@ + #ifndef _LIFEBOOK_H + #define _LIFEBOOK_H + +-#ifdef CONFIG_MOUSE_PS2_LIFEBOOK +-void lifebook_module_init(void); + int lifebook_detect(struct psmouse *psmouse, bool set_properties); + int lifebook_init(struct psmouse *psmouse); ++ ++#ifdef CONFIG_MOUSE_PS2_LIFEBOOK ++void lifebook_module_init(void); + #else + static inline void lifebook_module_init(void) + { + } +-static inline int lifebook_detect(struct psmouse *psmouse, bool set_properties) +-{ +- return -ENOSYS; +-} +-static inline int lifebook_init(struct psmouse *psmouse) +-{ +- return -ENOSYS; +-} + #endif + + #endif +diff --git a/drivers/input/mouse/logips2pp.h b/drivers/input/mouse/logips2pp.h +index 5f9344135f70..df885c4874df 100644 +--- a/drivers/input/mouse/logips2pp.h ++++ b/drivers/input/mouse/logips2pp.h +@@ -8,13 +8,6 @@ + #ifndef _LOGIPS2PP_H + #define _LOGIPS2PP_H + +-#ifdef CONFIG_MOUSE_PS2_LOGIPS2PP + int ps2pp_detect(struct psmouse *psmouse, bool set_properties); +-#else +-static inline int ps2pp_detect(struct psmouse *psmouse, bool set_properties) +-{ +- return -ENOSYS; +-} +-#endif /* CONFIG_MOUSE_PS2_LOGIPS2PP */ + + #endif +diff --git a/drivers/input/mouse/sentelic.h b/drivers/input/mouse/sentelic.h +index dc88a93adf85..02cac0e7ad63 100644 +--- a/drivers/input/mouse/sentelic.h ++++ b/drivers/input/mouse/sentelic.h +@@ -106,19 +106,8 @@ struct fsp_data { + unsigned int last_mt_fgr; /* Last seen finger(multitouch) */ + }; + +-#ifdef CONFIG_MOUSE_PS2_SENTELIC + extern int fsp_detect(struct psmouse *psmouse, bool set_properties); + extern int fsp_init(struct psmouse *psmouse); +-#else +-static inline int fsp_detect(struct psmouse *psmouse, bool set_properties) +-{ +- return -ENOSYS; +-} +-static inline int fsp_init(struct psmouse *psmouse) +-{ +- return -ENOSYS; +-} +-#endif + + #endif /* __KERNEL__ */ + +diff --git a/drivers/input/mouse/touchkit_ps2.h b/drivers/input/mouse/touchkit_ps2.h +index 5acb76464a5b..c808fe6c782f 100644 +--- a/drivers/input/mouse/touchkit_ps2.h ++++ b/drivers/input/mouse/touchkit_ps2.h +@@ -9,14 +9,6 @@ + #ifndef _TOUCHKIT_PS2_H + #define _TOUCHKIT_PS2_H + +-#ifdef CONFIG_MOUSE_PS2_TOUCHKIT + int touchkit_ps2_detect(struct psmouse *psmouse, bool set_properties); +-#else +-static inline int touchkit_ps2_detect(struct psmouse *psmouse, +- bool set_properties) +-{ +- return -ENOSYS; +-} +-#endif /* CONFIG_MOUSE_PS2_TOUCHKIT */ + + #endif +diff --git a/drivers/input/mouse/trackpoint.h b/drivers/input/mouse/trackpoint.h +index 77110f3ec21d..5cb93ed26085 100644 +--- a/drivers/input/mouse/trackpoint.h ++++ b/drivers/input/mouse/trackpoint.h +@@ -155,14 +155,6 @@ struct trackpoint_data { + bool ext_dev; + }; + +-#ifdef CONFIG_MOUSE_PS2_TRACKPOINT + int trackpoint_detect(struct psmouse *psmouse, bool set_properties); +-#else +-static inline int trackpoint_detect(struct psmouse *psmouse, +- bool set_properties) +-{ +- return -ENOSYS; +-} +-#endif /* CONFIG_MOUSE_PS2_TRACKPOINT */ + + #endif /* _TRACKPOINT_H */ +diff --git a/drivers/input/mouse/vmmouse.h b/drivers/input/mouse/vmmouse.h +index 774549a12930..90157aecade7 100644 +--- a/drivers/input/mouse/vmmouse.h ++++ b/drivers/input/mouse/vmmouse.h +@@ -8,20 +8,9 @@ + #ifndef _VMMOUSE_H + #define _VMMOUSE_H + +-#ifdef CONFIG_MOUSE_PS2_VMMOUSE + #define VMMOUSE_PSNAME "VirtualPS/2" + + int vmmouse_detect(struct psmouse *psmouse, bool set_properties); + int vmmouse_init(struct psmouse *psmouse); +-#else +-static inline int vmmouse_detect(struct psmouse *psmouse, bool set_properties) +-{ +- return -ENOSYS; +-} +-static inline int vmmouse_init(struct psmouse *psmouse) +-{ +- return -ENOSYS; +-} +-#endif + + #endif +-- +2.26.2 + diff --git a/patches.suse/Input-synaptics-demote-non-conformant-kernel-doc-hea.patch b/patches.suse/Input-synaptics-demote-non-conformant-kernel-doc-hea.patch new file mode 100644 index 0000000..dc1491e --- /dev/null +++ b/patches.suse/Input-synaptics-demote-non-conformant-kernel-doc-hea.patch @@ -0,0 +1,39 @@ +From 58e5183ac869b98f3b17aa91fea11df3b718b3f2 Mon Sep 17 00:00:00 2001 +From: Lee Jones +Date: Thu, 19 Nov 2020 19:15:44 -0800 +Subject: [PATCH] Input: synaptics - demote non-conformant kernel-doc header +Git-commit: 58e5183ac869b98f3b17aa91fea11df3b718b3f2 +Patch-mainline: v5.11-rc1 +References: bsc#1180870 + +Fixes the following W=1 kernel build warning(s): + + drivers/input/mouse/synaptics.c:1781: warning: Function parameter or member 'psmouse' not described in 'synaptics_setup_intertouch' + drivers/input/mouse/synaptics.c:1781: warning: Function parameter or member 'info' not described in 'synaptics_setup_intertouch' + drivers/input/mouse/synaptics.c:1781: warning: Function parameter or member 'leave_breadcrumbs' not described in 'synaptics_setup_intertouch' + +Signed-off-by: Lee Jones +Link: https://lore.kernel.org/r/20201112110204.2083435-13-lee.jones@linaro.org +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/mouse/synaptics.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c +index 82577095e175..8fb7b4385ded 100644 +--- a/drivers/input/mouse/synaptics.c ++++ b/drivers/input/mouse/synaptics.c +@@ -1770,7 +1770,7 @@ static int synaptics_create_intertouch(struct psmouse *psmouse, + leave_breadcrumbs); + } + +-/** ++/* + * synaptics_setup_intertouch - called once the PS/2 devices are enumerated + * and decides to instantiate a SMBus InterTouch device. + */ +-- +2.26.2 + diff --git a/patches.suse/Input-synaptics-enable-InterTouch-for-ThinkPad-P1-X1.patch b/patches.suse/Input-synaptics-enable-InterTouch-for-ThinkPad-P1-X1.patch new file mode 100644 index 0000000..c83881b --- /dev/null +++ b/patches.suse/Input-synaptics-enable-InterTouch-for-ThinkPad-P1-X1.patch @@ -0,0 +1,40 @@ +From 127e4a1bc11e0e3d30f4d20bb888a1f680296990 Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Sun, 4 Oct 2020 19:49:08 -0700 +Subject: [PATCH] Input: synaptics - enable InterTouch for ThinkPad P1/X1E gen 2 +Git-commit: 127e4a1bc11e0e3d30f4d20bb888a1f680296990 +Patch-mainline: v5.10-rc1 +References: bsc#1180870 + +With the new RMI4 F3A support, we're now able to enable full RMI4 +support for this model. We also tidy up the comments a bit, as the X1E +is essentially the same computer as the P1. + +Acked-by: Lyude Paul +Signed-off-by: Jason A. Donenfeld +Link: https://lore.kernel.org/r/20200930225046.173190-3-Jason@zx2c4.com +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/mouse/synaptics.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c +index 8a54efd6eb95..43a200ca68b8 100644 +--- a/drivers/input/mouse/synaptics.c ++++ b/drivers/input/mouse/synaptics.c +@@ -179,8 +179,9 @@ static const char * const smbus_pnp_ids[] = { + "LEN0093", /* T480 */ + "LEN0096", /* X280 */ + "LEN0097", /* X280 -> ALPS trackpoint */ +- "LEN0099", /* X1 Extreme 1st */ ++ "LEN0099", /* X1 Extreme Gen 1 / P1 Gen 1 */ + "LEN009b", /* T580 */ ++ "LEN0402", /* X1 Extreme Gen 2 / P1 Gen 2 */ + "LEN200f", /* T450s */ + "LEN2044", /* L470 */ + "LEN2054", /* E480 */ +-- +2.26.2 + diff --git a/patches.suse/Input-synaptics-enable-InterTouch-for-ThinkPad-T14-G.patch b/patches.suse/Input-synaptics-enable-InterTouch-for-ThinkPad-T14-G.patch new file mode 100644 index 0000000..34de956 --- /dev/null +++ b/patches.suse/Input-synaptics-enable-InterTouch-for-ThinkPad-T14-G.patch @@ -0,0 +1,35 @@ +From 470d154a62c4ef22b4de384ae91798851c9631a7 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Mon, 5 Oct 2020 10:13:18 -0700 +Subject: [PATCH] Input: synaptics - enable InterTouch for ThinkPad T14 Gen 1 +Git-commit: 470d154a62c4ef22b4de384ae91798851c9631a7 +Patch-mainline: v5.10-rc1 +References: bsc#1180870 + +With the new RMI4 F3A support, we're now able to enable full RMI4 +support for this model. + +Signed-off-by: Hans de Goede +Link: https://lore.kernel.org/r/20201005114919.371592-1-hdegoede@redhat.com +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/mouse/synaptics.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c +index 43a200ca68b8..82577095e175 100644 +--- a/drivers/input/mouse/synaptics.c ++++ b/drivers/input/mouse/synaptics.c +@@ -186,6 +186,7 @@ static const char * const smbus_pnp_ids[] = { + "LEN2044", /* L470 */ + "LEN2054", /* E480 */ + "LEN2055", /* E580 */ ++ "LEN2068", /* T14 Gen 1 */ + "SYN3052", /* HP EliteBook 840 G4 */ + "SYN3221", /* HP 15-ay000 */ + "SYN323d", /* HP Spectre X360 13-w013dx */ +-- +2.26.2 + diff --git a/patches.suse/Input-synaptics-fix-a-typo.patch b/patches.suse/Input-synaptics-fix-a-typo.patch new file mode 100644 index 0000000..3aaa92f --- /dev/null +++ b/patches.suse/Input-synaptics-fix-a-typo.patch @@ -0,0 +1,34 @@ +From 26332247fb3fe919a3e51589601ba3de566cc355 Mon Sep 17 00:00:00 2001 +From: Christophe JAILLET +Date: Fri, 9 Aug 2019 09:45:27 -0700 +Subject: [PATCH] Input: synaptics - fix a typo +Git-commit: 26332247fb3fe919a3e51589601ba3de566cc355 +Patch-mainline: v5.4-rc1 +References: bsc#1180870 + +This should be 'synaptics', not 'synpatics' + +Signed-off-by: Christophe JAILLET +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/input/mouse/synaptics.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c +index b77b18c9ad02..a0e53b34156c 100644 +--- a/drivers/input/mouse/synaptics.c ++++ b/drivers/input/mouse/synaptics.c +@@ -191,7 +191,7 @@ static const char * const forcepad_pnp_ids[] = { + }; + + /* +- * Send a command to the synpatics touchpad by special commands ++ * Send a command to the synaptics touchpad by special commands + */ + static int synaptics_send_cmd(struct psmouse *psmouse, u8 cmd, u8 *param) + { +-- +2.26.2 + diff --git a/patches.suse/Input-synaptics-rmi4-rename-f30_data-to-gpio_data.patch b/patches.suse/Input-synaptics-rmi4-rename-f30_data-to-gpio_data.patch new file mode 100644 index 0000000..6ff94f0 --- /dev/null +++ b/patches.suse/Input-synaptics-rmi4-rename-f30_data-to-gpio_data.patch @@ -0,0 +1,145 @@ +From 261bfb3328b89c63ca410ae30a0c87cd3955344c Mon Sep 17 00:00:00 2001 +From: Vincent Huang +Date: Sun, 4 Oct 2020 19:42:47 -0700 +Subject: [PATCH] Input: synaptics-rmi4 - rename f30_data to gpio_data +Git-commit: 261bfb3328b89c63ca410ae30a0c87cd3955344c +Patch-mainline: v5.10-rc1 +References: bsc#1180870 + +f30_data in rmi_device_platform_data could be also referenced by RMI +function 3A, so rename it and the structure name to avoid confusion. + +Signed-off-by: Vincent Huang +Reviewed-by: Hans de Goede +Tested-by: Hans de Goede +Reviewed-by: Andrew Duggan +Link: https://lore.kernel.org/r/20200930094147.635556-2-vincent.huang@tw.synaptics.com +Signed-off-by: Dmitry Torokhov +Acked-by: Takashi Iwai + +--- + drivers/hid/hid-rmi.c | 2 +- + drivers/input/mouse/synaptics.c | 2 +- + drivers/input/rmi4/rmi_f30.c | 14 +++++++------- + include/linux/rmi.h | 11 ++++++----- + 4 files changed, 15 insertions(+), 14 deletions(-) + +diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c +index 8cffa84c9650..acac09ba7dd5 100644 +--- a/drivers/hid/hid-rmi.c ++++ b/drivers/hid/hid-rmi.c +@@ -721,7 +721,7 @@ static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id) + } + + if (data->device_flags & RMI_DEVICE_HAS_PHYS_BUTTONS) +- rmi_hid_pdata.f30_data.disable = true; ++ rmi_hid_pdata.gpio_data.disable = true; + + data->xport.dev = hdev->dev.parent; + data->xport.pdata = rmi_hid_pdata; +diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c +index 4b81b2d0fe06..8a54efd6eb95 100644 +--- a/drivers/input/mouse/synaptics.c ++++ b/drivers/input/mouse/synaptics.c +@@ -1752,7 +1752,7 @@ static int synaptics_create_intertouch(struct psmouse *psmouse, + .kernel_tracking = false, + .topbuttonpad = topbuttonpad, + }, +- .f30_data = { ++ .gpio_data = { + .buttonpad = SYN_CAP_CLICKPAD(info->ext_cap_0c), + .trackstick_buttons = + !!SYN_CAP_EXT_BUTTONS_STICK(info->ext_cap_10), +diff --git a/drivers/input/rmi4/rmi_f30.c b/drivers/input/rmi4/rmi_f30.c +index a90dad1d9ac7..35045f161dc2 100644 +--- a/drivers/input/rmi4/rmi_f30.c ++++ b/drivers/input/rmi4/rmi_f30.c +@@ -168,17 +168,17 @@ static int rmi_f30_config(struct rmi_function *fn) + rmi_get_platform_data(fn->rmi_dev); + int error; + +- /* can happen if f30_data.disable is set */ ++ /* can happen if gpio_data.disable is set */ + if (!f30) + return 0; + +- if (pdata->f30_data.trackstick_buttons) { ++ if (pdata->gpio_data.trackstick_buttons) { + /* Try [re-]establish link to F03. */ + f30->f03 = rmi_find_function(fn->rmi_dev, 0x03); + f30->trackstick_buttons = f30->f03 != NULL; + } + +- if (pdata->f30_data.disable) { ++ if (pdata->gpio_data.disable) { + drv->clear_irq_bits(fn->rmi_dev, fn->irq_mask); + } else { + /* Write Control Register values back to device */ +@@ -245,10 +245,10 @@ static int rmi_f30_map_gpios(struct rmi_function *fn, + if (!rmi_f30_is_valid_button(i, f30->ctrl)) + continue; + +- if (pdata->f30_data.trackstick_buttons && ++ if (pdata->gpio_data.trackstick_buttons && + i >= TRACKSTICK_RANGE_START && i < TRACKSTICK_RANGE_END) { + f30->gpioled_key_map[i] = trackstick_button++; +- } else if (!pdata->f30_data.buttonpad || !button_mapped) { ++ } else if (!pdata->gpio_data.buttonpad || !button_mapped) { + f30->gpioled_key_map[i] = button; + input_set_capability(input, EV_KEY, button++); + button_mapped = true; +@@ -264,7 +264,7 @@ static int rmi_f30_map_gpios(struct rmi_function *fn, + * but I am not sure, so use only the pdata info and the number of + * mapped buttons. + */ +- if (pdata->f30_data.buttonpad || (button - BTN_LEFT == 1)) ++ if (pdata->gpio_data.buttonpad || (button - BTN_LEFT == 1)) + __set_bit(INPUT_PROP_BUTTONPAD, input->propbit); + + return 0; +@@ -372,7 +372,7 @@ static int rmi_f30_probe(struct rmi_function *fn) + struct f30_data *f30; + int error; + +- if (pdata->f30_data.disable) ++ if (pdata->gpio_data.disable) + return 0; + + if (!drv_data->input) { +diff --git a/include/linux/rmi.h b/include/linux/rmi.h +index 8ed37f93f3c8..ab7eea01ab42 100644 +--- a/include/linux/rmi.h ++++ b/include/linux/rmi.h +@@ -102,15 +102,16 @@ struct rmi_2d_sensor_platform_data { + }; + + /** +- * struct rmi_f30_data - overrides defaults for a single F30 GPIOs/LED chip. ++ * struct rmi_gpio_data - overrides defaults for a single F30/F3A GPIOs/LED ++ * chip. + * @buttonpad - the touchpad is a buttonpad, so enable only the first actual + * button that is found. +- * @trackstick_buttons - Set when the function 30 is handling the physical ++ * @trackstick_buttons - Set when the function 30 or 3a is handling the physical + * buttons of the trackstick (as a PS/2 passthrough device). +- * @disable - the touchpad incorrectly reports F30 and it should be ignored. ++ * @disable - the touchpad incorrectly reports F30/F3A and it should be ignored. + * This is a special case which is due to misconfigured firmware. + */ +-struct rmi_f30_data { ++struct rmi_gpio_data { + bool buttonpad; + bool trackstick_buttons; + bool disable; +@@ -218,7 +219,7 @@ struct rmi_device_platform_data { + /* function handler pdata */ + struct rmi_2d_sensor_platform_data sensor_pdata; + struct rmi_f01_power_management power_management; +- struct rmi_f30_data f30_data; ++ struct rmi_gpio_data gpio_data; + }; + + /** +-- +2.26.2 + diff --git a/series.conf b/series.conf index 89f0db9..07eb185 100644 --- a/series.conf +++ b/series.conf @@ -3656,8 +3656,12 @@ patches.suse/ipmi_si-Only-schedule-continuously-in-the-thread-in-.patch patches.suse/ipmi_ssif-avoid-registering-duplicate-ssif-interface.patch patches.suse/0001-ipmi-move-message-error-checking-to-avoid-deadlock.patch + patches.suse/Input-elan_i2c-switch-to-using-devm_device_add_group.patch + patches.suse/Input-elan_i2c-switch-to-using-devm_add_action_or_re.patch + patches.suse/Input-synaptics-fix-a-typo.patch patches.suse/input-remove-dev_err-usage-after-platform_get_irq.patch patches.suse/Input-cros_ec_keyb-add-back-missing-mask-for-event_t.patch + patches.suse/Input-psmouse-drop-all-unneeded-functions-from-mouse.patch patches.suse/platform-chrome-cros_ec_rpmsg-Fix-race-with-host-com.patch patches.suse/pinctrl-tegra-Add-suspend-and-resume-support.patch patches.suse/pinctrl-tegra210-Add-Tegra210-pinctrl-pm-ops.patch @@ -34835,6 +34839,7 @@ patches.suse/mtd-spi-nor-winbond-Fix-4-byte-opcode-support-for-w2.patch patches.suse/Input-mms114-add-extra-compatible-for-mms345l.patch patches.suse/Input-edt-ft5x06-fix-get_default-register-write-acce.patch + patches.suse/Input-introduce-input_mt_report_slot_inactive.patch patches.suse/cpufreq-tegra186-add-CPUFREQ_NEED_INITIAL_FREQ_CHECK.patch patches.suse/cpufreq-change-.set_boost-to-act-on-one-policy.patch patches.suse/cpufreq-CPPC-add-SW-BOOST-support.patch @@ -41041,8 +41046,19 @@ patches.suse/SUNRPC-Fix-SUNRPC-Add-len-parameter-to-gss_unwrap.patch patches.suse/HID-quirks-add-NOGET-quirk-for-Logitech-GROUP.patch patches.suse/HID-input-Fix-devices-that-return-multiple-bytes-in-.patch + patches.suse/Input-elantech-remove-redundant-assignments-to-varia.patch + patches.suse/Input-elan_i2c-handle-firmware-not-implementing-get-.patch + patches.suse/Input-elan_i2c-make-fetching-IC-type-of-older-contro.patch + patches.suse/Input-elan_i2c-handle-devices-with-patterns-above-1.patch + patches.suse/Input-elan_i2c-fix-detecting-IAP-version-on-older-co.patch + patches.suse/Input-elan_i2c-add-support-for-different-firmware-pa.patch + patches.suse/Input-elan_i2c-handle-firmware-updated-on-newer-ICs.patch + patches.suse/Input-elan_i2c-add-firmware-update-info-for-ICs-0x11.patch + patches.suse/Input-elan_i2c-do-not-constantly-re-query-pattern-ID.patch + patches.suse/Input-elan_i2c-add-support-for-high-resolution-repor.patch patches.suse/Input-psmouse-add-a-newline-when-printing-proto-by-s.patch patches.suse/Input-ati_remote2-add-missing-newlines-when-printing.patch + patches.suse/Input-elan_i2c-add-ic-type-0x15.patch patches.suse/Input-sentelic-fix-error-return-when-fsp_reg_write-f.patch patches.suse/ubifs-Fix-wrong-orphan-node-deletion-in-ubifs_jnl_up.patch patches.suse/1646-dma-buf-Remove-custom-seqcount-lockdep-class-key.patch @@ -44092,6 +44108,9 @@ patches.suse/Input-omap4-keypad-fix-handling-of-platform_get_irq-.patch patches.suse/Input-twl4030_keypad-fix-handling-of-platform_get_ir.patch patches.suse/Input-sun4i-ps2-fix-handling-of-platform_get_irq-err.patch + patches.suse/Input-synaptics-rmi4-rename-f30_data-to-gpio_data.patch + patches.suse/Input-synaptics-enable-InterTouch-for-ThinkPad-P1-X1.patch + patches.suse/Input-synaptics-enable-InterTouch-for-ThinkPad-T14-G.patch patches.suse/scsi-qla2xxx-Use-constant-when-it-is-known.patch patches.suse/scsi-qla2xxx-Do-not-consume-srb-greedily.patch patches.suse/scsi-qla2xxx-Initialize-variable-in-qla8044_poll_reg.patch @@ -44427,6 +44446,7 @@ patches.suse/Input-i8042-allow-insmod-to-succeed-on-devices-witho.patch patches.suse/Input-sunkbd-avoid-use-after-free-in-teardown-paths.patch patches.suse/Input-resistive-adc-touch-fix-kconfig-dependency-on-.patch + patches.suse/Input-elan_i2c-fix-firmware-update-on-newer-ICs.patch patches.suse/regulator-pfuze100-limit-pfuze-support-disable-sw-to.patch patches.suse/regulator-fix-memory-leak-with-repeated-set_machine_.patch patches.suse/regulator-avoid-resolve_supply-infinite-recursion.patch @@ -45261,10 +45281,15 @@ patches.suse/platform-x86-dell-smbios-base-Fix-error-return-code-.patch patches.suse/platform-x86-mlx-platform-remove-an-unused-variable.patch patches.suse/platform-x86-mlx-platform-Fix-item-counter-assignmen.patch + patches.suse/Input-elantech-demote-obvious-abuse-of-kernel-doc-he.patch patches.suse/Input-ads7846-fix-race-that-causes-missing-releases.patch patches.suse/Input-ads7846-fix-integer-overflow-on-Rt-calculation.patch patches.suse/Input-ads7846-fix-unaligned-access-on-7845.patch + patches.suse/Input-elan_i2c_core-move-header-inclusion-inside.patch + patches.suse/Input-synaptics-demote-non-conformant-kernel-doc-hea.patch patches.suse/Input-omap4-keypad-fix-runtime-PM-error-handling.patch + patches.suse/Input-elan_i2c-add-new-trackpoint-report-type-0x5F.patch + patches.suse/Input-elantech-fix-protocol-errors-for-some-trackpoi.patch patches.suse/Input-cyapa_gen6-fix-out-of-bounds-stack-access.patch patches.suse/cpufreq-tegra194-get-consistent-cpuinfo_cur_freq.patch patches.suse/cpufreq-ap806-Add-missing-MODULE_DEVICE_TABLE.patch