Commit d4f2d87a authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

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: default avatarRafael J. Wysocki <rjw@sisk.pl>
Acked-by: default avatarKevin Hilman <khilman@ti.com>
parent 596ba34b
...@@ -450,6 +450,10 @@ static int pm_genpd_suspend_noirq(struct device *dev) ...@@ -450,6 +450,10 @@ static int pm_genpd_suspend_noirq(struct device *dev)
if (ret) if (ret)
return ret; return ret;
if (device_may_wakeup(dev)
&& genpd->active_wakeup && genpd->active_wakeup(dev))
return 0;
if (genpd->stop_device) if (genpd->stop_device)
genpd->stop_device(dev); genpd->stop_device(dev);
...@@ -670,6 +674,10 @@ static int pm_genpd_dev_poweroff_noirq(struct device *dev) ...@@ -670,6 +674,10 @@ static int pm_genpd_dev_poweroff_noirq(struct device *dev)
if (ret) if (ret)
return ret; return ret;
if (device_may_wakeup(dev)
&& genpd->active_wakeup && genpd->active_wakeup(dev))
return 0;
if (genpd->stop_device) if (genpd->stop_device)
genpd->stop_device(dev); genpd->stop_device(dev);
......
...@@ -38,6 +38,7 @@ struct generic_pm_domain { ...@@ -38,6 +38,7 @@ struct generic_pm_domain {
int (*power_on)(struct generic_pm_domain *domain); int (*power_on)(struct generic_pm_domain *domain);
int (*start_device)(struct device *dev); int (*start_device)(struct device *dev);
int (*stop_device)(struct device *dev); int (*stop_device)(struct device *dev);
bool (*active_wakeup)(struct device *dev);
}; };
static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment