summaryrefslogtreecommitdiff
path: root/chip
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-10-01 10:34:59 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-10-02 01:24:40 +0000
commit0f1f1229b9062376e706509d5a04d237253fbb47 (patch)
tree34e4a8f9f61d81fec7edfe21f7c92ddf5c5875c2 /chip
parent159867844af5c1860c5b6f49f61f8b9893f57c64 (diff)
downloadchrome-ec-0f1f1229b9062376e706509d5a04d237253fbb47.tar.gz
lpc: Clean up processing wake events
Every board other than link does the same thing - filter out the power button event, then set the WAKE_L gpio level based on the remaining events. This code doesn't need to be duplicated 7 times, so make it common. Link didn't filter out the power button wake signal, but works fine with the common implementation. Like the other boards it gets a power button wake event via the dedicated PCH PWRBTN# signal. BUG=chrome-os-partner:18343 BRANCH=none TEST=suspend link, then wake using power button press compile all platforms; pass unit tests Change-Id: Ib3a6d310d0f5e337374b3c331ab2872fe377bdf6 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/171405 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r--chip/lm4/lpc.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/chip/lm4/lpc.c b/chip/lm4/lpc.c
index 9d0a53162f..db4e4e0067 100644
--- a/chip/lm4/lpc.c
+++ b/chip/lm4/lpc.c
@@ -149,6 +149,23 @@ static void lpc_generate_sci(void)
host_events & event_mask[LPC_HOST_EVENT_SCI]);
}
+/**
+ * Update the level-sensitive wake signal to the AP.
+ *
+ * @param wake_events Currently asserted wake events
+ */
+static void lpc_update_wake(uint32_t wake_events)
+{
+ /*
+ * Mask off power button event, since the AP gets that through a
+ * separate dedicated GPIO.
+ */
+ wake_events &= ~EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON);
+
+ /* Signal is asserted low when wake events is non-zero */
+ gpio_set_level(GPIO_PCH_WAKE_L, !wake_events);
+}
+
uint8_t *lpc_get_memmap_range(void)
{
return (uint8_t *)LPC_POOL_MEMMAP;
@@ -296,7 +313,6 @@ void lpc_comx_put_char(int c)
static void update_host_event_status(void) {
int need_sci = 0;
int need_smi = 0;
- uint32_t active_wake_events;
if (!init_done)
return;
@@ -325,8 +341,7 @@ static void update_host_event_status(void) {
task_enable_irq(LM4_IRQ_LPC);
/* Process the wake events. */
- active_wake_events = host_events & event_mask[LPC_HOST_EVENT_WAKE];
- board_process_wake_events(active_wake_events);
+ lpc_update_wake(host_events & event_mask[LPC_HOST_EVENT_WAKE]);
/* Send pulse on SMI signal if needed */
if (need_smi)