diff options
author | James Chen <james.chen@emc.com.tw> | 2015-07-20 11:16:36 -0700 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-08-05 11:09:56 -0700 |
commit | 6fd3850227961d70594acd45d146ad28367415b5 (patch) | |
tree | 190d6c50cca8b128870fa9c627b454e0c805d2d0 | |
parent | a14c0f8fefcb95847fe3a94a4085a7ceb88f19e5 (diff) | |
download | linux-6fd3850227961d70594acd45d146ad28367415b5.tar.gz |
Input: elants_i2c - disable idle mode before updating firmware
If the device is in idle mode and is in the middle of a scan it may not
have a chance to react to the reset and then IAP commands within required
time interval and firmware update may fail. Let's bring the device out of
idle mode before attempting to reset it so that the scan period is smaller
and thus it can react to the command quicker.
Signed-off-by: James Chen <james.chen@emc.com.tw>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r-- | drivers/input/touchscreen/elants_i2c.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c index 746137694137..42e43f14602e 100644 --- a/drivers/input/touchscreen/elants_i2c.c +++ b/drivers/input/touchscreen/elants_i2c.c @@ -605,6 +605,7 @@ static int elants_i2c_do_update_firmware(struct i2c_client *client, const u8 enter_iap[] = { 0x45, 0x49, 0x41, 0x50 }; const u8 enter_iap2[] = { 0x54, 0x00, 0x12, 0x34 }; const u8 iap_ack[] = { 0x55, 0xaa, 0x33, 0xcc }; + const u8 close_idle[] = {0x54, 0x2c, 0x01, 0x01}; u8 buf[HEADER_SIZE]; u16 send_id; int page, n_fw_pages; @@ -617,8 +618,13 @@ static int elants_i2c_do_update_firmware(struct i2c_client *client, } else { /* Start IAP Procedure */ dev_dbg(&client->dev, "Normal IAP procedure\n"); + /* Close idle mode */ + error = elants_i2c_send(client, close_idle, sizeof(close_idle)); + if (error) + dev_err(&client->dev, "Failed close idle: %d\n", error); + msleep(60); elants_i2c_sw_reset(client); - + msleep(20); error = elants_i2c_send(client, enter_iap, sizeof(enter_iap)); } |