ec/google/chromeec/smi: Clear events before enabling wake mask

On some older platforms (eg, google/link), setting the wake mask
before clearing the pending events will result in an immediate
wake from S3 sleep, so swap the ordering to ensure that doesn't
happen.

TEST=build/boot google/link, verify S3 sleep works properly.

Change-Id: I483dcfabd37a1f55fd0e56eed895f5b813f018d7
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87576
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
Reviewed-by: Caveh Jalali <caveh@chromium.org>
This commit is contained in:
Matt DeVillier 2025-05-08 10:59:25 -05:00
commit 0121d0e3e0

View file

@ -61,6 +61,13 @@ void chromeec_set_usb_charge_mode(int slp_type)
void chromeec_smi_sleep(int slp_type, uint64_t s3_mask, uint64_t s5_mask)
{
/* Disable SCI and SMI events */
google_chromeec_set_smi_mask(0);
google_chromeec_set_sci_mask(0);
/* Clear pending events that may trigger immediate wake */
clear_pending_events();
if (!google_chromeec_is_uhepi_supported()) {
switch (slp_type) {
case ACPI_S3:
@ -74,13 +81,6 @@ void chromeec_smi_sleep(int slp_type, uint64_t s3_mask, uint64_t s5_mask)
break;
}
}
/* Disable SCI and SMI events */
google_chromeec_set_smi_mask(0);
google_chromeec_set_sci_mask(0);
/* Clear pending events that may trigger immediate wake */
clear_pending_events();
}
void chromeec_smi_device_event_sleep(int slp_type, uint64_t s3_mask,