Skip to content

Commit 36189cc

Browse files
jwrdegoededtor
authored andcommitted
Input: elantech - fix touchpad initialization on Gigabyte U2442
The hw_version 3 Elantech touchpad on the Gigabyte U2442 does not accept 0x0b as initialization value for r10, this stand-alone version of the driver: http://planet76.com/drivers/elantech/psmouse-elantech-v6.tar.bz2 Uses 0x03 which does work, so this means not setting bit 3 of r10 which sets: "Enable Real H/W Resolution In Absolute mode" Which will result in half the x and y resolution we get with that bit set, so simply not setting it everywhere is not a solution. We've been unable to find a way to identify touchpads where setting the bit will fail, so this patch uses a dmi based blacklist for this. https://bugzilla.kernel.org/show_bug.cgi?id=61151 Cc: stable@vger.kernel.org Reported-by: Philipp Wolfer <ph.wolfer@gmail.com> Tested-by: Philipp Wolfer <ph.wolfer@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent c161349 commit 36189cc

3 files changed

Lines changed: 30 additions & 2 deletions

File tree

‎Documentation/input/elantech.txt‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,9 +504,12 @@ byte 5:
504504
* reg_10
505505

506506
bit 7 6 5 4 3 2 1 0
507-
0 0 0 0 0 0 0 A
507+
0 0 0 0 R F T A
508508

509509
A: 1 = enable absolute tracking
510+
T: 1 = enable two finger mode auto correct
511+
F: 1 = disable ABS Position Filter
512+
R: 1 = enable real hardware resolution
510513

511514
6.2 Native absolute mode 6 byte packet format
512515
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

‎drivers/input/mouse/elantech.c‎

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*/
1212

1313
#include <linux/delay.h>
14+
#include <linux/dmi.h>
1415
#include <linux/slab.h>
1516
#include <linux/module.h>
1617
#include <linux/input.h>
@@ -831,7 +832,11 @@ static int elantech_set_absolute_mode(struct psmouse *psmouse)
831832
break;
832833

833834
case 3:
834-
etd->reg_10 = 0x0b;
835+
if (etd->set_hw_resolution)
836+
etd->reg_10 = 0x0b;
837+
else
838+
etd->reg_10 = 0x03;
839+
835840
if (elantech_write_reg(psmouse, 0x10, etd->reg_10))
836841
rc = -1;
837842

@@ -1330,6 +1335,22 @@ static int elantech_reconnect(struct psmouse *psmouse)
13301335
return 0;
13311336
}
13321337

1338+
/*
1339+
* Some hw_version 3 models go into error state when we try to set bit 3 of r10
1340+
*/
1341+
static const struct dmi_system_id no_hw_res_dmi_table[] = {
1342+
#if defined(CONFIG_DMI) && defined(CONFIG_X86)
1343+
{
1344+
/* Gigabyte U2442 */
1345+
.matches = {
1346+
DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
1347+
DMI_MATCH(DMI_PRODUCT_NAME, "U2442"),
1348+
},
1349+
},
1350+
#endif
1351+
{ }
1352+
};
1353+
13331354
/*
13341355
* determine hardware version and set some properties according to it.
13351356
*/
@@ -1390,6 +1411,9 @@ static int elantech_set_properties(struct elantech_data *etd)
13901411
*/
13911412
etd->crc_enabled = ((etd->fw_version & 0x4000) == 0x4000);
13921413

1414+
/* Enable real hardware resolution on hw_version 3 ? */
1415+
etd->set_hw_resolution = !dmi_check_system(no_hw_res_dmi_table);
1416+
13931417
return 0;
13941418
}
13951419

‎drivers/input/mouse/elantech.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ struct elantech_data {
130130
bool jumpy_cursor;
131131
bool reports_pressure;
132132
bool crc_enabled;
133+
bool set_hw_resolution;
133134
unsigned char hw_version;
134135
unsigned int fw_version;
135136
unsigned int single_finger_reports;

0 commit comments

Comments
 (0)