Commit df10cc8d authored by Jingle Wu's avatar Jingle Wu Committed by Dmitry Torokhov

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: default avatarJingle Wu <jingle.wu@emc.com.tw>
Link: https://lore.kernel.org/r/20200714105641.15151-1-jingle.wu@emc.com.twSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 40d8aa97
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#define ETP_I2C_PRESSURE_CMD 0x010A #define ETP_I2C_PRESSURE_CMD 0x010A
#define ETP_I2C_IAP_VERSION_CMD 0x0110 #define ETP_I2C_IAP_VERSION_CMD 0x0110
#define ETP_I2C_IC_TYPE_P0_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_SET_CMD 0x0300
#define ETP_I2C_POWER_CMD 0x0307 #define ETP_I2C_POWER_CMD 0x0307
#define ETP_I2C_FW_CHECKSUM_CMD 0x030F #define ETP_I2C_FW_CHECKSUM_CMD 0x030F
...@@ -266,6 +267,7 @@ static int elan_i2c_get_version(struct i2c_client *client, ...@@ -266,6 +267,7 @@ static int elan_i2c_get_version(struct i2c_client *client,
{ {
int error; int error;
u8 pattern_ver; u8 pattern_ver;
u16 cmd;
u8 val[3]; u8 val[3];
error = elan_i2c_get_pattern(client, &pattern_ver); error = elan_i2c_get_pattern(client, &pattern_ver);
...@@ -274,10 +276,14 @@ static int elan_i2c_get_version(struct i2c_client *client, ...@@ -274,10 +276,14 @@ static int elan_i2c_get_version(struct i2c_client *client,
return error; return error;
} }
error = elan_i2c_read_cmd(client, if (!iap)
iap ? ETP_I2C_IAP_VERSION_CMD : cmd = ETP_I2C_FW_VERSION_CMD;
ETP_I2C_FW_VERSION_CMD, else if (pattern_ver == 0)
val); cmd = ETP_I2C_IAP_VERSION_P0_CMD;
else
cmd = ETP_I2C_IAP_VERSION_CMD;
error = elan_i2c_read_cmd(client, cmd, val);
if (error) { if (error) {
dev_err(&client->dev, "failed to get %s version: %d\n", dev_err(&client->dev, "failed to get %s version: %d\n",
iap ? "IAP" : "FW", error); iap ? "IAP" : "FW", error);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment