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>
This commit is contained in:
Vijay Hiremath
2017-03-13 08:34:17 -07:00
committed by chrome-bot
parent d3cc4835bb
commit c5c5a57f90

View File

@@ -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,