aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2011-07-01 16:13:29 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2011-07-02 08:29:56 -0400
commitd4f2d87a8b46c14c4307c690c92bd08229f66ecf (patch)
tree6560c88f024f9972936cfd4dabc1685e00baee8b
parent596ba34bcd2978ee9823cc1d84df230576f8ffb9 (diff)
PM / Domains: Wakeup devices support for system sleep transitions
There is the problem how to handle devices set up to wake up the system from sleep states during system-wide power transitions. In some cases, those devices can be turned off entirely, because the wakeup signals will be generated on their behalf anyway. In some other cases, they will generate wakeup signals if their clocks are stopped, but only if power is not removed from them. Finally, in some cases, they can only generate wakeup signals if power is not removed from them and their clocks are enabled. To allow platform-specific code to decide whether or not to put wakeup devices (and their PM domains) into low-power state during system-wide transitions, such as system suspend, introduce a new generic PM domain callback, .active_wakeup(), that will be used during the "noirq" phase of system suspend and hibernation (after image creation) to decide what to do with wakeup devices. Specifically, if this callback is present and returns "true", the generic PM domain code will not execute .stop_device() for the given wakeup device and its PM domain won't be powered off. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Kevin Hilman <khilman@ti.com>
-rw-r--r--drivers/base/power/domain.c8
-rw-r--r--include/linux/pm_domain.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 33086e9afaf6..1aed94c73cfc 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -450,6 +450,10 @@ static int pm_genpd_suspend_noirq(struct device *dev)
450 if (ret) 450 if (ret)
451 return ret; 451 return ret;
452 452
453 if (device_may_wakeup(dev)
454 && genpd->active_wakeup && genpd->active_wakeup(dev))
455 return 0;
456
453 if (genpd->stop_device) 457 if (genpd->stop_device)
454 genpd->stop_device(dev); 458 genpd->stop_device(dev);
455 459
@@ -670,6 +674,10 @@ static int pm_genpd_dev_poweroff_noirq(struct device *dev)
670 if (ret) 674 if (ret)
671 return ret; 675 return ret;
672 676
677 if (device_may_wakeup(dev)
678 && genpd->active_wakeup && genpd->active_wakeup(dev))
679 return 0;
680
673 if (genpd->stop_device) 681 if (genpd->stop_device)
674 genpd->stop_device(dev); 682 genpd->stop_device(dev);
675 683
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 7961b0dac437..98491ee35102 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -38,6 +38,7 @@ struct generic_pm_domain {
38 int (*power_on)(struct generic_pm_domain *domain); 38 int (*power_on)(struct generic_pm_domain *domain);
39 int (*start_device)(struct device *dev); 39 int (*start_device)(struct device *dev);
40 int (*stop_device)(struct device *dev); 40 int (*stop_device)(struct device *dev);
41 bool (*active_wakeup)(struct device *dev);
41}; 42};
42 43
43static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) 44static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)