Skip to content

Commit bd88414

Browse files
ulrikdbdtor
authored andcommitted
Input: elantech - fix absolute mode setting on some ASUS laptops
On ASUS TP500LN and X750JN, the touchpad absolute mode is reset each time set_rate is done. In order to fix this, we will verify the firmware version, and if it matches the one in those laptops, the set_rate function is overloaded with a function elantech_set_rate_restore_reg_07 that performs the set_rate with the original function, followed by a restore of reg_07 (the register that sets the absolute mode on elantech v4 hardware). Also the ASUS TP500LN and X750JN firmware version, capabilities, and button constellation is added to elantech.c Cc: stable@vger.kernel.org Reported-and-tested-by: George Moutsopoulos <gmoutso@yahoo.co.uk> Signed-off-by: Ulrik De Bie <ulrik.debie-os@e2big.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 58d8a3b commit bd88414

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

drivers/input/mouse/elantech.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,21 @@ static psmouse_ret_t elantech_process_byte(struct psmouse *psmouse)
892892
return PSMOUSE_FULL_PACKET;
893893
}
894894

895+
/*
896+
* This writes the reg_07 value again to the hardware at the end of every
897+
* set_rate call because the register loses its value. reg_07 allows setting
898+
* absolute mode on v4 hardware
899+
*/
900+
static void elantech_set_rate_restore_reg_07(struct psmouse *psmouse,
901+
unsigned int rate)
902+
{
903+
struct elantech_data *etd = psmouse->private;
904+
905+
etd->original_set_rate(psmouse, rate);
906+
if (elantech_write_reg(psmouse, 0x07, etd->reg_07))
907+
psmouse_err(psmouse, "restoring reg_07 failed\n");
908+
}
909+
895910
/*
896911
* Put the touchpad into absolute mode
897912
*/
@@ -1094,6 +1109,8 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse,
10941109
* Asus K53SV 0x450f01 78, 15, 0c 2 hw buttons
10951110
* Asus G46VW 0x460f02 00, 18, 0c 2 hw buttons
10961111
* Asus G750JX 0x360f00 00, 16, 0c 2 hw buttons
1112+
* Asus TP500LN 0x381f17 10, 14, 0e clickpad
1113+
* Asus X750JN 0x381f17 10, 14, 0e clickpad
10971114
* Asus UX31 0x361f00 20, 15, 0e clickpad
10981115
* Asus UX32VD 0x361f02 00, 15, 0e clickpad
10991116
* Avatar AVIU-145A2 0x361f00 ? clickpad
@@ -1635,6 +1652,11 @@ int elantech_init(struct psmouse *psmouse)
16351652
goto init_fail;
16361653
}
16371654

1655+
if (etd->fw_version == 0x381f17) {
1656+
etd->original_set_rate = psmouse->set_rate;
1657+
psmouse->set_rate = elantech_set_rate_restore_reg_07;
1658+
}
1659+
16381660
if (elantech_set_input_params(psmouse)) {
16391661
psmouse_err(psmouse, "failed to query touchpad range.\n");
16401662
goto init_fail;

drivers/input/mouse/elantech.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ struct elantech_data {
142142
struct finger_pos mt[ETP_MAX_FINGERS];
143143
unsigned char parity[256];
144144
int (*send_cmd)(struct psmouse *psmouse, unsigned char c, unsigned char *param);
145+
void (*original_set_rate)(struct psmouse *psmouse, unsigned int rate);
145146
};
146147

147148
#ifdef CONFIG_MOUSE_PS2_ELANTECH

0 commit comments

Comments
 (0)