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 3/6] Input: elantech - Increace and correct device information for pattern 0,1,2
Date: Fri, 6 Dec 2019 10:31:32 +0800 [thread overview]
Message-ID: <000b01d5abdd$45ffece0$d1ffc6a0$@emc.com.tw> (raw)
Get and correct the device informations including fw_checksum, iap_checksum,
ic_body, iap_version from differnet pattern.
Signed-off-by: Dave Wang <dave.wang@emc.com.tw>
---
drivers/input/mouse/elantech.c | 47 +++++++++++++++++++++++++++++++++-
drivers/input/mouse/elantech.h | 8 ++++++
2 files changed, 54 insertions(+), 1 deletion(-)
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index afb87122b766..322b181d00e9 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -857,7 +857,8 @@ static int elantech_packet_check_v4(struct psmouse
*psmouse)
*/
if (etd->info.crc_enabled)
sanity_check = ((packet[3] & 0x08) == 0x00);
- else if (ic_version == 7 && etd->info.samples[1] == 0x2A)
+ else if (ic_version == 7 && etd->info.samples[1] == 0x2A &&
+ etd->info.pattern == 0x00)
sanity_check = ((packet[3] & 0x1c) == 0x10);
else
sanity_check = ((packet[0] & 0x08) == 0x00 &&
@@ -1669,6 +1670,50 @@ static int elantech_query_info(struct psmouse
*psmouse,
info->samples[2]);
}
+ if (elantech_read_reg_params(psmouse, ETP_FW_CHECKSUM_QUERY,
+ info->fw_checksum)) {
+ psmouse_err(psmouse, "failed to get fw checksum\n");
+ return -EINVAL;
+ }
+ psmouse_info(psmouse,
+ "Elan fw checksum result %02x, %02x, %02x\n",
+ info->fw_checksum[0],
+ info->fw_checksum[1],
+ info->fw_checksum[2]);
+
+ if (elantech_read_reg_params(psmouse, ETP_IAP_CHECKSUM_QUERY,
+ info->iap_checksum)) {
+ psmouse_err(psmouse, "failed to get iap checksum\n");
+ return -EINVAL;
+ }
+ psmouse_info(psmouse,
+ "Elan iap checksum result %02x, %02x, %02x\n",
+ info->iap_checksum[0],
+ info->iap_checksum[1],
+ info->iap_checksum[2]);
+
+ if (info->pattern > 0x00) {
+ if (info->send_cmd(psmouse, ETP_ICBODY_QUERY,
info->ic_body)) {
+ psmouse_err(psmouse, "failed to query ic body\n");
+ return -EINVAL;
+ }
+ psmouse_info(psmouse,
+ "Elan ic body : %02x%02x, fw version : %02x\n",
+ info->ic_body[0],
+ info->ic_body[1],
+ info->ic_body[2]);
+
+ if (info->send_cmd(psmouse, ETP_IAP_VERSION_QUERY,
+ info->iap_version)) {
+ psmouse_err(psmouse, "failed to query iap
version\n");
+ return -EINVAL;
+ }
+ psmouse_info(psmouse,
+ "Elan iap interface type : %02x, iap version :
%02x\n",
+ info->iap_version[1],
+ info->iap_version[2]);
+ }
+
if (info->samples[1] == 0x74 && info->hw_version == 0x03) {
/*
* This module has a bug which makes absolute mode
diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h
index 0aae6a9de8f0..a633ffa0eb07 100644
--- a/drivers/input/mouse/elantech.h
+++ b/drivers/input/mouse/elantech.h
@@ -18,6 +18,10 @@
#define ETP_CAPABILITIES_QUERY 0x02
#define ETP_SAMPLE_QUERY 0x03
#define ETP_RESOLUTION_QUERY 0x04
+#define ETP_ICBODY_QUERY 0x05
+#define ETP_IAP_VERSION_QUERY 0x06
+#define ETP_IAP_CHECKSUM_QUERY 0x0A
+#define ETP_FW_CHECKSUM_QUERY 0xFE
/*
* Command values for register reading or writing
@@ -138,6 +142,10 @@ struct finger_pos {
struct elantech_device_info {
unsigned char capabilities[3];
unsigned char samples[3];
+ unsigned char fw_checksum[3];
+ unsigned char iap_checksum[3];
+ unsigned char ic_body[3];
+ unsigned char iap_version[3];
unsigned char debug;
unsigned char hw_version;
unsigned char pattern;
--
2.17.1
next reply other threads:[~2019-12-06 2:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-06 2:31 Dave.Wang [this message]
2019-12-09 3:15 [PATCH 3/6] Input: elantech - Increace and correct device information for pattern 0,1,2 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='000b01d5abdd$45ffece0$d1ffc6a0$@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.