diff options
author | Randall Spangler <rspangler@chromium.org> | 2013-10-01 10:34:59 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-10-02 01:24:40 +0000 |
commit | 0f1f1229b9062376e706509d5a04d237253fbb47 (patch) | |
tree | 34e4a8f9f61d81fec7edfe21f7c92ddf5c5875c2 | |
parent | 159867844af5c1860c5b6f49f61f8b9893f57c64 (diff) | |
download | chrome-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>
-rw-r--r-- | board/bolt/board.c | 17 | ||||
-rw-r--r-- | board/falco/board.c | 17 | ||||
-rw-r--r-- | board/link/board.c | 12 | ||||
-rw-r--r-- | board/peppy/board.c | 17 | ||||
-rw-r--r-- | board/rambi/board.c | 17 | ||||
-rw-r--r-- | board/samus/board.c | 17 | ||||
-rw-r--r-- | board/slippy/board.c | 17 | ||||
-rw-r--r-- | chip/lm4/lpc.c | 21 | ||||
-rw-r--r-- | include/host_command.h | 5 |
9 files changed, 18 insertions, 122 deletions
diff --git a/board/bolt/board.c b/board/bolt/board.c index bf59da6254..1de956c096 100644 --- a/board/bolt/board.c +++ b/board/bolt/board.c @@ -228,20 +228,3 @@ struct keyboard_scan_config keyscan_config = { 0xa4, 0xff, 0xf6, 0x55, 0xfa, 0xc8 /* full set */ }, }; - -/** - * Perform necessary actions on host wake events. - */ -void board_process_wake_events(uint32_t active_wake_events) -{ - uint32_t power_button_mask; - - power_button_mask = EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON); - - /* If there are other events aside from the power button press drive - * the wake pin. Otherwise ensure it is high. */ - if (active_wake_events & ~power_button_mask) - gpio_set_level(GPIO_PCH_WAKE_L, 0); - else - gpio_set_level(GPIO_PCH_WAKE_L, 1); -} diff --git a/board/falco/board.c b/board/falco/board.c index f682a8c11c..e60acb71d2 100644 --- a/board/falco/board.c +++ b/board/falco/board.c @@ -237,23 +237,6 @@ struct keyboard_scan_config keyscan_config = { }; /** - * Perform necessary actions on host wake events. - */ -void board_process_wake_events(uint32_t active_wake_events) -{ - uint32_t power_button_mask; - - power_button_mask = EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON); - - /* If there are other events aside from the power button press drive - * the wake pin. Otherwise ensure it is high. */ - if (active_wake_events & ~power_button_mask) - gpio_set_level(GPIO_PCH_WAKE_L, 0); - else - gpio_set_level(GPIO_PCH_WAKE_L, 1); -} - -/** * Discharge battery when on AC power for factory test. */ int board_discharge_on_ac(int enable) diff --git a/board/link/board.c b/board/link/board.c index 1207e63e0a..67284f2471 100644 --- a/board/link/board.c +++ b/board/link/board.c @@ -261,15 +261,3 @@ struct keyboard_scan_config keyscan_config = { 0xa4, 0xff, 0xf6, 0x55, 0xfa, 0xc8 /* full set */ }, }; - -/** - * Perform necessary actions on host events. - */ -void board_process_wake_events(uint32_t active_wake_events) -{ - /* Update level-sensitive wake signal */ - if (active_wake_events) - gpio_set_level(GPIO_PCH_WAKE_L, 0); - else - gpio_set_level(GPIO_PCH_WAKE_L, 1); -} diff --git a/board/peppy/board.c b/board/peppy/board.c index 8018b158e5..5092357f01 100644 --- a/board/peppy/board.c +++ b/board/peppy/board.c @@ -228,23 +228,6 @@ struct keyboard_scan_config keyscan_config = { }; /** - * Perform necessary actions on host wake events. - */ -void board_process_wake_events(uint32_t active_wake_events) -{ - uint32_t power_button_mask; - - power_button_mask = EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON); - - /* If there are other events aside from the power button press drive - * the wake pin. Otherwise ensure it is high. */ - if (active_wake_events & ~power_button_mask) - gpio_set_level(GPIO_PCH_WAKE_L, 0); - else - gpio_set_level(GPIO_PCH_WAKE_L, 1); -} - -/** * Discharge battery when on AC power for factory test. */ int board_discharge_on_ac(int enable) diff --git a/board/rambi/board.c b/board/rambi/board.c index 93d04940a7..6c451ebaea 100644 --- a/board/rambi/board.c +++ b/board/rambi/board.c @@ -186,20 +186,3 @@ struct ec_thermal_config thermal_params[] = { {{0, 0, 0}, 0, 0}, }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); - -/** - * Perform necessary actions on host wake events. - */ -void board_process_wake_events(uint32_t active_wake_events) -{ - uint32_t power_button_mask; - - power_button_mask = EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON); - - /* If there are other events aside from the power button press drive - * the wake pin. Otherwise ensure it is high. */ - if (active_wake_events & ~power_button_mask) - gpio_set_level(GPIO_PCH_WAKE_L, 0); - else - gpio_set_level(GPIO_PCH_WAKE_L, 1); -} diff --git a/board/samus/board.c b/board/samus/board.c index 6e1eeee9a3..219cd6abf7 100644 --- a/board/samus/board.c +++ b/board/samus/board.c @@ -228,20 +228,3 @@ struct keyboard_scan_config keyscan_config = { 0xa4, 0xff, 0xf6, 0x55, 0xfa, 0xc8 /* full set */ }, }; - -/** - * Perform necessary actions on host wake events. - */ -void board_process_wake_events(uint32_t active_wake_events) -{ - uint32_t power_button_mask; - - power_button_mask = EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON); - - /* If there are other events aside from the power button press drive - * the wake pin. Otherwise ensure it is high. */ - if (active_wake_events & ~power_button_mask) - gpio_set_level(GPIO_PCH_WAKE_L, 0); - else - gpio_set_level(GPIO_PCH_WAKE_L, 1); -} diff --git a/board/slippy/board.c b/board/slippy/board.c index 60851ceca9..bf8ec43dda 100644 --- a/board/slippy/board.c +++ b/board/slippy/board.c @@ -226,23 +226,6 @@ struct keyboard_scan_config keyscan_config = { }; /** - * Perform necessary actions on host wake events. - */ -void board_process_wake_events(uint32_t active_wake_events) -{ - uint32_t power_button_mask; - - power_button_mask = EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON); - - /* If there are other events aside from the power button press drive - * the wake pin. Otherwise ensure it is high. */ - if (active_wake_events & ~power_button_mask) - gpio_set_level(GPIO_PCH_WAKE_L, 0); - else - gpio_set_level(GPIO_PCH_WAKE_L, 1); -} - -/** * Discharge battery when on AC power for factory test. */ int board_discharge_on_ac(int enable) 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) diff --git a/include/host_command.h b/include/host_command.h index 96096bc699..158367a80b 100644 --- a/include/host_command.h +++ b/include/host_command.h @@ -162,11 +162,6 @@ void host_clear_events(uint32_t mask); uint32_t host_get_events(void); /** - * Perform necessary actions on host wake events. - */ -void board_process_wake_events(uint32_t active_wake_events); - -/** * Send a response to the relevent driver for transmission * * Once command processing is complete, this is used to send a response |