summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-08-07 12:30:50 -0700
committerGerrit <chrome-bot@google.com>2012-08-07 13:30:49 -0700
commit29cbe516631f15d548be1da101b6f04f692982d4 (patch)
tree978169e7c41a99df5d3899abc267bf76c47a359f
parenta78bb5e560dbb68ae67855d1e2eb642b979e498a (diff)
downloadchrome-ec-29cbe516631f15d548be1da101b6f04f692982d4.tar.gz
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>
-rw-r--r--common/charge_state.c1
-rw-r--r--common/thermal.c1
-rw-r--r--common/x86_power.c1
-rw-r--r--include/ec_commands.h6
4 files changed, 9 insertions, 0 deletions
diff --git a/common/charge_state.c b/common/charge_state.c
index f1e99eb022..d43e5a9fa5 100644
--- a/common/charge_state.c
+++ b/common/charge_state.c
@@ -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 */
}
}
diff --git a/common/thermal.c b/common/thermal.c
index 344279c0b3..3f570be058 100644
--- a/common/thermal.c
+++ b/common/thermal.c
@@ -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;
}
diff --git a/common/x86_power.c b/common/x86_power.c
index c58617c788..28592a8383 100644
--- a/common/x86_power.c
+++ b/common/x86_power.c
@@ -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;
diff --git a/include/ec_commands.h b/include/ec_commands.h
index c94fed5c96..0b3f388289 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -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