[PATCH 5/6] Input: elantech - Transfer the device information from PS/2 to SMBus
From: Dave.Wang
Date: Thu Dec 05 2019 - 21:40:33 EST
Many commands in SMBus interface cannot be triggered. In order to
get the correct device information, transfer the device information
from PS/2 to SMBus interface for PS/2+SMbus protocol.
Signed-off-by: Dave Wang <dave.wang@xxxxxxxxxx>
---
drivers/input/mouse/elantech.c | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 53d7ff719d76..0392b668cd39 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -1889,12 +1889,28 @@ static int elantech_create_smbus(struct psmouse
*psmouse,
struct elantech_device_info *info,
bool leave_breadcrumbs)
{
- struct property_entry i2c_props[11] = {};
+ struct property_entry i2c_props[19] = {};
struct i2c_board_info smbus_board = {
I2C_BOARD_INFO("elan_i2c", 0x15),
.flags = I2C_CLIENT_HOST_NOTIFY,
};
unsigned int idx = 0;
+ u16 product_id, ic_type;
+ u8 sm_version, fw_version, iap_version;
+
+ if (info->pattern > 0) {
+ product_id = get_unaligned_be16(info->samples);
+ sm_version = info->bus;
+ ic_type = get_unaligned_be16(info->ic_body);
+ fw_version = info->ic_body[2];
+ iap_version = info->iap_version[2];
+ } else {
+ product_id = info->samples[1];
+ sm_version = info->samples[0];
+ ic_type = (info->fw_version & 0x0f0000) >> 16;
+ fw_version = info->fw_version & 0x0000ff;
+ iap_version = 0x00;
+ }
smbus_board.properties = i2c_props;
@@ -1906,6 +1922,22 @@ static int elantech_create_smbus(struct psmouse
*psmouse,
info->x_min);
i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-min-y",
info->y_min);
+ i2c_props[idx++] = PROPERTY_ENTRY_U16("elan,product_id",
+ product_id);
+ i2c_props[idx++] = PROPERTY_ENTRY_U8("elan,sm_version",
+ sm_version);
+ i2c_props[idx++] = PROPERTY_ENTRY_U16("elan,ic_type",
+ ic_type);
+ i2c_props[idx++] = PROPERTY_ENTRY_U8("elan,fw_version",
+ fw_version);
+ i2c_props[idx++] = PROPERTY_ENTRY_U16("elan,fw_checksum",
+ info->fw_checksum[0] << 8 | info->fw_checksum[1]);
+ i2c_props[idx++] = PROPERTY_ENTRY_U16("elan,iap_checksum",
+ info->iap_checksum[0] << 8 | info->iap_checksum[1]);
+ i2c_props[idx++] = PROPERTY_ENTRY_U8("elan,iap_version",
+ iap_version);
+ i2c_props[idx++] = PROPERTY_ENTRY_U8("elan,pattern",
+ info->pattern);
if (info->x_res)
i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-x-mm",
(info->x_max + 1) /
info->x_res);
--
2.17.1