aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2010-05-13 03:41:15 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-05-13 03:43:19 -0400
commit504e8beed161bd11a2c6cbb8aaf352c14d39b5bb (patch)
treee9fa1e22d917fafc4a8ec005934f4b19f2d834ac /drivers
parent513d8be9883fe0a7a73d216c7cecd20e7c9effda (diff)
Input: elantech - use all 3 bytes when checking version
Apparently all 3 bytes returned by ETP_FW_VERSION_QUERY are significant and should be taken into account when matching hardware version/features. Tested-by: Eric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/mouse/elantech.c24
-rw-r--r--drivers/input/mouse/elantech.h5
2 files changed, 14 insertions, 15 deletions
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 2cbf3fc4729a..1ac12f7c872e 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -184,7 +184,7 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse)
184 int fingers; 184 int fingers;
185 static int old_fingers; 185 static int old_fingers;
186 186
187 if (etd->fw_version_maj == 0x01) { 187 if (etd->fw_version < 0x020000) {
188 /* 188 /*
189 * byte 0: D U p1 p2 1 p3 R L 189 * byte 0: D U p1 p2 1 p3 R L
190 * byte 1: f 0 th tw x9 x8 y9 y8 190 * byte 1: f 0 th tw x9 x8 y9 y8
@@ -226,7 +226,7 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse)
226 input_report_key(dev, BTN_LEFT, packet[0] & 0x01); 226 input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
227 input_report_key(dev, BTN_RIGHT, packet[0] & 0x02); 227 input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
228 228
229 if ((etd->fw_version_maj == 0x01) && 229 if (etd->fw_version < 0x020000 &&
230 (etd->capabilities & ETP_CAP_HAS_ROCKER)) { 230 (etd->capabilities & ETP_CAP_HAS_ROCKER)) {
231 /* rocker up */ 231 /* rocker up */
232 input_report_key(dev, BTN_FORWARD, packet[0] & 0x40); 232 input_report_key(dev, BTN_FORWARD, packet[0] & 0x40);
@@ -320,7 +320,7 @@ static int elantech_check_parity_v1(struct psmouse *psmouse)
320 unsigned char p1, p2, p3; 320 unsigned char p1, p2, p3;
321 321
322 /* Parity bits are placed differently */ 322 /* Parity bits are placed differently */
323 if (etd->fw_version_maj == 0x01) { 323 if (etd->fw_version < 0x020000) {
324 /* byte 0: D U p1 p2 1 p3 R L */ 324 /* byte 0: D U p1 p2 1 p3 R L */
325 p1 = (packet[0] & 0x20) >> 5; 325 p1 = (packet[0] & 0x20) >> 5;
326 p2 = (packet[0] & 0x10) >> 4; 326 p2 = (packet[0] & 0x10) >> 4;
@@ -456,7 +456,7 @@ static void elantech_set_input_params(struct psmouse *psmouse)
456 switch (etd->hw_version) { 456 switch (etd->hw_version) {
457 case 1: 457 case 1:
458 /* Rocker button */ 458 /* Rocker button */
459 if ((etd->fw_version_maj == 0x01) && 459 if (etd->fw_version < 0x020000 &&
460 (etd->capabilities & ETP_CAP_HAS_ROCKER)) { 460 (etd->capabilities & ETP_CAP_HAS_ROCKER)) {
461 __set_bit(BTN_FORWARD, dev->keybit); 461 __set_bit(BTN_FORWARD, dev->keybit);
462 __set_bit(BTN_BACK, dev->keybit); 462 __set_bit(BTN_BACK, dev->keybit);
@@ -685,15 +685,14 @@ int elantech_init(struct psmouse *psmouse)
685 pr_err("elantech.c: failed to query firmware version.\n"); 685 pr_err("elantech.c: failed to query firmware version.\n");
686 goto init_fail; 686 goto init_fail;
687 } 687 }
688 etd->fw_version_maj = param[0]; 688
689 etd->fw_version_min = param[2]; 689 etd->fw_version = (param[0] << 16) | (param[1] << 8) | param[2];
690 690
691 /* 691 /*
692 * Assume every version greater than this is new EeePC style 692 * Assume every version greater than this is new EeePC style
693 * hardware with 6 byte packets 693 * hardware with 6 byte packets
694 */ 694 */
695 if ((etd->fw_version_maj == 0x02 && etd->fw_version_min >= 0x30) || 695 if (etd->fw_version >= 0x020030) {
696 etd->fw_version_maj > 0x02) {
697 etd->hw_version = 2; 696 etd->hw_version = 2;
698 /* For now show extra debug information */ 697 /* For now show extra debug information */
699 etd->debug = 1; 698 etd->debug = 1;
@@ -703,8 +702,9 @@ int elantech_init(struct psmouse *psmouse)
703 etd->hw_version = 1; 702 etd->hw_version = 1;
704 etd->paritycheck = 1; 703 etd->paritycheck = 1;
705 } 704 }
706 pr_info("elantech.c: assuming hardware version %d, firmware version %d.%d\n", 705
707 etd->hw_version, etd->fw_version_maj, etd->fw_version_min); 706 pr_info("elantech.c: assuming hardware version %d, firmware version %d.%d.%d\n",
707 etd->hw_version, param[0], param[1], param[2]);
708 708
709 if (synaptics_send_cmd(psmouse, ETP_CAPABILITIES_QUERY, param)) { 709 if (synaptics_send_cmd(psmouse, ETP_CAPABILITIES_QUERY, param)) {
710 pr_err("elantech.c: failed to query capabilities.\n"); 710 pr_err("elantech.c: failed to query capabilities.\n");
@@ -719,8 +719,8 @@ int elantech_init(struct psmouse *psmouse)
719 * a touch action starts causing the mouse cursor or scrolled page 719 * a touch action starts causing the mouse cursor or scrolled page
720 * to jump. Enable a workaround. 720 * to jump. Enable a workaround.
721 */ 721 */
722 if (etd->fw_version_maj == 0x02 && etd->fw_version_min == 0x22) { 722 if (etd->fw_version == 0x020022) {
723 pr_info("elantech.c: firmware version 2.34 detected, " 723 pr_info("elantech.c: firmware version 2.0.34 detected, "
724 "enabling jumpy cursor workaround\n"); 724 "enabling jumpy cursor workaround\n");
725 etd->jumpy_cursor = 1; 725 etd->jumpy_cursor = 1;
726 } 726 }
diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h
index feac5f7af966..ac57bde1bb9f 100644
--- a/drivers/input/mouse/elantech.h
+++ b/drivers/input/mouse/elantech.h
@@ -100,11 +100,10 @@ struct elantech_data {
100 unsigned char reg_26; 100 unsigned char reg_26;
101 unsigned char debug; 101 unsigned char debug;
102 unsigned char capabilities; 102 unsigned char capabilities;
103 unsigned char fw_version_maj;
104 unsigned char fw_version_min;
105 unsigned char hw_version;
106 unsigned char paritycheck; 103 unsigned char paritycheck;
107 unsigned char jumpy_cursor; 104 unsigned char jumpy_cursor;
105 unsigned char hw_version;
106 unsigned int fw_version;
108 unsigned char parity[256]; 107 unsigned char parity[256];
109}; 108};
110 109