summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2017-03-13 08:34:17 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-03-16 00:11:48 -0700
commitc5c5a57f907e52f71dbe083c8ba731abbc9ba5cf (patch)
treece11ac446787a27f8742248502654e62e55d6721 /driver
parentd3cc4835bba84f8767480272cd3057c066922ae2 (diff)
downloadchrome-ec-c5c5a57f907e52f71dbe083c8ba731abbc9ba5cf.tar.gz
BD9995X: Do not overwrite the charging current in idle mode
If the charging current is less than the BD9995X's minimum charging current it is overwritten to BD9995X's minimum charging current. However in idle mode we write the charging current which is known to the charger during that time, which can be less than the BD9995X's charging current. Hence, do not overwrite the charging current in idle mode. BUG=b:35984679 BRANCH=none TEST=Manually tested on Electro. In idle mode charge current is 0mA. Change-Id: I2e605b63c8519383c6a62d76718bc52660e7270e Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/453999 Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r--driver/charger/bd9995x.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/driver/charger/bd9995x.c b/driver/charger/bd9995x.c
index eae0a8d9f9..af8b0cc082 100644
--- a/driver/charger/bd9995x.c
+++ b/driver/charger/bd9995x.c
@@ -9,6 +9,7 @@
#include "battery_smart.h"
#include "bd9995x.h"
#include "charge_manager.h"
+#include "charge_state.h"
#include "charger.h"
#include "console.h"
#include "ec_commands.h"
@@ -645,7 +646,8 @@ int charger_set_current(int current)
if (current < BD9995X_NO_BATTERY_CHARGE_I_MIN &&
(battery_is_present() != BP_YES || battery_is_cut_off()))
current = BD9995X_NO_BATTERY_CHARGE_I_MIN;
- else if (current < bd9995x_charger_info.current_min)
+ else if (current < bd9995x_charger_info.current_min &&
+ !(charge_get_flags() & CHARGE_FLAG_FORCE_IDLE))
current = bd9995x_charger_info.current_min;
rv = ch_raw_write16(BD9995X_CMD_IPRECH_SET,