Add host events for shutdown due to thermal or battery

BUG=chrome-os-partner:12353
TEST=hack the thermal monitoring and/or battery code to trigger a shutdown
then see that the events get set

Change-Id: I5ef2ac03cdd793ab0c50c0db518cba1ede3ea036
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/29429
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
This commit is contained in:
Randall Spangler
2012-08-07 12:30:50 -07:00
committed by Gerrit
parent a78bb5e560
commit 29cbe51663
4 changed files with 9 additions and 0 deletions

View File

@@ -105,6 +105,7 @@ static void poweroff_wait_ac(void)
*/
#ifdef CONFIG_TASK_X86POWER
x86_power_force_shutdown();
host_set_single_event(EC_HOST_EVENT_BATTERY_SHUTDOWN);
#endif /* CONFIG_TASK_X86POWER */
}
}

View File

@@ -110,6 +110,7 @@ static void overheated_action(void)
cprintf(CC_CHIPSET,
"[%T critical temperature; shutting down]\n");
x86_power_force_shutdown();
host_set_single_event(EC_HOST_EVENT_THERMAL_SHUTDOWN);
return;
}

View File

@@ -193,6 +193,7 @@ void x86_power_cpu_overheated(int too_hot)
if (overheat_count > 3) {
CPRINTF("[%T overheated; shutting down]\n");
x86_power_force_shutdown();
host_set_single_event(EC_HOST_EVENT_THERMAL_SHUTDOWN);
}
} else {
overheat_count = 0;

View File

@@ -217,6 +217,12 @@ enum host_event_code {
EC_HOST_EVENT_INTERFACE_READY = 14,
/* Keyboard recovery combo has been pressed */
EC_HOST_EVENT_KEYBOARD_RECOVERY = 15,
/* Shutdown due to thermal overload */
EC_HOST_EVENT_THERMAL_SHUTDOWN = 16,
/* Shutdown due to battery level too low */
EC_HOST_EVENT_BATTERY_SHUTDOWN = 17,
/*
* The high bit of the event mask is not used as a host event code. If
* it reads back as set, then the entire event mask should be