diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2018-04-12 17:07:39 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2018-05-05 00:27:33 +0000 |
commit | 50172aeaa1538470c1101adcd3f07162518c927e (patch) | |
tree | d282a41e7b1f4100a1561b06c65942a04733a023 | |
parent | 8f9b570c34ddb6f992d6e669987f2f9f2cdfeafe (diff) | |
download | chrome-ec-50172aeaa1538470c1101adcd3f07162518c927e.tar.gz |
Snappy: Don't discharge on AC if system is off
When an AC charger is plugged in, the EC enable discharge-on-ac:
stopping current from VBUS and draw current from the battery. This
feature is introduced to avoid drawing too much current at once from
an AC adapter. (CL:431138)
We suspect this feature causes the system to choke when the battery is
deeply discharged.
This patch disables discharge-on-ac if the system is in G3 or S5.
BUG=b:35584495,b:74586187
BRANCH=reef
TEST=none
Change-Id: I2ddee48d4bbaa448b3d1f77b5ab079d76a4be8cb
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1011594
Reviewed-by: Saurabh Madan <ssmadan@chromium.org>
-rw-r--r-- | board/snappy/battery.c | 11 | ||||
-rw-r--r-- | board/snappy/board.c | 4 |
2 files changed, 14 insertions, 1 deletions
diff --git a/board/snappy/battery.c b/board/snappy/battery.c index 185496dbb2..cc1e059cda 100644 --- a/board/snappy/battery.c +++ b/board/snappy/battery.c @@ -10,6 +10,7 @@ #include "bd9995x.h" #include "charge_ramp.h" #include "charge_state.h" +#include "chipset.h" #include "console.h" #include "ec_commands.h" #include "extpower.h" @@ -131,6 +132,16 @@ static int charger_should_discharge_on_ac(struct charge_state_data *curr) return 0; /* + * Do not discharge on AC if the system is not consuming significant + * power. This is any of the following states including transitional + * states between them: G3, S5. + * S3 is not included because we can't distinguish whether we're booting + * up or we're quietly sleeping. + */ + if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) + return 0; + + /* * In light load (<450mA being withdrawn from VSYS) the DCDC of the * charger operates intermittently i.e. DCDC switches continuously * and then stops to regulate the output voltage and current, and diff --git a/board/snappy/board.c b/board/snappy/board.c index e3b48f6a2c..d9eba5d0b9 100644 --- a/board/snappy/board.c +++ b/board/snappy/board.c @@ -611,7 +611,9 @@ int board_set_active_charge_port(int charge_port) * discharge on AC till the new charger is detected and * charge detect delay has passed. */ - if (charge_get_percent() > 2) + if (charge_get_percent() > 2 && + !chipset_in_state(CHIPSET_STATE_ANY_OFF) && + !system_jumped_to_this_image()) charger_discharge_on_ac(1); break; default: |