summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2016-06-09 13:10:20 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-06-10 00:18:05 -0700
commite1eb211f318b0d95cf7801ba49bebce51e290833 (patch)
tree66efdcafb2d092c8efd13b9bfc2b59902607e410 /common
parent5cd47907a0a9d7865bea260f6d03ab795285eeef (diff)
downloadchrome-ec-e1eb211f318b0d95cf7801ba49bebce51e290833.tar.gz
charge_manager: Allow rejected 'Dont charge' request on init
If our battery isn't able to provide enough power to the EC on boot, we should not cut off our input power, regardless of dual role determination or other charging policy. BUG=chrome-os-partner:54058 BRANCH=None TEST=Manual on gru. Drain battery completely, attach USB-C charger, verify that "Battery critical, don't disable charging" is seen on the console and the EC doesn't brown out. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I981f9dbf3d84390550bb696e561f5fa51ffc573a Reviewed-on: https://chromium-review.googlesource.com/351224 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/charge_manager.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/common/charge_manager.c b/common/charge_manager.c
index 58f87819bd..69bda55a65 100644
--- a/common/charge_manager.c
+++ b/common/charge_manager.c
@@ -466,8 +466,14 @@ static void charge_manager_refresh(void)
board_set_active_charge_port(new_port) == EC_SUCCESS)
break;
- /* 'Dont charge' request must be accepted */
- ASSERT(new_port != CHARGE_PORT_NONE);
+ /*
+ * Allow 'Dont charge' request to be rejected only if it
+ * is our initial selection.
+ */
+ if (new_port == CHARGE_PORT_NONE) {
+ ASSERT(!active_charge_port_initialized);
+ return;
+ }
/*
* Zero the available charge on the rejected port so that