From 34f67580b53bd5b2baedf3aaa1e9d2c7527ab9b9 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Thu, 19 Mar 2026 19:02:45 +0000 Subject: [PATCH] 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/91763 Reviewed-by: Kapil Porwal Tested-by: build bot (Jenkins) Reviewed-by: Caveh Jalali --- src/ec/google/chromeec/ec.c | 8 ++++++++ src/ec/google/chromeec/ec.h | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index 5b89dac265..688d0f5140 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -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. * +-----------+-----------------+------------------+---------------------------------+ diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h index aadd51ff22..787b05b6cd 100644 --- a/src/ec/google/chromeec/ec.h +++ b/src/ec/google/chromeec/ec.h @@ -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. *