提交 6fd38502 编写于 作者: J James Chen 提交者: Dmitry Torokhov

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: NJames Chen <james.chen@emc.com.tw>
Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
上级 a14c0f8f
......@@ -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));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册