Shut down after EC software sync if lid is closed

So if the EC reboots when the lid is closed (for example, it wakes
from hibernate because the AC adapter was inserted), it won't leave
the AP powered on.

BUG=chrome-os-partner:11087
TEST=manual

   Reboot EC with lid closed ('reboot hard').
   Should finish software sync and shut down.
   Reboot EC with lid open. Boots.
   Hibernate EC and wake with lid open. Boots.
   Hibernate EC and wake with power button press. Boots.
   Reboot into recovery mode. Boots. Press power button; shuts down.
   Reboot into recovery mode. Boots. Close lid; shuts down.

CQ-DEPEND=*22578

Change-Id: I09d5331222aa10b73518f9f574ec5a32d8e6ac23
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28525
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
This commit is contained in:
Randall Spangler
2012-07-26 15:24:36 -07:00
committed by Gerrit
parent 584e0d2070
commit 0c32130a57

View File

@@ -422,12 +422,13 @@ VbError_t VbEcSoftwareSync(VbSharedDataHeader *shared) {
VBDEBUG(("VbEcSoftwareSync() in RO-Normal; EC-RO\n"));
/* TODO: If there was no wake event from the EC (such as power button or
* lid-open), shut down. The AP was powered on simply to verify the EC.
*
* Make sure this doesn't shut down when we're leaving recovery mode and
* jumping back to RW code, though. EC can't currently track that,
* though that could be passed as an additional reboot flag to the EC. */
/* If shutdown is requested, just power the AP back off. This covers the
* case where the lid is closed when then system boots. */
if (VbExIsShutdownRequested()) {
VBDEBUG(("VbEcSoftwareSync() sees shutdown-requested\n"));
return VBERROR_SHUTDOWN_REQUESTED;
}
return VBERROR_SUCCESS;
}
@@ -529,12 +530,15 @@ VbError_t VbEcSoftwareSync(VbSharedDataHeader *shared) {
return VBERROR_EC_REBOOT_TO_RO_REQUIRED;
}
/* TODO: If there was no wake event from the EC (such as power button or
* lid-open), shut down. The AP was powered on simply to verify the EC.
*
* Make sure this doesn't shut down when we're leaving recovery mode and
* jumping back to RW code, though. */
VBDEBUG(("VbEcSoftwareSync() in RW; done\n"));
/* If shutdown is requested, just power the AP back off. This covers the
* case where the lid is closed when then system boots. */
if (VbExIsShutdownRequested()) {
VBDEBUG(("VbEcSoftwareSync() sees shutdown-requested\n"));
return VBERROR_SHUTDOWN_REQUESTED;
}
return VBERROR_SUCCESS;
}