linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: JJ Ding <jj_ding@emc.com.tw>
To: "Marc Dietrich" <marvin24@gmx.de>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Éric Piel" <E.A.B.Piel@tudelft.nl>
Cc: linux-input@vger.kernel.org, JJ Ding <jj_ding@emc.com.tw>
Subject: [PATCH] Input: elantech: adjust hw_version detection logic
Date: Tue,  8 Nov 2011 20:08:19 +0800	[thread overview]
Message-ID: <1320754099-2669-1-git-send-email-jj_ding@emc.com.tw> (raw)

This patch fixes some v3 hardware (fw_version: 0x150500) wrongly detected
as v2 hardware.

Reported-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: JJ Ding <jj_ding@emc.com.tw>
---
Hi list,

This is patched against v3.2-rc1.

Marc, could you please test this again? Thanks a lot.

br,
jj

 drivers/input/mouse/elantech.c |   26 ++++++++++++++++++--------
 1 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 09b93b1..e2a9867 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -1210,18 +1210,28 @@ static int elantech_reconnect(struct psmouse *psmouse)
  */
 static int elantech_set_properties(struct elantech_data *etd)
 {
+	/* This represents the version of IC body. */
 	int ver = (etd->fw_version & 0x0f0000) >> 16;
 
+	/* Early version of Elan touchpads doesn't obey the rule. */
 	if (etd->fw_version < 0x020030 || etd->fw_version == 0x020600)
 		etd->hw_version = 1;
-	else if (etd->fw_version < 0x150600)
-		etd->hw_version = 2;
-	else if (ver == 5)
-		etd->hw_version = 3;
-	else if (ver == 6)
-		etd->hw_version = 4;
-	else
-		return -1;
+	else {
+		switch (ver) {
+		case 2:
+		case 4:
+			etd->hw_version = 2;
+			break;
+		case 5:
+			etd->hw_version = 3;
+			break;
+		case 6:
+			etd->hw_version = 4;
+			break;
+		default:
+			return -1;
+		}
+	}
 
 	/*
 	 * Turn on packet checking by default.
-- 
1.7.8.rc1


             reply	other threads:[~2011-11-08 12:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-08 12:08 JJ Ding [this message]
2011-11-08 17:55 ` [PATCH] Input: elantech: adjust hw_version detection logic Marc Dietrich
2011-11-09  1:55   ` JJ Ding
2011-11-09  5:28   ` Éric Piel

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=1320754099-2669-1-git-send-email-jj_ding@emc.com.tw \
    --to=jj_ding@emc.com.tw \
    --cc=E.A.B.Piel@tudelft.nl \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=marvin24@gmx.de \
    /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;
as well as URLs for NNTP newsgroup(s).