From bd23701d0399542cb47b44cc7064d5f8d2a344fe Mon Sep 17 00:00:00 2001 From: xuwei9 Date: Thu, 27 Dec 2018 13:32:32 +0800 Subject: [PATCH] kernel:Add battery profile update flag Add battery profile update flag Change-Id: I3ae1eca91ea30c6b09ce8f85d1186eb845be48bc Signed-off-by: xuwei9 Reviewed-on: https://gerrit.mot.com/1287459 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Xiangpo Zhao Submit-Approved: Jira Key --- drivers/power/supply/s2mu106_fuelgauge.c | 14 ++++++++++++++ include/linux/power/s2mu106_fuelgauge.h | 1 + 2 files changed, 15 insertions(+) diff --git a/drivers/power/supply/s2mu106_fuelgauge.c b/drivers/power/supply/s2mu106_fuelgauge.c index 9502da1e84c3..fb618ac7e4df 100755 --- a/drivers/power/supply/s2mu106_fuelgauge.c +++ b/drivers/power/supply/s2mu106_fuelgauge.c @@ -354,6 +354,16 @@ static void s2mu106_reset_fg(struct s2mu106_fuelgauge_data *fuelgauge) s2mu106_write_and_verify_reg_byte(fuelgauge->i2c, S2MU106_REG_FG_ID, temp); s2mu106_read_reg_byte(fuelgauge->i2c, S2MU106_REG_FG_ID, &temp); + pr_info("%s: S2MU106_REG_FG_ID = 0x%02x, data ver. = 0x%x\n", __func__, + temp, fuelgauge->info.battery_param_ver); + + /* Update battery parameter version */ + s2mu106_read_reg_byte(fuelgauge->i2c, S2MU106_REG_FG_ID, &temp); + temp &= 0xF0; + temp |= (fuelgauge->info.battery_param_ver & 0x0F); + s2mu106_write_and_verify_reg_byte(fuelgauge->i2c, S2MU106_REG_FG_ID, temp); + s2mu106_read_reg_byte(fuelgauge->i2c, S2MU106_REG_FG_ID, &temp); + pr_info("%s: S2MU106_REG_FG_ID = 0x%02x, data ver. = 0x%x\n", __func__, temp, fuelgauge->info.battery_param_ver); @@ -1987,6 +1997,10 @@ static int s2mu106_fuelgauge_probe(struct i2c_client *client, } } + s2mu106_read_reg_byte(fuelgauge->i2c, S2MU106_REG_FG_ID, &temp); + pr_info("%s: parameter ver. in IC: 0x%02x, in kernel: 0x%02x\n", __func__, + temp & 0x0F, fuelgauge->info.battery_param_ver); + #if (TEMP_COMPEN) || (BATCAP_LEARN) fuelgauge->bat_charging = false; #endif diff --git a/include/linux/power/s2mu106_fuelgauge.h b/include/linux/power/s2mu106_fuelgauge.h index d0cadba4f941..2130e3ecdf56 100755 --- a/include/linux/power/s2mu106_fuelgauge.h +++ b/include/linux/power/s2mu106_fuelgauge.h @@ -106,6 +106,7 @@ struct fg_info { int batcap_cell2[4]; int accum_cell2[2]; int battery_param_ver_cell2; + int battery_param_ver; }; struct s2mu106_platform_data { -- 2.20.1