mkbp_event: prevent AC power change events to wakeup AP.

It may use MKBP event to send PD power change events to AP via interrupt.
According to the spec, AC power change events do not be allowed to
wake up AP. In order to avoid it, define a white list in board level,
only allow those events to wakeup the AP during S3 power state.

BRANCH=none
BUG=chrome-os-partner:45127
TEST=manual
Plug PD power adapter to oak, if system is in S3/S5 and it should
starts charging, but should not wake up system/AP at all.

Change-Id: I2f86697d5d3bd24d7de840e21064b91e8841f0eb
Signed-off-by: Ben Lok <ben.lok@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/300360
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Ben Lok
2015-09-17 13:31:51 +08:00
committed by chrome-bot
parent 1c2bbee5c7
commit 0596b551df
3 changed files with 33 additions and 0 deletions

View File

@@ -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 {

View File

@@ -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);
}

View File

@@ -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