aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2014-12-01 06:50:21 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-12-03 18:44:44 -0500
commitc11f6f5bb1e07db79c4c97d768b32b63378c69e0 (patch)
tree071d91217be2b6f0b41e868be4b85d0f311212b2
parent2ed127697eb1376645cbcfa08a13dda157233c9d (diff)
PM / Domains: Initial PM clock support for genpd
It's quite common for PM domains to use PM clocks. Typically from SOC specific code, the per device PM clock list is created and pm_clk_suspend|resume() are invoked to handle clock gating/ungating. A step towards consolidation is to integrate PM clock support into genpd, which is what this patch does. In this initial step, the calls to the pm_clk_suspend|resume() are handled within genpd, but the per device PM clock list still needs to be created from SOC specific code. It seems reasonable to have gendp to handle that as well, but that left to future patches to address. It's not every users of genpd that are keen on using PM clocks, thus we need to provide this a configuration option for genpd. Therefore let's add flag field in the genpd struct to keep this information and define a new GENDP_FLAG_PM_CLK bit for it. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Kevin Hilman <khilman@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/base/power/domain.c7
-rw-r--r--include/linux/pm_domain.h4
2 files changed, 11 insertions, 0 deletions
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 1bfb54ce60e8..5d7b7548873a 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -12,6 +12,7 @@
12#include <linux/pm_runtime.h> 12#include <linux/pm_runtime.h>
13#include <linux/pm_domain.h> 13#include <linux/pm_domain.h>
14#include <linux/pm_qos.h> 14#include <linux/pm_qos.h>
15#include <linux/pm_clock.h>
15#include <linux/slab.h> 16#include <linux/slab.h>
16#include <linux/err.h> 17#include <linux/err.h>
17#include <linux/sched.h> 18#include <linux/sched.h>
@@ -1948,6 +1949,12 @@ void pm_genpd_init(struct generic_pm_domain *genpd,
1948 genpd->domain.ops.complete = pm_genpd_complete; 1949 genpd->domain.ops.complete = pm_genpd_complete;
1949 genpd->dev_ops.save_state = pm_genpd_default_save_state; 1950 genpd->dev_ops.save_state = pm_genpd_default_save_state;
1950 genpd->dev_ops.restore_state = pm_genpd_default_restore_state; 1951 genpd->dev_ops.restore_state = pm_genpd_default_restore_state;
1952
1953 if (genpd->flags & GENPD_FLAG_PM_CLK) {
1954 genpd->dev_ops.stop = pm_clk_suspend;
1955 genpd->dev_ops.start = pm_clk_resume;
1956 }
1957
1951 mutex_lock(&gpd_list_lock); 1958 mutex_lock(&gpd_list_lock);
1952 list_add(&genpd->gpd_list_node, &gpd_list); 1959 list_add(&genpd->gpd_list_node, &gpd_list);
1953 mutex_unlock(&gpd_list_lock); 1960 mutex_unlock(&gpd_list_lock);
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 9d254e25f866..1dd6c7f64166 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -17,6 +17,9 @@
17#include <linux/notifier.h> 17#include <linux/notifier.h>
18#include <linux/cpuidle.h> 18#include <linux/cpuidle.h>
19 19
20/* Defines used for the flags field in the struct generic_pm_domain */
21#define GENPD_FLAG_PM_CLK (1U << 0) /* PM domain uses PM clk */
22
20enum gpd_status { 23enum gpd_status {
21 GPD_STATE_ACTIVE = 0, /* PM domain is active */ 24 GPD_STATE_ACTIVE = 0, /* PM domain is active */
22 GPD_STATE_WAIT_MASTER, /* PM domain's master is being waited for */ 25 GPD_STATE_WAIT_MASTER, /* PM domain's master is being waited for */
@@ -76,6 +79,7 @@ struct generic_pm_domain {
76 struct device *dev); 79 struct device *dev);
77 void (*detach_dev)(struct generic_pm_domain *domain, 80 void (*detach_dev)(struct generic_pm_domain *domain,
78 struct device *dev); 81 struct device *dev);
82 unsigned int flags; /* Bit field of configs for genpd */
79}; 83};
80 84
81static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) 85static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)