summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-03-05 10:14:24 -0800
committerRandall Spangler <rspangler@chromium.org>2012-03-05 10:14:24 -0800
commit0106129061e2437f6b460091ce41a32f63a2a85d (patch)
tree008b391f9d0cbe526dd087094710c4e088a320d2
parent42bfa2f5d47a0dc19bca289571c7215b71c34d2d (diff)
downloadchrome-ec-0106129061e2437f6b460091ce41a32f63a2a85d.tar.gz
Only send power button pulse on lid-open when main chipset is off
Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:8324 TEST=manual 1. When system is off, open lid. Debug console should show PB PCH pwrbtn activity. 2. Wait for system to boot. 3. Quickly close and open lid. Debug console should not show pwrbtn activity. Change-Id: Ia018ff06a31ac2a68f20021d17e47ddb06096eb8
-rw-r--r--board/bds/board.c10
-rw-r--r--chip/lm4/power_button.c8
-rw-r--r--common/keyboard.c2
3 files changed, 14 insertions, 6 deletions
diff --git a/board/bds/board.c b/board/bds/board.c
index 8fcb7f791e..fc66023c46 100644
--- a/board/bds/board.c
+++ b/board/bds/board.c
@@ -5,6 +5,7 @@
/* Stellaris EKB-LM4F-EAC board-specific configuration */
#include "board.h"
+#include "chipset.h"
#include "gpio.h"
#include "power_button.h"
#include "registers.h"
@@ -72,6 +73,15 @@ const struct gpio_info gpio_list[GPIO_COUNT] = {
};
+/* BDS system is only half-wired to an x86 chipset, so it can't tell what state
+ * the chipset is in. Rather than scatter ifdef's everywhere, put a mock
+ * chipset interface here. */
+int chipset_in_state(enum chipset_state in_state)
+{
+ return 1; /* Sure, I'm in whatever state you want. */
+}
+
+
void configure_board(void)
{
}
diff --git a/chip/lm4/power_button.c b/chip/lm4/power_button.c
index 82d2f21794..238ba2081f 100644
--- a/chip/lm4/power_button.c
+++ b/chip/lm4/power_button.c
@@ -5,6 +5,7 @@
/* Power button and lid switch module for Chrome EC */
+#include "chipset.h"
#include "console.h"
#include "gpio.h"
#include "keyboard.h"
@@ -133,10 +134,9 @@ static void lid_switch_changed(uint64_t tnow)
lpc_set_host_events(EC_LPC_HOST_EVENT_MASK((v ?
EC_LPC_HOST_EVENT_LID_OPEN : EC_LPC_HOST_EVENT_LID_CLOSED)));
- /* If the lid has opened, also send a power button pulse to the PCH.
- * We technically only need to send this when the main processor is in
- * S5, but it's not harmful to send at other times. */
- if (v) {
+ /* If the lid has opened and the chipset is is soft-off, send a power
+ * button pulse to wake up the chipset. */
+ if (v && chipset_in_state(CHIPSET_STATE_SOFT_OFF)) {
set_pwrbtn_to_pch(0);
pwrbtn_state = PWRBTN_STATE_STOPPING;
tnext_state = tnow + LID_PWRBTN_US;
diff --git a/common/keyboard.c b/common/keyboard.c
index cdfa23b473..e18a7603e9 100644
--- a/common/keyboard.c
+++ b/common/keyboard.c
@@ -542,11 +542,9 @@ void keyboard_set_power_button(int pressed)
power_button_pressed = pressed;
-#ifndef BOARD_bds
/* Only send the scan code if main chipset is fully awake */
if (!chipset_in_state(CHIPSET_STATE_ON))
return;
-#endif
code_set = acting_code_set(scancode_set);
ret = i8042_send_to_host(