From 8d978d3a80ba551cd60b511c159e59acbc06bb60 Mon Sep 17 00:00:00 2001 From: liuyc20 Date: Thu, 30 Jun 2022 10:49:04 +0800 Subject: [PATCH] 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 Reviewed-on: https://gerrit.mot.com/2318274 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Haijian Ma Reviewed-by: Huosheng Liao Submit-Approved: Jira Key --- .../power/mm8013c_fg_mmi/mm8013c_battery.c | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/power/mm8013c_fg_mmi/mm8013c_battery.c b/drivers/power/mm8013c_fg_mmi/mm8013c_battery.c index 0843fa71e08c..ae264f98b5c5 100644 --- a/drivers/power/mm8013c_fg_mmi/mm8013c_battery.c +++ b/drivers/power/mm8013c_fg_mmi/mm8013c_battery.c @@ -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)