diff options
author | Dave Parker <dparker@chromium.org> | 2013-08-01 20:30:31 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-08-02 12:16:44 -0700 |
commit | 0d3bdc690e7ab3ed0ab190b0529e95c2bbba4e7e (patch) | |
tree | 975065727f925e447ba9ac0132a944c8733fb00a /common | |
parent | 33f8086c90b8ecc3289c4c144103eb5c6dc0eea8 (diff) | |
download | chrome-ec-0d3bdc690e7ab3ed0ab190b0529e95c2bbba4e7e.tar.gz |
Falco: Stop charging after a timeout of 10 hours
BUG=chrome-os-partner:20145
BRANCH=falco
TEST=Hack it. Add (uint64_t)599 * MINUTE to ctx->curr.ts.val
in the timeout comparison. This makes the 10 hour timeout only
take 1 minute. Testing this directly is tricky as a healthy battery
will charge quickly. If you force it to trickle charge it will
give up before 10 hours pass.
Change-Id: I69094a07e58c2d65e322ddc6a1b2ced828da0e26
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64309
Diffstat (limited to 'common')
-rw-r--r-- | common/charge_state.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/common/charge_state.c b/common/charge_state.c index f7a644bfe3..f425bb6509 100644 --- a/common/charge_state.c +++ b/common/charge_state.c @@ -631,6 +631,16 @@ void charger_task(void) while (1) { state_common(ctx); +#ifdef CONFIG_CHARGER_TIMEOUT_HOURS + if (ctx->curr.state == PWR_STATE_CHARGE && + ctx->power_state_updated_time.val + + CONFIG_CHARGER_TIMEOUT_HOURS * HOUR < ctx->curr.ts.val) { + CPRINTF("[%T Charge timed out after %d hours]\n", + CONFIG_CHARGER_TIMEOUT_HOURS); + charge_force_idle(1); + } +#endif /* CONFIG_CHARGER_TIMEOUT_HOURS */ + switch (ctx->prev.state) { case PWR_STATE_INIT: case PWR_STATE_REINIT: |