diff options
-rw-r--r-- | board/oak/board.h | 9 | ||||
-rw-r--r-- | common/mkbp_event.c | 18 | ||||
-rw-r--r-- | include/config.h | 6 |
3 files changed, 33 insertions, 0 deletions
diff --git a/board/oak/board.h b/board/oak/board.h index d2a26f272e..e578b8a5ee 100644 --- a/board/oak/board.h +++ b/board/oak/board.h @@ -128,6 +128,15 @@ #define TIM_CLOCK32 2 #define TIM_WATCHDOG 4 +/* Define the MKBP events which are allowed to wakeup AP in S3. */ +#define CONFIG_MKBP_WAKEUP_MASK \ + (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_CLOSED) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEY_PRESSED) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_FASTBOOT)) + #include "gpio_signal.h" enum power_signal { diff --git a/common/mkbp_event.c b/common/mkbp_event.c index c8b8d3bced..4e965a9d05 100644 --- a/common/mkbp_event.c +++ b/common/mkbp_event.c @@ -6,6 +6,7 @@ */ #include "atomic.h" +#include "chipset.h" #include "gpio.h" #include "host_command.h" #include "link_defs.h" @@ -41,6 +42,23 @@ static void set_host_interrupt(int active) void mkbp_send_event(uint8_t event_type) { set_event(event_type); + +#ifdef CONFIG_MKBP_WAKEUP_MASK + /* checking the event if AP suspended */ + if (chipset_in_state(CHIPSET_STATE_SUSPEND)) { + uint32_t events; + events = *(uint32_t *)host_get_memmap(EC_MEMMAP_HOST_EVENTS); + /* + * interrupt the AP if it is a wakeup event + * which is defined in the white list. + */ + if (events & CONFIG_MKBP_WAKEUP_MASK) + set_host_interrupt(1); + + return; + } +#endif + set_host_interrupt(1); } diff --git a/include/config.h b/include/config.h index dd54cd23c8..63548f7bf7 100644 --- a/include/config.h +++ b/include/config.h @@ -1295,6 +1295,12 @@ /* Support MKBP event */ #undef CONFIG_MKBP_EVENT +/* + * With this option, we can define the MKBP wakeup events in this mask (as a + * white list) in board level, those events allow to interrupt AP during S3. + */ +#undef CONFIG_MKBP_WAKEUP_MASK + /* Support memory protection unit (MPU) */ #undef CONFIG_MPU |