Skip to content

Commit 607b9df

Browse files
committed
ACPI: EC: PM: Avoid flushing EC work when EC GPE is inactive
Flushing the EC work while suspended to idle when the EC GPE status is not set causes some EC wakeup events (notably power button and lid ones) to be missed after a series of spurious wakeups on the Dell XPS13 9360 in my office. If that happens, the machine cannot be woken up from suspend-to-idle by the power button or lid status change and it needs to be woken up in some other way (eg. by a key press). Flushing the EC work only after successful dispatching the EC GPE, which means that its status has been set, avoids the issue, so change the code in question accordingly. Fixes: 7b30175 ("ACPI: EC: PM: Avoid premature returns from acpi_s2idle_wake()") Cc: 5.4+ <[email protected]> # 5.4+ Signed-off-by: Rafael J. Wysocki <[email protected]> Tested-by: Chris Chiu <[email protected]>
1 parent 7b30175 commit 607b9df

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

drivers/acpi/ec.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2016,9 +2016,13 @@ bool acpi_ec_dispatch_gpe(void)
20162016
* to allow the caller to process events properly after that.
20172017
*/
20182018
ret = acpi_dispatch_gpe(NULL, first_ec->gpe);
2019-
if (ret == ACPI_INTERRUPT_HANDLED)
2019+
if (ret == ACPI_INTERRUPT_HANDLED) {
20202020
pm_pr_dbg("EC GPE dispatched\n");
20212021

2022+
/* Flush the event and query workqueues. */
2023+
acpi_ec_flush_work();
2024+
}
2025+
20222026
return false;
20232027
}
20242028
#endif /* CONFIG_PM_SLEEP */

drivers/acpi/sleep.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -980,13 +980,6 @@ static int acpi_s2idle_prepare_late(void)
980980
return 0;
981981
}
982982

983-
static void acpi_s2idle_sync(void)
984-
{
985-
/* The EC driver uses special workqueues that need to be flushed. */
986-
acpi_ec_flush_work();
987-
acpi_os_wait_events_complete(); /* synchronize Notify handling */
988-
}
989-
990983
static bool acpi_s2idle_wake(void)
991984
{
992985
if (!acpi_sci_irq_valid())
@@ -1018,16 +1011,15 @@ static bool acpi_s2idle_wake(void)
10181011
return true;
10191012

10201013
/*
1021-
* Cancel the wakeup and process all pending events in case
1014+
* Cancel the SCI wakeup and process all pending events in case
10221015
* there are any wakeup ones in there.
10231016
*
10241017
* Note that if any non-EC GPEs are active at this point, the
10251018
* SCI will retrigger after the rearming below, so no events
10261019
* should be missed by canceling the wakeup here.
10271020
*/
10281021
pm_system_cancel_wakeup();
1029-
1030-
acpi_s2idle_sync();
1022+
acpi_os_wait_events_complete();
10311023

10321024
/*
10331025
* The SCI is in the "suspended" state now and it cannot produce
@@ -1060,7 +1052,8 @@ static void acpi_s2idle_restore(void)
10601052
* of GPEs.
10611053
*/
10621054
acpi_os_wait_events_complete(); /* synchronize GPE processing */
1063-
acpi_s2idle_sync();
1055+
acpi_ec_flush_work(); /* flush the EC driver's workqueues */
1056+
acpi_os_wait_events_complete(); /* synchronize Notify handling */
10641057

10651058
s2idle_wakeup = false;
10661059

0 commit comments

Comments
 (0)