Commit f492de9d authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull power management fix from Rafael Wysocki:
 "Prevent the suspend-to-idle internal loop from busy spinning after a
  spurious ACPI SCI wakeup in some cases"

* tag 'pm-5.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  ACPI: EC: PM: Avoid premature returns from acpi_s2idle_wake()
parents 24085f70 7b301750
Loading
Loading
Loading
Loading
+16 −8
Original line number Diff line number Diff line
@@ -1994,23 +1994,31 @@ void acpi_ec_set_gpe_wake_mask(u8 action)
		acpi_set_gpe_wake_mask(NULL, first_ec->gpe, action);
}

bool acpi_ec_other_gpes_active(void)
{
	return acpi_any_gpe_status_set(first_ec ? first_ec->gpe : U32_MAX);
}

bool acpi_ec_dispatch_gpe(void)
{
	u32 ret;

	if (!first_ec)
		return acpi_any_gpe_status_set(U32_MAX);

	/*
	 * Report wakeup if the status bit is set for any enabled GPE other
	 * than the EC one.
	 */
	if (acpi_any_gpe_status_set(first_ec->gpe))
		return true;

	if (ec_no_wakeup)
		return false;

	/*
	 * Dispatch the EC GPE in-band, but do not report wakeup in any case
	 * to allow the caller to process events properly after that.
	 */
	ret = acpi_dispatch_gpe(NULL, first_ec->gpe);
	if (ret == ACPI_INTERRUPT_HANDLED) {
	if (ret == ACPI_INTERRUPT_HANDLED)
		pm_pr_dbg("EC GPE dispatched\n");
		return true;
	}

	return false;
}
#endif /* CONFIG_PM_SLEEP */
+0 −1
Original line number Diff line number Diff line
@@ -202,7 +202,6 @@ void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit);

#ifdef CONFIG_PM_SLEEP
void acpi_ec_flush_work(void);
bool acpi_ec_other_gpes_active(void);
bool acpi_ec_dispatch_gpe(void);
#endif

+2 −12
Original line number Diff line number Diff line
@@ -1013,20 +1013,10 @@ static bool acpi_s2idle_wake(void)
		if (acpi_check_wakeup_handlers())
			return true;

		/*
		 * If the status bit is set for any enabled GPE other than the
		 * EC one, the wakeup is regarded as a genuine one.
		 */
		if (acpi_ec_other_gpes_active())
		/* Check non-EC GPE wakeups and dispatch the EC GPE. */
		if (acpi_ec_dispatch_gpe())
			return true;

		/*
		 * If the EC GPE status bit has not been set, the wakeup is
		 * regarded as a spurious one.
		 */
		if (!acpi_ec_dispatch_gpe())
			return false;

		/*
		 * Cancel the wakeup and process all pending events in case
		 * there are any wakeup ones in there.