diff options
author | Jingle Wu <jingle.wu@emc.com.tw> | 2020-07-15 22:02:19 -0700 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2020-07-17 17:36:00 -0700 |
commit | df10cc8db1e13cfcbd851e02881e2ef815d21b37 (patch) | |
tree | 03654d68b8c6af3c867b9aa118b5ec0760a07bdb /drivers/input | |
parent | 40d8aa97131d16fe880cd48f8faabcd6a45019c4 (diff) | |
download | linux-df10cc8db1e13cfcbd851e02881e2ef815d21b37.tar.bz2 |
Input: elan_i2c - fix detecting IAP version on older controllers
Older controllers in bootloader mode need a different command to retrieve
the IAP version.
Signed-off-by: Jingle Wu <jingle.wu@emc.com.tw>
Link: https://lore.kernel.org/r/20200714105641.15151-1-jingle.wu@emc.com.tw
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/mouse/elan_i2c_i2c.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/input/mouse/elan_i2c_i2c.c b/drivers/input/mouse/elan_i2c_i2c.c index bb499f0d0925..317166a264e6 100644 --- a/drivers/input/mouse/elan_i2c_i2c.c +++ b/drivers/input/mouse/elan_i2c_i2c.c @@ -44,6 +44,7 @@ #define ETP_I2C_PRESSURE_CMD 0x010A #define ETP_I2C_IAP_VERSION_CMD 0x0110 #define ETP_I2C_IC_TYPE_P0_CMD 0x0110 +#define ETP_I2C_IAP_VERSION_P0_CMD 0x0111 #define ETP_I2C_SET_CMD 0x0300 #define ETP_I2C_POWER_CMD 0x0307 #define ETP_I2C_FW_CHECKSUM_CMD 0x030F @@ -266,6 +267,7 @@ static int elan_i2c_get_version(struct i2c_client *client, { int error; u8 pattern_ver; + u16 cmd; u8 val[3]; error = elan_i2c_get_pattern(client, &pattern_ver); @@ -274,10 +276,14 @@ static int elan_i2c_get_version(struct i2c_client *client, return error; } - error = elan_i2c_read_cmd(client, - iap ? ETP_I2C_IAP_VERSION_CMD : - ETP_I2C_FW_VERSION_CMD, - val); + if (!iap) + cmd = ETP_I2C_FW_VERSION_CMD; + else if (pattern_ver == 0) + cmd = ETP_I2C_IAP_VERSION_P0_CMD; + else + cmd = ETP_I2C_IAP_VERSION_CMD; + + error = elan_i2c_read_cmd(client, cmd, val); if (error) { dev_err(&client->dev, "failed to get %s version: %d\n", iap ? "IAP" : "FW", error); |