From 1b3dfa3d61f861bc2cc24f84ae23e9765eea11de Mon Sep 17 00:00:00 2001 From: w15039 Date: Fri, 22 Feb 2019 11:46:09 -0600 Subject: [PATCH] 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 Submit-Approved: Jira Key --- drivers/power/qpnp-smbcharger-mmi/qpnp-smbcharger-mmi.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/power/qpnp-smbcharger-mmi/qpnp-smbcharger-mmi.c b/drivers/power/qpnp-smbcharger-mmi/qpnp-smbcharger-mmi.c index c350b0c2f5e2..9a4ae8bf3030 100644 --- a/drivers/power/qpnp-smbcharger-mmi/qpnp-smbcharger-mmi.c +++ b/drivers/power/qpnp-smbcharger-mmi/qpnp-smbcharger-mmi.c @@ -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 */