* [PATCH 5/6] Input: elantech - Transfer the device information from PS/2 to SMBus
@ 2019-12-06 2:40 Dave.Wang
0 siblings, 0 replies; 2+ messages in thread
From: Dave.Wang @ 2019-12-06 2:40 UTC (permalink / raw)
To: Linux-kernel, Linux-input, 'Benjamin Tissoires', Dmitry.torokhov
Cc: 'Josh.Chen', jingle.wu, 'phoenix'
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@emc.com.tw>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 5/6] Input: elantech - Transfer the device information from PS/2 to SMBus
@ 2019-12-09 3:42 Dave Wang
0 siblings, 0 replies; 2+ messages in thread
From: Dave Wang @ 2019-12-09 3:42 UTC (permalink / raw)
To: Linux-input, Linux-kernel, Dmitry.torokhov
Cc: phoenix, josh.chen, jingle.wu, kai.heng.feng, Dave.Wang
From: "Dave.Wang" <dave.wang@emc.com.tw>
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@emc.com.tw>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-12-09 3:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-06 2:40 [PATCH 5/6] Input: elantech - Transfer the device information from PS/2 to SMBus Dave.Wang
2019-12-09 3:42 Dave Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).