summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/mkbp_event.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/common/mkbp_event.c b/common/mkbp_event.c
index b499789e04..71ce7f8a05 100644
--- a/common/mkbp_event.c
+++ b/common/mkbp_event.c
@@ -201,7 +201,10 @@ static inline int host_is_sleeping(void)
static void force_mkbp_if_events(void);
DECLARE_DEFERRED(force_mkbp_if_events);
-static void activate_mkbp_with_events(uint32_t events_to_add)
+/*
+ * Send events to AP, return true if succeeded to generate host interrupt.
+ */
+static bool activate_mkbp_with_events(uint32_t events_to_add)
{
int interrupt_id = -1;
int skip_interrupt = 0;
@@ -243,7 +246,7 @@ static void activate_mkbp_with_events(uint32_t events_to_add)
/* If we don't need to send an interrupt we are done */
if (interrupt_id < 0)
- return;
+ return false;
/* Send a rising edge MKBP interrupt */
rv = mkbp_set_host_active(1, &mkbp_last_event_time);
@@ -266,6 +269,8 @@ static void activate_mkbp_with_events(uint32_t events_to_add)
if (rv != EC_SUCCESS)
CPRINTS("Could not activate MKBP (%d). Deferring", rv);
}
+
+ return rv == EC_SUCCESS;
}
/*
@@ -338,9 +343,7 @@ static void force_mkbp_if_events(void)
test_mockable int mkbp_send_event(uint8_t event_type)
{
- activate_mkbp_with_events(BIT(event_type));
-
- return 1;
+ return activate_mkbp_with_events(BIT(event_type));
}
static int set_inactive_if_no_events(void)