PM / Domains: Initial PM clock support for genpd
authorUlf Hansson <ulf.hansson@linaro.org>
Mon, 1 Dec 2014 11:50:21 +0000 (12:50 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 3 Dec 2014 23:44:44 +0000 (00:44 +0100)
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>
drivers/base/power/domain.c
include/linux/pm_domain.h

index 1bfb54ce60e88c620c8e9d03da5929eaff977e03..5d7b7548873a1a068de2ba5216b0f6bdd8633a17 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/pm_runtime.h>
 #include <linux/pm_domain.h>
 #include <linux/pm_qos.h>
+#include <linux/pm_clock.h>
 #include <linux/slab.h>
 #include <linux/err.h>
 #include <linux/sched.h>
@@ -1948,6 +1949,12 @@ void pm_genpd_init(struct generic_pm_domain *genpd,
        genpd->domain.ops.complete = pm_genpd_complete;
        genpd->dev_ops.save_state = pm_genpd_default_save_state;
        genpd->dev_ops.restore_state = pm_genpd_default_restore_state;
+
+       if (genpd->flags & GENPD_FLAG_PM_CLK) {
+               genpd->dev_ops.stop = pm_clk_suspend;
+               genpd->dev_ops.start = pm_clk_resume;
+       }
+
        mutex_lock(&gpd_list_lock);
        list_add(&genpd->gpd_list_node, &gpd_list);
        mutex_unlock(&gpd_list_lock);
index 9d254e25f86643e6a802427e6cde2861ce8dd5e9..1dd6c7f641668d961b4cbe1560e3cef37b2d4a7b 100644 (file)
@@ -17,6 +17,9 @@
 #include <linux/notifier.h>
 #include <linux/cpuidle.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 */
+
 enum gpd_status {
        GPD_STATE_ACTIVE = 0,   /* PM domain is active */
        GPD_STATE_WAIT_MASTER,  /* PM domain's master is being waited for */
@@ -76,6 +79,7 @@ struct generic_pm_domain {
                          struct device *dev);
        void (*detach_dev)(struct generic_pm_domain *domain,
                           struct device *dev);
+       unsigned int flags;             /* Bit field of configs for genpd */
 };
 
 static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)
This page took 0.027666 seconds and 5 git commands to generate.