diff options
author | Bruce <Bruce.Wan@quantatw.com> | 2016-12-27 14:45:05 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-12-29 21:26:54 -0800 |
commit | 0775e5ae06477cd7fda28c5dcb4d78cf161cdce4 (patch) | |
tree | 39d3f74f47c95c5057ddd1fc55c1918b39ff50c7 | |
parent | 10db53d0a448f32b904c0e3c7b9375cc51da8bef (diff) | |
download | chrome-ec-0775e5ae06477cd7fda28c5dcb4d78cf161cdce4.tar.gz |
pyro/snappy: Discharge on AC till charger is detected
Follow reef setting.
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=none
BRANCH=reef
TEST=make buildall
Change-Id: Ie4e249a3f8cc3140b99a944e5f252cdbaef4cab3
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/423277
Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com>
Tested-by: Keith Tzeng <keith.tzeng@quantatw.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r-- | board/pyro/battery.c | 9 | ||||
-rw-r--r-- | board/pyro/board.c | 8 | ||||
-rw-r--r-- | board/snappy/battery.c | 9 | ||||
-rw-r--r-- | board/snappy/board.c | 8 |
4 files changed, 32 insertions, 2 deletions
diff --git a/board/pyro/battery.c b/board/pyro/battery.c index a87c514f51..da5868af8a 100644 --- a/board/pyro/battery.c +++ b/board/pyro/battery.c @@ -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" @@ -245,11 +246,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; + (!chg_ramp_is_detected() && + curr->batt.state_of_charge > 2); charger_discharge_on_ac(disch_on_ac); diff --git a/board/pyro/board.c b/board/pyro/board.c index 7253543d2f..8a10409d10 100644 --- a/board/pyro/board.c +++ b/board/pyro/board.c @@ -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"); diff --git a/board/snappy/battery.c b/board/snappy/battery.c index 5ba4c0ac28..9884400264 100644 --- a/board/snappy/battery.c +++ b/board/snappy/battery.c @@ -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" @@ -173,11 +174,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; + (!chg_ramp_is_detected() && + curr->batt.state_of_charge > 2); charger_discharge_on_ac(disch_on_ac); diff --git a/board/snappy/board.c b/board/snappy/board.c index 0848857f2a..d2f62edf8a 100644 --- a/board/snappy/board.c +++ b/board/snappy/board.c @@ -567,6 +567,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"); |