mkpb: Add MKBP support over ACPI

Add a host event to support MKPB:
When sent, the ACPI code will send a notification to the kernel
cros-ec-lpcs driver that will issue EC_CMD_GET_NEXT_EVENT.
We can allow code (sensor stack for instance) that uses MKBP to work
on ACPI based architecture.

Obviously, host event over MKPB is not supported.

BRANCH=none
BUG=b:27849483
TEST=Check we get sensor events on Cyan through the sensor ring.
(cyan branch)

Change-Id: Iadc9c852b410cf69ef15bcbbb1b086c36687c687
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/353634
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Gwendal Grignou
2016-05-02 16:50:27 -07:00
committed by chrome-bot
parent 9ceaa9d8e0
commit 00aef53a7b
4 changed files with 21 additions and 7 deletions

View File

@@ -51,11 +51,13 @@ void host_set_events(uint32_t mask)
lpc_set_host_event_state(events);
#else
*(uint32_t *)host_get_memmap(EC_MEMMAP_HOST_EVENTS) = events;
#endif
#ifdef CONFIG_MKBP_EVENT
mkbp_send_event(EC_MKBP_EVENT_HOST_EVENT);
#ifdef CONFIG_MKBP_USE_HOST_EVENT
#error "Config error: MKBP must not be on top of host event"
#endif
mkbp_send_event(EC_MKBP_EVENT_HOST_EVENT);
#endif /* CONFIG_MKBP_EVENT */
#endif /* !CONFIG_LPC */
}
void host_clear_events(uint32_t mask)
@@ -70,11 +72,10 @@ void host_clear_events(uint32_t mask)
lpc_set_host_event_state(events);
#else
*(uint32_t *)host_get_memmap(EC_MEMMAP_HOST_EVENTS) = events;
#endif
#ifdef CONFIG_MKBP_EVENT
mkbp_send_event(EC_MKBP_EVENT_HOST_EVENT);
#endif
#endif /* !CONFIG_LPC */
}
static int host_get_next_event(uint8_t *out)

View File

@@ -36,7 +36,12 @@ static int event_is_set(uint8_t event_type)
static void set_host_interrupt(int active)
{
/* interrupt host by using active low EC_INT signal */
#ifdef CONFIG_MKBP_USE_HOST_EVENT
if (active)
host_set_single_event(EC_HOST_EVENT_MKBP);
#else
gpio_set_level(GPIO_EC_INT_L, !active);
#endif
}
void mkbp_send_event(uint8_t event_type)

View File

@@ -1395,6 +1395,9 @@
/* Support MKBP event */
#undef CONFIG_MKBP_EVENT
/* MKBP events are sent using host event */
#undef CONFIG_MKBP_USE_HOST_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.

View File

@@ -437,6 +437,9 @@ enum host_event_code {
/* EC RTC event occurred */
EC_HOST_EVENT_RTC = 26,
/* Emulate MKBP event */
EC_HOST_EVENT_MKBP = 27,
/*
* The high bit of the event mask is not used as a host event code. If
* it reads back as set, then the entire event mask should be
@@ -3198,8 +3201,10 @@ struct ec_params_entering_mode {
#define VBOOT_MODE_RECOVERY 2
/*****************************************************************************/
/* I2C passthru protection command: Protects I2C tunnels against access on
* certain addresses (board-specific). */
/*
* I2C passthru protection command: Protects I2C tunnels against access on
* certain addresses (board-specific).
*/
#define EC_CMD_I2C_PASSTHRU_PROTECT 0xb7
enum ec_i2c_passthru_protect_subcmd {