Commit e57a66aa authored by Nick Dyer's avatar Nick Dyer Committed by Dmitry Torokhov

Input: atmel_mxt_ts - read and report bootloader version

Signed-off-by: default avatarNick Dyer <nick.dyer@itdev.co.uk>
Acked-by: default avatarBenson Leung <bleung@chromium.org>
Acked-by: default avatarYufeng Shen <miletus@chromium.org>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent f28a842d
...@@ -198,6 +198,8 @@ ...@@ -198,6 +198,8 @@
#define MXT_FRAME_CRC_PASS 0x04 #define MXT_FRAME_CRC_PASS 0x04
#define MXT_APP_CRC_FAIL 0x40 /* valid 7 8 bit only */ #define MXT_APP_CRC_FAIL 0x40 /* valid 7 8 bit only */
#define MXT_BOOT_STATUS_MASK 0x3f #define MXT_BOOT_STATUS_MASK 0x3f
#define MXT_BOOT_EXTENDED_ID (1 << 5)
#define MXT_BOOT_ID_MASK 0x1f
/* Touch status */ /* Touch status */
#define MXT_UNGRIP (1 << 0) #define MXT_UNGRIP (1 << 0)
...@@ -446,6 +448,27 @@ static int mxt_lookup_bootloader_address(struct mxt_data *data) ...@@ -446,6 +448,27 @@ static int mxt_lookup_bootloader_address(struct mxt_data *data)
return 0; return 0;
} }
static u8 mxt_get_bootloader_version(struct mxt_data *data, u8 val)
{
struct device *dev = &data->client->dev;
u8 buf[3];
if (val & MXT_BOOT_EXTENDED_ID) {
if (mxt_bootloader_read(data, &buf[0], 3) != 0) {
dev_err(dev, "%s: i2c failure\n", __func__);
return -EIO;
}
dev_dbg(dev, "Bootloader ID:%d Version:%d\n", buf[1], buf[2]);
return buf[0];
} else {
dev_dbg(dev, "Bootloader ID:%d\n", val & MXT_BOOT_ID_MASK);
return val;
}
}
static int mxt_check_bootloader(struct mxt_data *data, unsigned int state) static int mxt_check_bootloader(struct mxt_data *data, unsigned int state)
{ {
struct device *dev = &data->client->dev; struct device *dev = &data->client->dev;
...@@ -478,6 +501,9 @@ static int mxt_check_bootloader(struct mxt_data *data, unsigned int state) ...@@ -478,6 +501,9 @@ static int mxt_check_bootloader(struct mxt_data *data, unsigned int state)
if (ret) if (ret)
return ret; return ret;
if (state == MXT_WAITING_BOOTLOAD_CMD)
val = mxt_get_bootloader_version(data, val);
switch (state) { switch (state) {
case MXT_WAITING_BOOTLOAD_CMD: case MXT_WAITING_BOOTLOAD_CMD:
case MXT_WAITING_FRAME_DATA: case MXT_WAITING_FRAME_DATA:
......
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