aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pm_domain.h
diff options
context:
space:
mode:
authorLina Iyer <lina.iyer@linaro.org>2016-10-14 10:47:55 -0700
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-10-21 22:20:56 +0200
commitd716f4798ff8c65ace4a6ab291f9a4ff265df4ba (patch)
treeac3d04985805e3628e2a0dd2cd30457af9e21122 /include/linux/pm_domain.h
parentPM / Domains: Abstract genpd locking (diff)
downloadlinux-dev-d716f4798ff8c65ace4a6ab291f9a4ff265df4ba.tar.xz
linux-dev-d716f4798ff8c65ace4a6ab291f9a4ff265df4ba.zip
PM / Domains: Support IRQ safe PM domains
Generic Power Domains currently support turning on/off only in process context. This prevents the usage of PM domains for domains that could be powered on/off in a context where IRQs are disabled. Many such domains exist today and do not get powered off, when the IRQ safe devices in that domain are powered off, because of this limitation. However, not all domains can operate in IRQ safe contexts. Genpd therefore, has to support both cases where the domain may or may not operate in IRQ safe contexts. Configuring genpd to use an appropriate lock for that domain, would allow domains that have IRQ safe devices to runtime suspend and resume, in atomic context. To achieve domain specific locking, set the domain's ->flag to GENPD_FLAG_IRQ_SAFE while defining the domain. This indicates that genpd should use a spinlock instead of a mutex for locking the domain. Locking is abstracted through genpd_lock() and genpd_unlock() functions that use the flag to determine the appropriate lock to be used for that domain. Domains that have lower latency to suspend and resume and can operate with IRQs disabled may now be able to save power, when the component devices and sub-domains are idle at runtime. The restriction this imposes on the domain hierarchy is that non-IRQ safe domains may not have IRQ-safe subdomains, but IRQ safe domains may have IRQ safe and non-IRQ safe subdomains and devices. Signed-off-by: Lina Iyer <lina.iyer@linaro.org> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> Reviewed-by: Kevin Hilman <khilman@baylibre.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/linux/pm_domain.h')
-rw-r--r--include/linux/pm_domain.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 811b968eb740..81ece61075df 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -15,9 +15,11 @@
#include <linux/err.h>
#include <linux/of.h>
#include <linux/notifier.h>
+#include <linux/spinlock.h>
/* Defines used for the flags field in the struct generic_pm_domain */
#define GENPD_FLAG_PM_CLK (1U << 0) /* PM domain uses PM clk */
+#define GENPD_FLAG_IRQ_SAFE (1U << 1) /* PM domain operates in atomic */
enum gpd_status {
GPD_STATE_ACTIVE = 0, /* PM domain is active */
@@ -76,7 +78,13 @@ struct generic_pm_domain {
unsigned int state_idx; /* state that genpd will go to when off */
void *free; /* Free the state that was allocated for default */
const struct genpd_lock_ops *lock_ops;
- struct mutex mlock;
+ union {
+ struct mutex mlock;
+ struct {
+ spinlock_t slock;
+ unsigned long lock_flags;
+ };
+ };
};