reef: Discharge on AC till charger is detected

To avoid inrush current from the external charger, enable discharge
on AC till the new charger is detected and charge detect delay has
passed.

BUG=chrome-os-partner:60547
BRANCH=none
TEST=Multiple Ramp Resets and inrush current is not observed.

Change-Id: Ie3317fa6e6c2e8f00d4ce7cb9c6bee81c50d7bb2
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/417168
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
Vijay Hiremath
2016-12-06 19:06:56 -08:00
committed by chrome-bot
parent 80d5601f39
commit d3e662bf77
2 changed files with 17 additions and 2 deletions

View File

@@ -8,6 +8,7 @@
#include "battery.h"
#include "battery_smart.h"
#include "bd9995x.h"
#include "charge_ramp.h"
#include "charge_state.h"
#include "console.h"
#include "ec_commands.h"
@@ -279,11 +280,17 @@ int charger_profile_override(struct charge_state_data *curr)
*
* To overcome this issue enable the battery learning operation
* and suspend USB charging and DC/DC converter.
*
* And also to avoid inrush current from the external charger, enable
* discharge on AC till the new charger is detected and charge detect
* delay has passed.
*/
disch_on_ac = curr->batt.is_present == BP_YES &&
disch_on_ac = (curr->batt.is_present == BP_YES &&
!battery_is_cut_off() &&
!(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
curr->batt.status & STATUS_FULLY_CHARGED;
curr->batt.status & STATUS_FULLY_CHARGED) ||
(!chg_ramp_is_detected() &&
curr->batt.state_of_charge > 2);
charger_discharge_on_ac(disch_on_ac);

View File

@@ -568,6 +568,14 @@ int board_set_active_charge_port(int charge_port)
case CHARGE_PORT_NONE:
bd9995x_port_select = 0;
bd9995x_port = BD9995X_CHARGE_PORT_BOTH;
/*
* To avoid inrush current from the external charger, enable
* discharge on AC till the new charger is detected and
* charge detect delay has passed.
*/
if (charge_get_percent() > 2)
charger_discharge_on_ac(1);
break;
default:
panic("Invalid charge port\n");