aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorNick Dyer <nick.dyer@itdev.co.uk>2014-07-23 15:42:40 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2014-07-23 17:42:10 -0400
commit385deb962aa26a324cad2e85352624b20c2ba52f (patch)
tree200d9d25a23cb8f401e4d4da8b5fd0be6c28d027 /drivers/input
parenta9fdd1e6de62c3c13046c1424d5ed541d7ee745b (diff)
Input: atmel_mxt_ts - handle bootloader previously unlocked
On a warm probe, the device might be in a state where an flash operation was not completed. Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk> Acked-by: Benson Leung <bleung@chromium.org> Acked-by: Yufeng Shen <miletus@chromium.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/touchscreen/atmel_mxt_ts.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 95e3ef49ac9b..bc1d276871c5 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -449,14 +449,15 @@ static u8 mxt_get_bootloader_version(struct mxt_data *data, u8 val)
449 } 449 }
450} 450}
451 451
452static int mxt_check_bootloader(struct mxt_data *data, unsigned int state) 452static int mxt_check_bootloader(struct mxt_data *data, unsigned int state,
453 bool wait)
453{ 454{
454 struct device *dev = &data->client->dev; 455 struct device *dev = &data->client->dev;
455 u8 val; 456 u8 val;
456 int ret; 457 int ret;
457 458
458recheck: 459recheck:
459 if (state != MXT_WAITING_BOOTLOAD_CMD) { 460 if (wait) {
460 /* 461 /*
461 * In application update mode, the interrupt 462 * In application update mode, the interrupt
462 * line signals state transitions. We must wait for the 463 * line signals state transitions. We must wait for the
@@ -1676,15 +1677,23 @@ static int mxt_load_fw(struct device *dev, const char *fn)
1676 mxt_free_object_table(data); 1677 mxt_free_object_table(data);
1677 reinit_completion(&data->bl_completion); 1678 reinit_completion(&data->bl_completion);
1678 1679
1679 ret = mxt_check_bootloader(data, MXT_WAITING_BOOTLOAD_CMD); 1680 ret = mxt_check_bootloader(data, MXT_WAITING_BOOTLOAD_CMD, false);
1680 if (ret) 1681 if (ret) {
1681 goto disable_irq; 1682 /* Bootloader may still be unlocked from previous attempt */
1683 ret = mxt_check_bootloader(data, MXT_WAITING_FRAME_DATA, false);
1684 if (ret)
1685 goto disable_irq;
1686 } else {
1687 dev_info(dev, "Unlocking bootloader\n");
1682 1688
1683 /* Unlock bootloader */ 1689 /* Unlock bootloader */
1684 mxt_unlock_bootloader(data); 1690 ret = mxt_unlock_bootloader(data);
1691 if (ret)
1692 goto disable_irq;
1693 }
1685 1694
1686 while (pos < fw->size) { 1695 while (pos < fw->size) {
1687 ret = mxt_check_bootloader(data, MXT_WAITING_FRAME_DATA); 1696 ret = mxt_check_bootloader(data, MXT_WAITING_FRAME_DATA, true);
1688 if (ret) 1697 if (ret)
1689 goto disable_irq; 1698 goto disable_irq;
1690 1699
@@ -1698,7 +1707,7 @@ static int mxt_load_fw(struct device *dev, const char *fn)
1698 if (ret) 1707 if (ret)
1699 goto disable_irq; 1708 goto disable_irq;
1700 1709
1701 ret = mxt_check_bootloader(data, MXT_FRAME_CRC_PASS); 1710 ret = mxt_check_bootloader(data, MXT_FRAME_CRC_PASS, true);
1702 if (ret) { 1711 if (ret) {
1703 retry++; 1712 retry++;
1704 1713