OSDN Git Service

power: qpnp-fg-gen3: Adjust recharge SOC after early termination
authorSubbaraman Narayanamurthy <subbaram@codeaurora.org>
Fri, 22 Dec 2017 01:39:07 +0000 (17:39 -0800)
committerSubbaraman Narayanamurthy <subbaram@codeaurora.org>
Mon, 15 Jan 2018 22:38:24 +0000 (14:38 -0800)
Currently, recharge SOC is adjusted based on the SOC at which
charge termination occurs. However, it gets reset back to the
original threshold only if input is removed. This does not work
well if charging resumes again once the battery is out of JEITA
as the recharge SOC threshold stays configured at a lower value.
Fix it by adjusting recharge SOC to the original threshold once
charging begins.

CRs-Fixed: 2163058
Change-Id: I07c714d32ba0005d3b0ff61142928eda58f049d0
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
drivers/power/supply/qcom/qpnp-fg-gen3.c

index 2f958a3..2b645e8 100644 (file)
@@ -2093,8 +2093,12 @@ static int fg_adjust_recharge_soc(struct fg_chip *chip)
                                return 0;
                        }
                } else {
-                       /* Charging, do nothing */
-                       return 0;
+                       if (!chip->recharge_soc_adjusted)
+                               return 0;
+
+                       /* Restore the default value */
+                       new_recharge_soc = recharge_soc;
+                       chip->recharge_soc_adjusted = false;
                }
        } else {
                /* Restore the default value */