aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-11-01 18:52:19 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-11-01 18:52:19 -0500
commit9bb4064ca3bd771f8df88529a3578f9bb5243911 (patch)
treea148f0ff6ee2f5bb6d556ac7a39e30311862eafd /drivers/base
parent66c44877242d37873df2abb10e4fce26ff4fc9f9 (diff)
parentd439e64f22ce0eea681ae90c71f584d3a0145ded (diff)
Merge branch 'pm-sleep'
* pm-sleep: PM / hibernate: fix a comment typo input: i8042: Avoid resetting controller on system suspend/resume PM / PCI / ACPI: Kick devices that might have been reset by firmware PM / sleep: Add flags to indicate platform firmware involvement PM / sleep: Drop pm_request_idle() from pm_generic_complete() PCI / PM: Avoid resuming more devices during system suspend PM / wakeup: wakeup_source_create: use kstrdup_const PM / sleep: Report interrupt that caused system wakeup
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/power/generic_ops.c23
-rw-r--r--drivers/base/power/wakeup.c16
2 files changed, 34 insertions, 5 deletions
diff --git a/drivers/base/power/generic_ops.c b/drivers/base/power/generic_ops.c
index 96a92db83cad..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/**
@@ -296,11 +297,27 @@ void pm_generic_complete(struct device *dev)
296 297
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);
300}
299 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 */
311void pm_complete_with_resume_check(struct device *dev)
312{
313 pm_generic_complete(dev);
300 /* 314 /*
301 * Let runtime PM try to suspend devices that haven't been in use before 315 * If the device had been runtime-suspended before the system went into
302 * going into the system-wide sleep state we're resuming from. 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.
303 */ 318 */
304 pm_request_idle(dev); 319 if (dev->power.direct_complete && pm_resume_via_firmware())
320 pm_request_resume(dev);
305} 321}
322EXPORT_SYMBOL_GPL(pm_complete_with_resume_check);
306#endif /* CONFIG_PM_SLEEP */ 323#endif /* CONFIG_PM_SLEEP */
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
index 51f15bc15774..a1e0b9ab847a 100644
--- a/drivers/base/power/wakeup.c
+++ b/drivers/base/power/wakeup.c
@@ -25,6 +25,9 @@
25 */ 25 */
26bool events_check_enabled __read_mostly; 26bool events_check_enabled __read_mostly;
27 27
28/* First wakeup IRQ seen by the kernel in the last cycle. */
29unsigned int pm_wakeup_irq __read_mostly;
30
28/* If set and the system is suspending, terminate the suspend. */ 31/* If set and the system is suspending, terminate the suspend. */
29static bool pm_abort_suspend __read_mostly; 32static bool pm_abort_suspend __read_mostly;
30 33
@@ -91,7 +94,7 @@ struct wakeup_source *wakeup_source_create(const char *name)
91 if (!ws) 94 if (!ws)
92 return NULL; 95 return NULL;
93 96
94 wakeup_source_prepare(ws, name ? kstrdup(name, GFP_KERNEL) : NULL); 97 wakeup_source_prepare(ws, name ? kstrdup_const(name, GFP_KERNEL) : NULL);
95 return ws; 98 return ws;
96} 99}
97EXPORT_SYMBOL_GPL(wakeup_source_create); 100EXPORT_SYMBOL_GPL(wakeup_source_create);
@@ -154,7 +157,7 @@ void wakeup_source_destroy(struct wakeup_source *ws)
154 157
155 wakeup_source_drop(ws); 158 wakeup_source_drop(ws);
156 wakeup_source_record(ws); 159 wakeup_source_record(ws);
157 kfree(ws->name); 160 kfree_const(ws->name);
158 kfree(ws); 161 kfree(ws);
159} 162}
160EXPORT_SYMBOL_GPL(wakeup_source_destroy); 163EXPORT_SYMBOL_GPL(wakeup_source_destroy);
@@ -868,6 +871,15 @@ EXPORT_SYMBOL_GPL(pm_system_wakeup);
868void pm_wakeup_clear(void) 871void pm_wakeup_clear(void)
869{ 872{
870 pm_abort_suspend = false; 873 pm_abort_suspend = false;
874 pm_wakeup_irq = 0;
875}
876
877void pm_system_irq_wakeup(unsigned int irq_number)
878{
879 if (pm_wakeup_irq == 0) {
880 pm_wakeup_irq = irq_number;
881 pm_system_wakeup();
882 }
871} 883}
872 884
873/** 885/**