FG_MM8013: Update logic to compatible with param_ver=0xa200

param_ver=0xa200 is for temporary parameter.
Need to update to offical parameter.

Change-Id: I3624f7776c095051a9aa28fc23c9ba422e736db5
Signed-off-by: liuyc20 <liuyc20@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2318274
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Haijian Ma <mahj8@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
liuyc20 2022-06-30 10:49:04 +08:00 • committed by Yuecai Liu
commit 8d978d3a80

View file

@ -1203,7 +1203,7 @@ static int mm8xxx_battery_chargeType_to_FG(struct mm8xxx_device_info *di, int ty
ret =mm8xxx_write(di, MM8XXX_CMD_CHARGETYPE, (u16)type);
if (ret < 0) {
dev_err(di->dev, "error writing temperature to fg\n");
dev_err(di->dev, "error writing chargeType to fg\n");
}
return ret;
@ -2093,19 +2093,16 @@ static int mm8xxx_battery_probe(struct i2c_client *client,
else if (fg_battery_id == di->second_battery_id) {
parameter_version = di->second_battery_param_ver;
}
if (fg_fw_ver < di->latest_fw_version && \
fg_param_ver < parameter_version) {
update_index = UPDATE_ALL;
}
else if (fg_fw_ver < di->latest_fw_version && \
fg_param_ver == parameter_version) {
update_index = UPDATE_PROGRAM;
}
else if (fg_fw_ver == di->latest_fw_version && \
fg_param_ver < parameter_version) {
update_index = UPDATE_PARAMETER;
if (fg_fw_ver < di->latest_fw_version) {
if (fg_param_ver < parameter_version)
update_index = UPDATE_ALL;
else if (fg_param_ver == parameter_version)
update_index = UPDATE_PROGRAM;
else if (fg_param_ver == 0xa200)
update_index = UPDATE_ALL;
}
else if (fg_param_ver < parameter_version || fg_param_ver == 0xa200)
update_index = UPDATE_PARAMETER;
update_begin:
if (update_index != UPDATE_NONE)