summaryrefslogtreecommitdiff
path: root/drivers/input/mouse/elan_i2c_core.c
diff options
context:
space:
mode:
authorJingle Wu <jingle.wu@emc.com.tw>2020-07-16 22:49:09 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2020-07-17 17:36:01 -0700
commitbfd9b92bc8f9a3777961d27a08f62872a21ac507 (patch)
tree2f51c613955a99c4f0adf036370910198ad6c4d1 /drivers/input/mouse/elan_i2c_core.c
parent059d6c2de6fd521d4d4a39d127eece3de114b767 (diff)
Input: elan_i2c - handle firmware updated on newer ICs
Newer ICs with IC type value starting with 0x0D and newer bootloader code use 128-byte firmware pages. Their bootloader also needs to be switched to proper mode before executing firmware update. Signed-off-by: Jingle Wu <jingle.wu@emc.com.tw> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/mouse/elan_i2c_core.c')
-rw-r--r--drivers/input/mouse/elan_i2c_core.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
index 46f334bcfc0e..e0f42def99aa 100644
--- a/drivers/input/mouse/elan_i2c_core.c
+++ b/drivers/input/mouse/elan_i2c_core.c
@@ -101,7 +101,7 @@ struct elan_tp_data {
bool middle_button;
};
-static int elan_get_fwinfo(u16 ic_type, u16 *validpage_count,
+static int elan_get_fwinfo(u16 ic_type, u8 iap_version, u16 *validpage_count,
u32 *signature_address, u16 *page_size)
{
switch (ic_type) {
@@ -138,7 +138,12 @@ static int elan_get_fwinfo(u16 ic_type, u16 *validpage_count,
*signature_address =
(*validpage_count * ETP_FW_PAGE_SIZE) - ETP_FW_SIGNATURE_SIZE;
- *page_size = ETP_FW_PAGE_SIZE;
+ if (ic_type >= 0x0D && iap_version >= 1) {
+ *validpage_count /= 2;
+ *page_size = ETP_FW_PAGE_SIZE_128;
+ } else {
+ *page_size = ETP_FW_PAGE_SIZE;
+ }
return 0;
}
@@ -339,7 +344,8 @@ static int elan_query_device_info(struct elan_tp_data *data)
if (error)
return error;
- error = elan_get_fwinfo(data->ic_type, &data->fw_validpage_count,
+ error = elan_get_fwinfo(data->ic_type, data->iap_version,
+ &data->fw_validpage_count,
&data->fw_signature_address,
&data->fw_page_size);
if (error)
@@ -459,7 +465,8 @@ static int __elan_update_firmware(struct elan_tp_data *data,
u16 boot_page_count;
u16 sw_checksum = 0, fw_checksum = 0;
- error = data->ops->prepare_fw_update(client);
+ error = data->ops->prepare_fw_update(client, data->ic_type,
+ data->iap_version);
if (error)
return error;