diff options
-rw-r--r-- | board/falco/board.c | 18 | ||||
-rw-r--r-- | board/link/board.c | 12 | ||||
-rw-r--r-- | board/peppy/board.c | 18 | ||||
-rw-r--r-- | board/slippy/board.c | 18 | ||||
-rw-r--r-- | chip/lm4/lpc.c | 9 | ||||
-rw-r--r-- | include/host_command.h | 5 |
6 files changed, 75 insertions, 5 deletions
diff --git a/board/falco/board.c b/board/falco/board.c index 0aaadfde80..a7049c5221 100644 --- a/board/falco/board.c +++ b/board/falco/board.c @@ -11,6 +11,7 @@ #include "ec_commands.h" #include "extpower.h" #include "gpio.h" +#include "host_command.h" #include "i2c.h" #include "keyboard_scan.h" #include "lid_switch.h" @@ -179,3 +180,20 @@ void board_enable_wireless(uint8_t enabled) gpio_set_level(GPIO_PP3300_LTE_EN, enabled & EC_WIRELESS_SWITCH_WWAN); } + +/** + * 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/link/board.c b/board/link/board.c index c0a4dd5108..4a5e3ea999 100644 --- a/board/link/board.c +++ b/board/link/board.c @@ -215,3 +215,15 @@ void board_enable_wireless(uint8_t enabled) gpio_set_level(GPIO_RADIO_ENABLE_BT, enabled & EC_WIRELESS_SWITCH_BLUETOOTH); } + +/** + * 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 ed1f5b48b4..9eaf17f718 100644 --- a/board/peppy/board.c +++ b/board/peppy/board.c @@ -11,6 +11,7 @@ #include "ec_commands.h" #include "extpower.h" #include "gpio.h" +#include "host_command.h" #include "i2c.h" #include "keyboard_scan.h" #include "lid_switch.h" @@ -185,3 +186,20 @@ void board_enable_wireless(uint8_t enabled) gpio_set_level(GPIO_PP3300_LTE_EN, enabled & EC_WIRELESS_SWITCH_WWAN); } + +/** + * 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 3abd7c9f49..3bfd0ef6e3 100644 --- a/board/slippy/board.c +++ b/board/slippy/board.c @@ -11,6 +11,7 @@ #include "ec_commands.h" #include "extpower.h" #include "gpio.h" +#include "host_command.h" #include "i2c.h" #include "keyboard_scan.h" #include "lid_switch.h" @@ -182,3 +183,20 @@ void board_enable_wireless(uint8_t enabled) gpio_set_level(GPIO_PP3300_LTE_EN, enabled & EC_WIRELESS_SWITCH_WWAN); } + +/** + * 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/chip/lm4/lpc.c b/chip/lm4/lpc.c index 00dd23285c..005853a71a 100644 --- a/chip/lm4/lpc.c +++ b/chip/lm4/lpc.c @@ -284,6 +284,7 @@ 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; @@ -311,11 +312,9 @@ static void update_host_event_status(void) { task_enable_irq(LM4_IRQ_LPC); - /* Update level-sensitive wake signal */ - if (host_events & event_mask[LPC_HOST_EVENT_WAKE]) - gpio_set_level(GPIO_PCH_WAKE_L, 0); - else - gpio_set_level(GPIO_PCH_WAKE_L, 1); + /* Process the wake events. */ + active_wake_events = host_events & event_mask[LPC_HOST_EVENT_WAKE]; + board_process_wake_events(active_wake_events); /* Send pulse on SMI signal if needed */ if (need_smi) diff --git a/include/host_command.h b/include/host_command.h index b7d70896ce..91ea579ef6 100644 --- a/include/host_command.h +++ b/include/host_command.h @@ -115,6 +115,11 @@ 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 |