diff options
Diffstat (limited to 'drivers/acpi/sleep.c')
-rw-r--r-- | drivers/acpi/sleep.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index a4327af676fe..e84005d642e6 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -662,14 +662,40 @@ static int acpi_freeze_prepare(void) | |||
662 | acpi_os_wait_events_complete(); | 662 | acpi_os_wait_events_complete(); |
663 | if (acpi_sci_irq_valid()) | 663 | if (acpi_sci_irq_valid()) |
664 | enable_irq_wake(acpi_sci_irq); | 664 | enable_irq_wake(acpi_sci_irq); |
665 | |||
665 | return 0; | 666 | return 0; |
666 | } | 667 | } |
667 | 668 | ||
669 | static void acpi_freeze_wake(void) | ||
670 | { | ||
671 | /* | ||
672 | * If IRQD_WAKEUP_ARMED is not set for the SCI at this point, it means | ||
673 | * that the SCI has triggered while suspended, so cancel the wakeup in | ||
674 | * case it has not been a wakeup event (the GPEs will be checked later). | ||
675 | */ | ||
676 | if (acpi_sci_irq_valid() && | ||
677 | !irqd_is_wakeup_armed(irq_get_irq_data(acpi_sci_irq))) | ||
678 | pm_system_cancel_wakeup(); | ||
679 | } | ||
680 | |||
681 | static void acpi_freeze_sync(void) | ||
682 | { | ||
683 | /* | ||
684 | * Process all pending events in case there are any wakeup ones. | ||
685 | * | ||
686 | * The EC driver uses the system workqueue, so that one needs to be | ||
687 | * flushed too. | ||
688 | */ | ||
689 | acpi_os_wait_events_complete(); | ||
690 | flush_scheduled_work(); | ||
691 | } | ||
692 | |||
668 | static void acpi_freeze_restore(void) | 693 | static void acpi_freeze_restore(void) |
669 | { | 694 | { |
670 | acpi_disable_wakeup_devices(ACPI_STATE_S0); | 695 | acpi_disable_wakeup_devices(ACPI_STATE_S0); |
671 | if (acpi_sci_irq_valid()) | 696 | if (acpi_sci_irq_valid()) |
672 | disable_irq_wake(acpi_sci_irq); | 697 | disable_irq_wake(acpi_sci_irq); |
698 | |||
673 | acpi_enable_all_runtime_gpes(); | 699 | acpi_enable_all_runtime_gpes(); |
674 | } | 700 | } |
675 | 701 | ||
@@ -681,6 +707,8 @@ static void acpi_freeze_end(void) | |||
681 | static const struct platform_freeze_ops acpi_freeze_ops = { | 707 | static const struct platform_freeze_ops acpi_freeze_ops = { |
682 | .begin = acpi_freeze_begin, | 708 | .begin = acpi_freeze_begin, |
683 | .prepare = acpi_freeze_prepare, | 709 | .prepare = acpi_freeze_prepare, |
710 | .wake = acpi_freeze_wake, | ||
711 | .sync = acpi_freeze_sync, | ||
684 | .restore = acpi_freeze_restore, | 712 | .restore = acpi_freeze_restore, |
685 | .end = acpi_freeze_end, | 713 | .end = acpi_freeze_end, |
686 | }; | 714 | }; |