ec/google/chromeec: Add API to check for RTC host event

Add `google_chromeec_is_rtc_event()` to allow the AP to check if the
EC has posted an `EC_HOST_EVENT_RTC`. This is useful for identifying
wake-up or boot reasons triggered by the real-time clock.

BUG=b:493760057
BRANCH=none
TEST=Build and boot on a board using ChromeEC; verify the API
correctly detects RTC events.

Change-Id: Id62cb6942a5881932eec420c78389e9d78b1e7a9
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/91763
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Caveh Jalali <caveh@chromium.org>
This commit is contained in:
Subrata Banik 2026-03-19 19:02:45 +00:00
commit 34f67580b5
2 changed files with 16 additions and 0 deletions

View file

@ -1186,6 +1186,14 @@ bool google_chromeec_is_charger_present(void)
EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_CONNECTED));
}
/* This API checks if RTC event. */
bool google_chromeec_is_rtc_event(void)
{
/* Check if the Chrome EC has an active RTC event. */
return !!(google_chromeec_get_events_b() &
EC_HOST_EVENT_MASK(EC_HOST_EVENT_RTC));
}
/*
* Using below scenarios to conclude if device has a barrel charger attached.
* +-----------+-----------------+------------------+---------------------------------+

View file

@ -158,6 +158,14 @@ bool google_chromeec_is_usb_pd_attached(void);
*/
bool google_chromeec_is_charger_present(void);
/**
* Check if the Chrome EC has an active RTC event.
*
* @return true: if the RTC event is present
* false: if the RTC event is not present
*/
bool google_chromeec_is_rtc_event(void);
/**
* Check if barrel charger is present.
*