power: qpnp-smbcharger-mmi:Fix reported capacity update

On Some units battery capacity and MONOTONIC_SOC values seems
to be less than the reported capacity. In this case reported
capacity will not get updated until the unit is rebooted.

Change-Id: Ibfcaf31509e4e0d987e620f9896b66a70544689d
Reviewed-on: https://gerrit.mot.com/1315042
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Kenneth Kessler <kennykessler@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
w15039 2019-02-22 11:46:09 -06:00 • committed by Eyob Tesfu
commit 1b3dfa3d61

View file

@ -2272,6 +2272,14 @@ static void mmi_heartbeat_work(struct work_struct *work)
pr_info("SMBMMI: Updating Reported Capacity to %d\n",
report_cap);
chip->last_reported_soc = report_cap;
}else if ((batt_cap < 100) && (report_cap > (batt_cap + MONOTONIC_SOC))) {
chip->last_reported_soc++;
pr_info("SMBMMI: Alter Up Reported Capacity to %d target %d\n",
chip->last_reported_soc, report_cap);
}else if ((batt_cap > 0) && (report_cap < (batt_cap - MONOTONIC_SOC))) {
chip->last_reported_soc--;
pr_info("SMBMMI: Alter Down Reported Capacity to %d target %d\n",
chip->last_reported_soc, report_cap);
}
/* Dual Step and Thermal Charging */