kernel:Add battery profile update flag
authorxuwei9 <xuwei9@lenovo.com>
Thu, 27 Dec 2018 05:32:32 +0000 (13:32 +0800)
committerxiest1 <xiest1@lenovo.com>
Tue, 5 Nov 2019 09:30:30 +0000 (17:30 +0800)
Add battery profile
update flag

Change-Id: I3ae1eca91ea30c6b09ce8f85d1186eb845be48bc
Signed-off-by: xuwei9 <xuwei9@mt.com>
Reviewed-on: https://gerrit.mot.com/1287459
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key

drivers/power/supply/s2mu106_fuelgauge.c
include/linux/power/s2mu106_fuelgauge.h

index 9502da1e84c315ed127c31e5c217fd88abda6a75..fb618ac7e4dfd3cb30c110382f13c3fd4434a24f 100755 (executable)
@@ -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
index d0cadba4f9410a323346c93ee6a0ca3902b4e189..2130e3ecdf566fe3fc155ab9d19d28770bf3964f 100755 (executable)
@@ -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 {