[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1359706312-24642-10-git-send-email-djkurtz@chromium.org>
Date: Fri, 1 Feb 2013 16:11:51 +0800
From: Daniel Kurtz <djkurtz@...omium.org>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>,
Henrik Rydberg <rydberg@...omail.se>,
Benson Leung <bleung@...omium.org>,
Yufeng Shen <miletus@...omium.org>,
Nick Dyer <nick.dyer@...ev.co.uk>
Cc: Joonyoung Shim <jy0922.shim@...sung.com>,
linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
olofj@...omium.org
Subject: [PATCH 09/10] Input: atmel_mxt_ts - wait for CHG after bootloader resets
From: Benson Leung <bleung@...omium.org>
Rather than msleep for MXT_RESET_TIME and MXT_FWRESET_TIME
during the transition to bootloader mode and the transition
back from app, wait for the CHG assert to indicate that the
transition is done.
This change replaces the msleep with a wait for completion that
the mxt_interrupt handler signals.
This improves firmware update time by 300 ms as we no longer
wait longer than necessary for each reset.
Signed-off-by: Benson Leung <bleung@...omium.org>
---
drivers/input/touchscreen/atmel_mxt_ts.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index d0f91ff..ef867d3 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -634,6 +634,7 @@ static bool mxt_is_T9_message(struct mxt_data *data, struct mxt_message *msg)
static int mxt_enter_bl(struct mxt_data *data)
{
struct i2c_client *client = data->client;
+ struct device *dev = &client->dev;
int ret;
if (mxt_in_bootloader(data))
@@ -662,8 +663,19 @@ static int mxt_enter_bl(struct mxt_data *data)
data->input_dev = NULL;
}
+ INIT_COMPLETION(data->bl_completion);
enable_irq(data->irq);
- msleep(MXT_RESET_TIME);
+
+ /* Wait for CHG assert to indicate successful reset into bootloader */
+ ret = mxt_wait_for_chg(data, MXT_RESET_TIME);
+ if (ret) {
+ dev_err(dev, "Failed waiting for reset to bootloader.\n");
+ if (client->addr == MXT_BOOT_LOW)
+ client->addr = MXT_APP_LOW;
+ else
+ client->addr = MXT_APP_HIGH;
+ return ret;
+ }
return 0;
}
@@ -676,10 +688,10 @@ static void mxt_exit_bl(struct mxt_data *data)
if (!mxt_in_bootloader(data))
return;
- disable_irq(data->irq);
/* Wait for reset */
- msleep(MXT_FWRESET_TIME);
+ mxt_wait_for_chg(data, MXT_FWRESET_TIME);
+ disable_irq(data->irq);
if (client->addr == MXT_BOOT_LOW)
client->addr = MXT_APP_LOW;
else
@@ -1122,7 +1134,6 @@ static int mxt_load_fw(struct device *dev, const char *fn)
if (ret)
goto out;
- INIT_COMPLETION(data->bl_completion);
/* Unlock bootloader */
ret = mxt_unlock_bootloader(client);
if (ret)
--
1.8.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists