summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDivya Sasidharan <divya.s.sasidharan@intel.com>2018-02-20 16:20:04 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-02-28 21:30:02 -0800
commit06b1140d3d36398dcf7bae642e33c27d42521a47 (patch)
treea45e5bac513b219c0beea88f07cd79a422d7445b
parent5e614b1c98b73579d7f7975299a8be215f6ffd6d (diff)
downloadchrome-ec-06b1140d3d36398dcf7bae642e33c27d42521a47.tar.gz
glkrvp: Discharge on AC when battery almost full
In the case of almost full battery, without this change the battery will keep charging even if charging is not allowed when external power is kept attached. BUG=b:71364739 BRANCH=master TEST=On glkrvp, let battery charge to 100% and verify after that it starts discharging to 95% and then starts charging back. Change-Id: I71935f795909d11ad93fd56caaa3683b54104c65 Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com> Reviewed-on: https://chromium-review.googlesource.com/927798 Commit-Ready: Divya S Sasidharan <divya.s.sasidharan@intel.com> Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com> Reviewed-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--board/glkrvp/battery.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/board/glkrvp/battery.c b/board/glkrvp/battery.c
index 4bb39694a6..bb49336ecf 100644
--- a/board/glkrvp/battery.c
+++ b/board/glkrvp/battery.c
@@ -160,6 +160,20 @@ static const struct fast_charge_params fast_chg_params_smp_ca445 = {
*/
int charger_profile_override(struct charge_state_data *curr)
{
+ /*
+ * If battery present and not in cut off and almost full
+ * then if it does not want charge then discharge on AC
+ */
+ if ((battery_is_present() == BP_YES) &&
+ !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
+ (curr->batt.status & STATUS_FULLY_CHARGED)) {
+ charger_discharge_on_ac(1);
+ curr->state = ST_DISCHARGE;
+ return 0;
+ }
+
+ charger_discharge_on_ac(0);
+
return charger_profile_override_common(curr,
&fast_chg_params_smp_ca445,
&prev_chg_profile_info,