diff options
author | Louis Yung-Chieh Lo <yjlou@chromium.org> | 2014-04-24 13:34:59 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-04-25 03:41:58 +0000 |
commit | 3ac560d41bf8c225725cdf03c2b4f4d723739d0f (patch) | |
tree | 687b9335e739ffd62ffe910742bd8a87e987537a /common/i2c.c | |
parent | b0409436adcf68cda3bf70a2964b9fdee599189a (diff) | |
download | chrome-ec-3ac560d41bf8c225725cdf03c2b4f4d723739d0f.tar.gz |
battery: don't talk to battery after cut-off
Add a shortcut in smart battery driver and i2c passthru. Once
the battery cut-off order is submitted (in the factory line),
the EC will no longer talk to battery.
BUG=chrome-os-partner:28248
BRANCH=tot,nyan
TEST=See below
> remove AC, cutoff: expect system is off.
> cutoff, then remove AC: expect system is off.
> cutoff, wait for 1 min, then remove AC: expect system is off.
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Change-Id: Ied963c19d17d581ce99e4543469cf2fa165f0439
Reviewed-on: https://chromium-review.googlesource.com/196657
Tested-by: Yung-chieh Lo <yjlou@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Yung-chieh Lo <yjlou@chromium.org>
Diffstat (limited to 'common/i2c.c')
-rw-r--r-- | common/i2c.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/common/i2c.c b/common/i2c.c index f5ce577aa2..8667bff1cf 100644 --- a/common/i2c.c +++ b/common/i2c.c @@ -5,6 +5,7 @@ /* I2C cross-platform code for Chrome EC */ +#include "battery.h" #include "clock.h" #include "console.h" #include "host_command.h" @@ -492,6 +493,14 @@ static int i2c_command_passthru(struct host_cmd_handler_args *args) return EC_RES_ACCESS_DENIED; #endif +#ifdef CONFIG_BATTERY_CUT_OFF + /* + * Some batteries would wake up after cut-off if we talk to it. + */ + if (battery_is_cut_off()) + return EC_RES_ACCESS_DENIED; +#endif + ret = check_i2c_params(args); if (ret) return ret; |