aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-11-18 09:35:00 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-11-26 19:20:59 -0500
commitdb68daff90ef79761cc0bba16f775b6027ea3a83 (patch)
treeba7d8d3af71a6d1a080fa4b6246c8cdf367ee4a9
parentbd755d770ac78e8eeda05877ba66cc66f151e10e (diff)
ACPI / PM: Support for LEAVE_SUSPENDED driver flag in ACPI PM domain
Add support for DPM_FLAG_LEAVE_SUSPENDED to the ACPI PM domain by making it (a) set the power.may_skip_resume status bit for devices that, from its perspective, may be left in suspend after system wakeup from sleep and (b) return early from acpi_subsys_resume_noirq() for devices whose remaining resume callbacks during the transition under way are going to be skipped by the PM core. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/acpi/device_pm.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
index e4ffaeec9ec2..5cfe794c36bd 100644
--- a/drivers/acpi/device_pm.c
+++ b/drivers/acpi/device_pm.c
@@ -990,7 +990,7 @@ void acpi_subsys_complete(struct device *dev)
990 * the sleep state it is going out of and it has never been resumed till 990 * the sleep state it is going out of and it has never been resumed till
991 * now, resume it in case the firmware powered it up. 991 * now, resume it in case the firmware powered it up.
992 */ 992 */
993 if (dev->power.direct_complete && pm_resume_via_firmware()) 993 if (pm_runtime_suspended(dev) && pm_resume_via_firmware())
994 pm_request_resume(dev); 994 pm_request_resume(dev);
995} 995}
996EXPORT_SYMBOL_GPL(acpi_subsys_complete); 996EXPORT_SYMBOL_GPL(acpi_subsys_complete);
@@ -1039,10 +1039,28 @@ EXPORT_SYMBOL_GPL(acpi_subsys_suspend_late);
1039 */ 1039 */
1040int acpi_subsys_suspend_noirq(struct device *dev) 1040int acpi_subsys_suspend_noirq(struct device *dev)
1041{ 1041{
1042 if (dev_pm_smart_suspend_and_suspended(dev)) 1042 int ret;
1043
1044 if (dev_pm_smart_suspend_and_suspended(dev)) {
1045 dev->power.may_skip_resume = true;
1043 return 0; 1046 return 0;
1047 }
1048
1049 ret = pm_generic_suspend_noirq(dev);
1050 if (ret)
1051 return ret;
1052
1053 /*
1054 * If the target system sleep state is suspend-to-idle, it is sufficient
1055 * to check whether or not the device's wakeup settings are good for
1056 * runtime PM. Otherwise, the pm_resume_via_firmware() check will cause
1057 * acpi_subsys_complete() to take care of fixing up the device's state
1058 * anyway, if need be.
1059 */
1060 dev->power.may_skip_resume = device_may_wakeup(dev) ||
1061 !device_can_wakeup(dev);
1044 1062
1045 return pm_generic_suspend_noirq(dev); 1063 return 0;
1046} 1064}
1047EXPORT_SYMBOL_GPL(acpi_subsys_suspend_noirq); 1065EXPORT_SYMBOL_GPL(acpi_subsys_suspend_noirq);
1048 1066
@@ -1052,6 +1070,9 @@ EXPORT_SYMBOL_GPL(acpi_subsys_suspend_noirq);
1052 */ 1070 */
1053int acpi_subsys_resume_noirq(struct device *dev) 1071int acpi_subsys_resume_noirq(struct device *dev)
1054{ 1072{
1073 if (dev_pm_may_skip_resume(dev))
1074 return 0;
1075
1055 /* 1076 /*
1056 * Devices with DPM_FLAG_SMART_SUSPEND may be left in runtime suspend 1077 * Devices with DPM_FLAG_SMART_SUSPEND may be left in runtime suspend
1057 * during system suspend, so update their runtime PM status to "active" 1078 * during system suspend, so update their runtime PM status to "active"