summaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/elan_i2c_i2c.c
diff options
context:
space:
mode:
authorKT Liao <kt.liao@emc.com.tw>2017-08-18 16:49:53 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-08-18 17:07:02 -0700
commit991368818df4a50f50d2ce673b308f946ed635a6 (patch)
tree753911079edc4d049a805a1c82d64d93359fd727 /drivers/input/mouse/elan_i2c_i2c.c
parenta2ae5f0afde34eaecf3fbb13223b772ceaec6227 (diff)
downloadlinux-991368818df4a50f50d2ce673b308f946ed635a6.tar.bz2
Input: elan_i2c - support touchpads with two physical buttons
Elan touchpads on Asus ROG G752xx series laptops have 2 physical buttons. Luckily we can query the touchpad to see if it is a clickpad variant and adjust the behavior accordingly. Signed-off-by: KT Liao <kt.liao@emc.com.tw> Tested-by: Maxime Bellengé <maxime.bellenge@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/mouse/elan_i2c_i2c.c')
-rw-r--r--drivers/input/mouse/elan_i2c_i2c.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/input/mouse/elan_i2c_i2c.c b/drivers/input/mouse/elan_i2c_i2c.c
index 80172f25974d..15b1330606c1 100644
--- a/drivers/input/mouse/elan_i2c_i2c.c
+++ b/drivers/input/mouse/elan_i2c_i2c.c
@@ -288,7 +288,8 @@ static int elan_i2c_get_version(struct i2c_client *client,
}
static int elan_i2c_get_sm_version(struct i2c_client *client,
- u16 *ic_type, u8 *version)
+ u16 *ic_type, u8 *version,
+ u8 *clickpad)
{
int error;
u8 pattern_ver;
@@ -317,6 +318,7 @@ static int elan_i2c_get_sm_version(struct i2c_client *client,
return error;
}
*version = val[1];
+ *clickpad = val[0] & 0x10;
} else {
error = elan_i2c_read_cmd(client, ETP_I2C_OSM_VERSION_CMD, val);
if (error) {
@@ -326,6 +328,15 @@ static int elan_i2c_get_sm_version(struct i2c_client *client,
}
*version = val[0];
*ic_type = val[1];
+
+ error = elan_i2c_read_cmd(client, ETP_I2C_NSM_VERSION_CMD,
+ val);
+ if (error) {
+ dev_err(&client->dev, "failed to get SM version: %d\n",
+ error);
+ return error;
+ }
+ *clickpad = val[0] & 0x10;
}
return 0;