input: atmel_mxt_ts: Zero out config version after firmware upgrade
When the touch controller firmware is upgraded, the config data on the controller might require an update too to match the firmware. Since the driver performs config version checking before updating config data and only updates to a newer version, we need to zero out the config version after a firmware upgrade to make sure proper config data will be programmed to the touch controller. Change-Id: If3e22948b1f8eea3ccbfcaa979ec6b42f1ac078a Signed-off-by: Jing Lin <jinglin@codeaurora.org>
This commit is contained in:
@@ -346,6 +346,7 @@ struct mxt_data {
|
||||
u8 t15_min_reportid;
|
||||
u8 cfg_version[MXT_CFG_VERSION_LEN];
|
||||
int cfg_version_idx;
|
||||
int t38_start_addr;
|
||||
bool update_cfg;
|
||||
const char *fw_name;
|
||||
};
|
||||
@@ -1052,8 +1053,10 @@ static int mxt_get_object_table(struct mxt_data *data)
|
||||
/* Calculate index for config major version in config array.
|
||||
* Major version is the first byte in object T38.
|
||||
*/
|
||||
if (object->type == MXT_SPT_USERDATA_T38)
|
||||
if (object->type == MXT_SPT_USERDATA_T38) {
|
||||
data->t38_start_addr = object->start_address;
|
||||
found_t38 = true;
|
||||
}
|
||||
if (!found_t38 && mxt_object_writable(object->type))
|
||||
data->cfg_version_idx += object->size + 1;
|
||||
}
|
||||
@@ -1651,6 +1654,7 @@ static ssize_t mxt_update_fw_store(struct device *dev,
|
||||
int error;
|
||||
const char *fw_name;
|
||||
u8 bootldr_id;
|
||||
u8 cfg_version[MXT_CFG_VERSION_LEN] = {0};
|
||||
|
||||
/* If fw_name is set, then the existing firmware has an upgrade */
|
||||
if (!data->fw_name) {
|
||||
@@ -1701,6 +1705,12 @@ static ssize_t mxt_update_fw_store(struct device *dev,
|
||||
data->cfg_version_idx = 0;
|
||||
data->update_cfg = false;
|
||||
|
||||
error = __mxt_write_reg(data->client, data->t38_start_addr,
|
||||
sizeof(cfg_version), cfg_version);
|
||||
if (error)
|
||||
dev_err(dev,
|
||||
"Unable to zero out config version after fw upgrade\n");
|
||||
|
||||
mxt_initialize(data);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user