From b67725d3f51c141b9ee3c4ad9c16cafd38a54e44 Mon Sep 17 00:00:00 2001 From: Kapil Porwal Date: Wed, 17 Dec 2025 15:12:36 +0530 Subject: [PATCH] Revert "mb/google/bluey: Implement EC-based off-mode detection" This reverts commit 42c1947d9904d303bf17e937b94d1d2929b3af33. Reason: It breaks warm reboot flow. Change-Id: Id3662c70853a4bbb14870d2d0225396f66ea5dee Signed-off-by: Kapil Porwal Reviewed-on: https://review.coreboot.org/c/coreboot/+/90540 Reviewed-by: Jayvik Desai Tested-by: build bot (Jenkins) Reviewed-by: Pranava Y N Reviewed-by: Subrata Banik --- src/mainboard/google/bluey/charging.c | 16 ++++++++++++++++ src/mainboard/google/bluey/romstage.c | 26 +------------------------- 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/src/mainboard/google/bluey/charging.c b/src/mainboard/google/bluey/charging.c index bbb849d438..56deedcdb9 100644 --- a/src/mainboard/google/bluey/charging.c +++ b/src/mainboard/google/bluey/charging.c @@ -43,3 +43,19 @@ void disable_slow_battery_charging(void) spmi_write8(SMB1_CHGR_CHRG_EN_CMD, CHRG_DISABLE); spmi_write8(SMB2_CHGR_CHRG_EN_CMD, CHRG_DISABLE); } + +/* + * is_off_mode - Check if the system is booting due to an off-mode power event. + * + * This function provides the board-level policy wrapper for detecting if the + * system power-on was triggered by an external charging event (e.g., cable + * insertion). This is typically used to enter LB_BOOT_MODE_OFFMODE_CHARGING. + * + * @return true if the system was triggered by a specific off-mode reason + * (e.g., charging cable insertion). + * @return false otherwise. + */ +bool is_off_mode(void) +{ + return is_pon_on_ac(); +} diff --git a/src/mainboard/google/bluey/romstage.c b/src/mainboard/google/bluey/romstage.c index 657c7ad177..c2cbf5b7c4 100644 --- a/src/mainboard/google/bluey/romstage.c +++ b/src/mainboard/google/bluey/romstage.c @@ -14,31 +14,6 @@ static enum boot_mode_t boot_mode = LB_BOOT_MODE_NORMAL; -/* - * is_off_mode - Check if the system is booting due to an off-mode power event. - * - * This function provides the board-level policy wrapper for detecting if the - * system power-on was triggered by an external charging event (e.g., cable - * insertion). This is typically used to enter LB_BOOT_MODE_OFFMODE_CHARGING. - * - * @return true if the system was triggered by a specific off-mode reason - * (e.g., charging cable insertion). - * @return false otherwise. - */ -bool is_off_mode(void) -{ - const uint64_t manual_pwron_event_mask = - (EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON) | - EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN)); - uint64_t ec_events = google_chromeec_get_events_b(); - - if (!(ec_events & manual_pwron_event_mask) && - (ec_events & EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_CONNECTED))) - return true; - - return false; -} - static void set_boot_mode(void) { if (!CONFIG(EC_GOOGLE_CHROMEEC)) @@ -60,6 +35,7 @@ void platform_romstage_main(void) /* QCLib: DDR init & train */ qclib_load_and_run(); + /* Underlying PMIC registers are accessible only at this point */ set_boot_mode(); aop_fw_load_reset();