diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2017-12-22 10:56:01 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-01-04 21:52:00 -0800 |
commit | 41af1bf27c0e983523a055d2567bc15e7814e289 (patch) | |
tree | d16f1c101c2f8658ec1998127fbe93c4f7258dc8 /common | |
parent | 113602c06e2fac46ca7d29433bb2a62864c633c5 (diff) | |
download | chrome-ec-41af1bf27c0e983523a055d2567bc15e7814e289.tar.gz |
wand: Make sure battery is cut-off when critical
Modify chipset_in_state to always say that the chipset is off,
when we do not actually have a chipset (like on hammer): that
makes sure the battery can actually be cut off (else the EC
would just wait forever for the chipset to turn off).
Also, wake the charger state on "AC" change, that is, when
charging_allowed changes state, to make sure the charging loop
is executed after lux tries to charge it (else the charging loop
would wait until timeout expires, and wand would ask the battery
to be cut off again).
BRANCH=none
BUG=b:65697962
TEST=Deplete wand battery, reboot without providing external power
to it.
After 30 seconds, battery is cut off:
[1.354683 Low battery: 2%, 6866mV]
[1.354888 charge warn shutdown due to critical battery]
[31.381410 Low battery: 2%, 6865mV]
[31.381643 charge force battery cut-off due to critical level]
TEST=Upon providing power to wand, charging loop is executed
regularly, and battery is charging.
Change-Id: I7154b25bd852b8422a0ae3b506675a297a948132
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/842742
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/ec_ec_comm_slave.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/common/ec_ec_comm_slave.c b/common/ec_ec_comm_slave.c index 608e1edc4f..ae753274a5 100644 --- a/common/ec_ec_comm_slave.c +++ b/common/ec_ec_comm_slave.c @@ -14,6 +14,7 @@ #include "ec_ec_comm_slave.h" #include "extpower.h" #include "hwtimer.h" +#include "hooks.h" #include "queue.h" #include "queue_policies.h" #include "task.h" @@ -134,6 +135,7 @@ static void handle_cmd_charger_control( int data_len, int seq) { int ret = EC_RES_SUCCESS; + int prev_charging_allowed = charging_allowed; if (data_len != sizeof(*params)) { ret = EC_RES_INVALID_COMMAND; @@ -161,6 +163,9 @@ static void handle_cmd_charger_control( charging_allowed = 0; } + if (prev_charging_allowed != charging_allowed) + hook_notify(HOOK_AC_CHANGE); + out: write_response(ret, seq, NULL, 0); } |