From 29cbe516631f15d548be1da101b6f04f692982d4 Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Tue, 7 Aug 2012 12:30:50 -0700 Subject: [PATCH] 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 Reviewed-on: https://gerrit.chromium.org/gerrit/29429 Reviewed-by: Bill Richardson --- common/charge_state.c | 1 + common/thermal.c | 1 + common/x86_power.c | 1 + include/ec_commands.h | 6 ++++++ 4 files changed, 9 insertions(+) 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