Reapply "mb/google/bluey: Implement EC-based off-mode detection"
This reverts commit b67725d3f5.
Reason: Warm reset issue is fixed in new QC blobs.
Change-Id: Iab1e0b7085f5d116704c54da4d286bb41b502853
Signed-off-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90542
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
a225eefd4c
commit
c4ee22e267
2 changed files with 25 additions and 17 deletions
|
|
@ -43,19 +43,3 @@ 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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,31 @@
|
|||
|
||||
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))
|
||||
|
|
@ -35,7 +60,6 @@ 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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue