diff options
author | Randall Spangler <rspangler@chromium.org> | 2013-02-28 12:51:24 -0800 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-03-05 10:26:20 -0800 |
commit | 70cdf52ea1aec0681372a21bc41308a1e4ad20e4 (patch) | |
tree | 4740adeee5f6a3368be4d8fa6ea2e8ce53c37b9a /common | |
parent | 1866d471f496a4b6905332199f870cc45b7f2515 (diff) | |
download | chrome-ec-70cdf52ea1aec0681372a21bc41308a1e4ad20e4.tar.gz |
Wait to power on system until battery state is known
This prevents the system from waking from hibernate at very low
battery, then powering on the AP to do software sync only to find that
the charge state machine shuts down the AP before software sync can
complete.
BUG=chrome-os-partner:17124
BRANCH=link
TEST=manual
On both AC and mostly-charged battery:
- With lid open, reboot EC -> on
- With lid open, reboot EC with power held down -> on
- With lid closed, reboot EC -> system boots and does EC software sync
- With system on -> battfake 2 shuts system down
(and at that point, opening lid or pressing power does nothing)
With a hacked charge_state.c so fake_state_of_charge starts at 2:
- With lid open or closed, reboot EC -> off
- Opening lid does not turn on system
- Pressing power button does not turn on system
- Plug power back in and press power -> system turns on
Change-Id: Ie1f2933060fac87b1afe68718f374d51cb8994de
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44313
Diffstat (limited to 'common')
-rw-r--r-- | common/charge_state.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/common/charge_state.c b/common/charge_state.c index 2ab00a68f2..e13f8969ce 100644 --- a/common/charge_state.c +++ b/common/charge_state.c @@ -683,6 +683,14 @@ void charge_state_machine_task(void) state_name[new_state]); } + /* + * After first init, wake the switch task so it can + * power on the AP if necessary. + */ + if (ctx->prev.state == PWR_STATE_INIT && + new_state != PWR_STATE_INIT) + task_wake(TASK_ID_SWITCH); + switch (new_state) { case PWR_STATE_IDLE0: /* |