diff options
| author | Nick Dyer <nick.dyer@itdev.co.uk> | 2014-12-24 14:38:16 +0000 |
|---|---|---|
| committer | Nick Dyer <nick.dyer@itdev.co.uk> | 2015-05-01 14:57:58 +0100 |
| commit | 31b266fd94004e25d58eacd8fba96b980243133a (patch) | |
| tree | 9a3a2d4463e659571fec5559eff56d3bbef5e34e | |
| parent | 7d38a7f342c33e9a65c9ac56f811c7614e63ba84 (diff) | |
| download | olio-linux-3.10-31b266fd94004e25d58eacd8fba96b980243133a.tar.xz olio-linux-3.10-31b266fd94004e25d58eacd8fba96b980243133a.zip | |
Input: atmel_mxt_ts - combine bootloader version query with probe
This removes some complexity from the bootloader state machine, and means that
we always output some debug about the version as soon as we start talking to
the bootloader.
Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
| -rw-r--r-- | drivers/input/touchscreen/atmel_mxt_ts.c | 45 |
1 files changed, 13 insertions, 32 deletions
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 13fd2d9eae5..85672e0233e 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -623,47 +623,31 @@ static int mxt_probe_bootloader(struct mxt_data *data, bool alt_address) { struct device *dev = &data->client->dev; int error; - u8 val; - bool crc_failure; + u8 buf[3]; + bool crc_failure, extended_id; error = mxt_lookup_bootloader_address(data, alt_address); if (error) return error; - error = mxt_bootloader_read(data, &val, 1); + /* Check bootloader status and version information */ + error = mxt_bootloader_read(data, buf, sizeof(buf)); if (error) return error; - /* Check app crc fail mode */ - crc_failure = (val & ~MXT_BOOT_STATUS_MASK) == MXT_APP_CRC_FAIL; + crc_failure = (buf[0] & ~MXT_BOOT_STATUS_MASK) == MXT_APP_CRC_FAIL; + extended_id = buf[0] & MXT_BOOT_EXTENDED_ID; - dev_err(dev, "Detected bootloader, status:%02X%s\n", - val, crc_failure ? ", APP_CRC_FAIL" : ""); + dev_info(dev, "Found bootloader addr:%02x ID:%u%s%u%s\n", + data->bootloader_addr, + extended_id ? (buf[1] & MXT_BOOT_ID_MASK) : buf[0], + extended_id ? " version:" : "", + extended_id ? buf[2] : 0, + crc_failure ? ", APP_CRC_FAIL" : ""); 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 val; - } - - 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, bool wait) { @@ -697,9 +681,6 @@ recheck: if (ret) return ret; - if (state == MXT_WAITING_BOOTLOAD_CMD) - val = mxt_get_bootloader_version(data, val); - switch (state) { case MXT_WAITING_BOOTLOAD_CMD: case MXT_WAITING_FRAME_DATA: @@ -2933,7 +2914,7 @@ static int mxt_enter_bootloader(struct mxt_data *data) msleep(MXT_RESET_TIME); /* Do not need to scan since we know family ID */ - ret = mxt_lookup_bootloader_address(data, 0); + ret = mxt_probe_bootloader(data, 0); if (ret) return ret; |