From: "Dave.Wang" <dave.wang@emc.com.tw>
To: <Linux-kernel@vger.kernel.org>, <Linux-input@vger.kernel.org>,
"'Benjamin Tissoires'" <benjamin.tissoires@redhat.com>,
<Dmitry.torokhov@gmail.com>
Cc: "'Josh.Chen'" <josh.chen@emc.com.tw>, <jingle.wu@emc.com.tw>,
"'phoenix'" <phoenix@emc.com.tw>
Subject: [PATCH 5/6] Input: elantech - Transfer the device information from PS/2 to SMBus
Date: Fri, 6 Dec 2019 10:40:28 +0800 [thread overview]
Message-ID: <000d01d5abde$8532b540$8f981fc0$@emc.com.tw> (raw)
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
next reply other threads:[~2019-12-06 2:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-06 2:40 Dave.Wang [this message]
2019-12-09 3:42 Dave Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='000d01d5abde$8532b540$8f981fc0$@emc.com.tw' \
--to=dave.wang@emc.com.tw \
--cc=Dmitry.torokhov@gmail.com \
--cc=Linux-input@vger.kernel.org \
--cc=Linux-kernel@vger.kernel.org \
--cc=benjamin.tissoires@redhat.com \
--cc=jingle.wu@emc.com.tw \
--cc=josh.chen@emc.com.tw \
--cc=phoenix@emc.com.tw \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®