aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/device_pm.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-06-12 16:56:34 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-06-14 18:55:44 -0400
commit33e4f80ee69b5168badf37edbfed796eb48434b9 (patch)
tree004c10f12c53aa2fef2dd0229e645bf699610e21 /drivers/acpi/device_pm.c
parent63dada87f7ef7d4a536765c816fbbe7c4b9f3c85 (diff)
ACPI / PM: Ignore spurious SCI wakeups from suspend-to-idle
The ACPI SCI (System Control Interrupt) is set up as a wakeup IRQ during suspend-to-idle transitions and, consequently, any events signaled through it wake up the system from that state. However, on some systems some of the events signaled via the ACPI SCI while suspended to idle should not cause the system to wake up. In fact, quite often they should just be discarded. Arguably, systems should not resume entirely on such events, but in order to decide which events really should cause the system to resume and which are spurious, it is necessary to resume up to the point when ACPI SCIs are actually handled and processed, which is after executing dpm_resume_noirq() in the system resume path. For this reasons, add a loop around freeze_enter() in which the platforms can process events signaled via multiplexed IRQ lines like the ACPI SCI and add suspend-to-idle hooks that can be used for this purpose to struct platform_freeze_ops. In the ACPI case, the ->wake hook is used for checking if the SCI has triggered while suspended and deferring the interrupt-induced system wakeup until the events signaled through it are actually processed sufficiently to decide whether or not the system should resume. In turn, the ->sync hook allows all of the relevant event queues to be flushed so as to prevent events from being missed due to race conditions. In addition to that, some ACPI code processing wakeup events needs to be modified to use the "hard" version of wakeup triggers, so that it will cause a system resume to happen on device-induced wakeup events even if the "soft" mechanism to prevent the system from suspending is not enabled. However, to preserve the existing behavior with respect to suspend-to-RAM, this only is done in the suspend-to-idle case and only if an SCI has occurred while suspended. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/device_pm.c')
-rw-r--r--drivers/acpi/device_pm.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
index f13c62c4b117..ca0210213773 100644
--- a/drivers/acpi/device_pm.c
+++ b/drivers/acpi/device_pm.c
@@ -24,6 +24,7 @@
24#include <linux/pm_qos.h> 24#include <linux/pm_qos.h>
25#include <linux/pm_domain.h> 25#include <linux/pm_domain.h>
26#include <linux/pm_runtime.h> 26#include <linux/pm_runtime.h>
27#include <linux/suspend.h>
27 28
28#include "internal.h" 29#include "internal.h"
29 30
@@ -385,6 +386,12 @@ EXPORT_SYMBOL(acpi_bus_power_manageable);
385#ifdef CONFIG_PM 386#ifdef CONFIG_PM
386static DEFINE_MUTEX(acpi_pm_notifier_lock); 387static DEFINE_MUTEX(acpi_pm_notifier_lock);
387 388
389void acpi_pm_wakeup_event(struct device *dev)
390{
391 pm_wakeup_dev_event(dev, 0, acpi_s2idle_wakeup());
392}
393EXPORT_SYMBOL_GPL(acpi_pm_wakeup_event);
394
388static void acpi_pm_notify_handler(acpi_handle handle, u32 val, void *not_used) 395static void acpi_pm_notify_handler(acpi_handle handle, u32 val, void *not_used)
389{ 396{
390 struct acpi_device *adev; 397 struct acpi_device *adev;
@@ -399,7 +406,7 @@ static void acpi_pm_notify_handler(acpi_handle handle, u32 val, void *not_used)
399 mutex_lock(&acpi_pm_notifier_lock); 406 mutex_lock(&acpi_pm_notifier_lock);
400 407
401 if (adev->wakeup.flags.notifier_present) { 408 if (adev->wakeup.flags.notifier_present) {
402 __pm_wakeup_event(adev->wakeup.ws, 0); 409 pm_wakeup_ws_event(adev->wakeup.ws, 0, acpi_s2idle_wakeup());
403 if (adev->wakeup.context.func) 410 if (adev->wakeup.context.func)
404 adev->wakeup.context.func(&adev->wakeup.context); 411 adev->wakeup.context.func(&adev->wakeup.context);
405 } 412 }