diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-10-06 18:50:24 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-10-13 20:17:34 -0400 |
commit | 58a1fbbb2ee873dd1fe327e80bc7b08e80866269 (patch) | |
tree | 3c3552e6631af82c4afb3f449ae8042bc925bf53 /drivers/base/power/generic_ops.c | |
parent | ef25ba0476015908ef5960f9faac149ddf34ede0 (diff) |
PM / PCI / ACPI: Kick devices that might have been reset by firmware
There is a concern that if the platform firmware was involved in
the system resume that's being completed, some devices might have
been reset by it and if those devices had the power.direct_complete
flag set during the preceding suspend transition, they may stay
in a reset-power-on state indefinitely (until they are runtime-resumed
and then suspended again). That may not be a big deal from the
individual device's perspective, but if the system is an SoC, it may
be prevented from entering deep SoC-wide low-power states on idle
because of that.
The devices that are most likely to be affected by this issue are
PCI devices and ACPI-enumerated devices using the general ACPI PM
domain, so to prevent it from happening for those devices, force a
runtime resume for them if they have their power.direct_complete
flags set and the platform firmware was involved in the resume
transition currently in progress.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base/power/generic_ops.c')
-rw-r--r-- | drivers/base/power/generic_ops.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/base/power/generic_ops.c b/drivers/base/power/generic_ops.c index b2ed606265a8..07c3c4a9522d 100644 --- a/drivers/base/power/generic_ops.c +++ b/drivers/base/power/generic_ops.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/pm.h> | 9 | #include <linux/pm.h> |
10 | #include <linux/pm_runtime.h> | 10 | #include <linux/pm_runtime.h> |
11 | #include <linux/export.h> | 11 | #include <linux/export.h> |
12 | #include <linux/suspend.h> | ||
12 | 13 | ||
13 | #ifdef CONFIG_PM | 14 | #ifdef CONFIG_PM |
14 | /** | 15 | /** |
@@ -297,4 +298,26 @@ void pm_generic_complete(struct device *dev) | |||
297 | if (drv && drv->pm && drv->pm->complete) | 298 | if (drv && drv->pm && drv->pm->complete) |
298 | drv->pm->complete(dev); | 299 | drv->pm->complete(dev); |
299 | } | 300 | } |
301 | |||
302 | /** | ||
303 | * pm_complete_with_resume_check - Complete a device power transition. | ||
304 | * @dev: Device to handle. | ||
305 | * | ||
306 | * Complete a device power transition during a system-wide power transition and | ||
307 | * optionally schedule a runtime resume of the device if the system resume in | ||
308 | * progress has been initated by the platform firmware and the device had its | ||
309 | * power.direct_complete flag set. | ||
310 | */ | ||
311 | void pm_complete_with_resume_check(struct device *dev) | ||
312 | { | ||
313 | pm_generic_complete(dev); | ||
314 | /* | ||
315 | * If the device had been runtime-suspended before the system went into | ||
316 | * the sleep state it is going out of and it has never been resumed till | ||
317 | * now, resume it in case the firmware powered it up. | ||
318 | */ | ||
319 | if (dev->power.direct_complete && pm_resume_via_firmware()) | ||
320 | pm_request_resume(dev); | ||
321 | } | ||
322 | EXPORT_SYMBOL_GPL(pm_complete_with_resume_check); | ||
300 | #endif /* CONFIG_PM_SLEEP */ | 323 | #endif /* CONFIG_PM_SLEEP */ |