mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 07:03:09 -04:00
power: qpnp-smbcharger-mmi: Fix Dual SOC Report
The Dual battery design could lead to a filaure where it drops the SOC to a value of 0. This happens on error but also the math could have been wrong. Only allow a change in SOC if it is within +/-2% of the current reported SOC. Also still only update if it changes and bound check 0 and 100 as min and max. Change-Id: Ie049f9edcf62371b75f1e6def29b1742a9798a88 Signed-off-by: Kenny Kessler <kenny.kessler@motorola.com> Reviewed-on: https://gerrit.mot.com/1258474 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Ryan Lattrel <ryanl@motorola.com> Reviewed-by: Kenneth Kessler <kennykessler@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
fa24cffe57
commit
5bbd7c61d0
1 changed files with 6 additions and 1 deletions
|
|
@ -2033,6 +2033,7 @@ static int factory_kill_disable;
|
|||
module_param(factory_kill_disable, int, 0644);
|
||||
#define TWO_VOLT 2000000
|
||||
#define SMBCHG_HEARTBEAT_INTERVAL_NS 70000000000
|
||||
#define MONOTONIC_SOC 2 /* 2 percent */
|
||||
static void mmi_heartbeat_work(struct work_struct *work)
|
||||
{
|
||||
struct smb_mmi_charger *chip = container_of(work,
|
||||
|
|
@ -2165,7 +2166,11 @@ static void mmi_heartbeat_work(struct work_struct *work)
|
|||
else
|
||||
batt_cap = pval.intval;
|
||||
|
||||
if (batt_cap != report_cap) {
|
||||
if ((report_cap != batt_cap) &&
|
||||
(report_cap <= (batt_cap + MONOTONIC_SOC)) &&
|
||||
(report_cap >= (batt_cap - MONOTONIC_SOC)) &&
|
||||
!(report_cap < 0) &&
|
||||
!(report_cap > 100)) {
|
||||
pr_info("SMBMMI: Updating Reported Capacity to %d\n",
|
||||
report_cap);
|
||||
pval.intval = report_cap;
|
||||
|
|
|
|||
Loading…
Reference in a new issue