* [PATCH V2 0/3] PM / Domains: Add initial PM clock support to genpd @ 2014-11-27 14:51 Ulf Hansson 2014-11-27 14:51 ` [PATCH V2 1/3] PM / Domains: Initial PM clock support for genpd Ulf Hansson ` (2 more replies) 0 siblings, 3 replies; 6+ messages in thread From: Ulf Hansson @ 2014-11-27 14:51 UTC (permalink / raw) To: linux-arm-kernel Changes in v2: -Small fixes in patch 1. 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 patchset 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 patchsets 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. In patch 2 and patch 3, we convert some of the SH-MOBILE SOCs to start using the new PM clock support in genpd. Ulf Hansson (3): PM / Domains: Initial PM clock support for genpd ARM: shmobile: Convert to genpd flags for PM clocks for r8a7779 ARM: shmobile: Convert to genpd flags for PM clocks for R-mobile arch/arm/mach-shmobile/pm-r8a7779.c | 3 +-- arch/arm/mach-shmobile/pm-rmobile.c | 3 +-- drivers/base/power/domain.c | 7 +++++++ include/linux/pm_domain.h | 3 +++ 4 files changed, 12 insertions(+), 4 deletions(-) -- 1.9.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH V2 1/3] PM / Domains: Initial PM clock support for genpd 2014-11-27 14:51 [PATCH V2 0/3] PM / Domains: Add initial PM clock support to genpd Ulf Hansson @ 2014-11-27 14:51 ` Ulf Hansson 2014-11-28 0:05 ` Rafael J. Wysocki 2014-11-27 14:51 ` [PATCH V2 2/3] ARM: shmobile: Convert to genpd flags for PM clocks for r8a7779 Ulf Hansson 2014-11-27 14:51 ` [PATCH V2 3/3] ARM: shmobile: Convert to genpd flags for PM clocks for R-mobile Ulf Hansson 2 siblings, 1 reply; 6+ messages in thread From: Ulf Hansson @ 2014-11-27 14:51 UTC (permalink / raw) To: linux-arm-kernel 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 PM_DOMAIN_PM_CLK bit can then be set at initialization. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> --- Changes in v2: Set ->start() callback to pm_clk_resume() and fixed comment. --- drivers/base/power/domain.c | 7 +++++++ include/linux/pm_domain.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 735c473..42ba5a0 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -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> @@ -1928,6 +1929,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 & PM_DOMAIN_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); diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 8cbd32e..4ba06a4f 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -14,6 +14,7 @@ #include <linux/pm.h> #include <linux/err.h> #include <linux/of.h> +#include <linux/bitops.h> #include <linux/notifier.h> #include <linux/cpuidle.h> @@ -76,6 +77,8 @@ 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 */ +#define PM_DOMAIN_PM_CLK BIT(0) /* PM domain uses PM clk */ }; static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH V2 1/3] PM / Domains: Initial PM clock support for genpd 2014-11-27 14:51 ` [PATCH V2 1/3] PM / Domains: Initial PM clock support for genpd Ulf Hansson @ 2014-11-28 0:05 ` Rafael J. Wysocki 2014-11-28 7:26 ` Ulf Hansson 0 siblings, 1 reply; 6+ messages in thread From: Rafael J. Wysocki @ 2014-11-28 0:05 UTC (permalink / raw) To: linux-arm-kernel On Thursday, November 27, 2014 03:51:49 PM Ulf Hansson wrote: > 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 PM_DOMAIN_PM_CLK bit can then be set at initialization. > > Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> > --- > > Changes in v2: > Set ->start() callback to pm_clk_resume() and fixed comment. > > --- > drivers/base/power/domain.c | 7 +++++++ > include/linux/pm_domain.h | 3 +++ > 2 files changed, 10 insertions(+) > > diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c > index 735c473..42ba5a0 100644 > --- a/drivers/base/power/domain.c > +++ b/drivers/base/power/domain.c > @@ -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> > @@ -1928,6 +1929,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 & PM_DOMAIN_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); > diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h > index 8cbd32e..4ba06a4f 100644 > --- a/include/linux/pm_domain.h > +++ b/include/linux/pm_domain.h > @@ -14,6 +14,7 @@ > #include <linux/pm.h> > #include <linux/err.h> > #include <linux/of.h> > +#include <linux/bitops.h> > #include <linux/notifier.h> > #include <linux/cpuidle.h> If you defined the flag as #define PM_DOMAIN_FLAGS_PM_CLK (1U << 0) (which is a kind of usual way to do that), you wouldn't need the bitops.h above. Moreover, I personally don't like #defines in struct definitions. > > @@ -76,6 +77,8 @@ 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 */ > +#define PM_DOMAIN_PM_CLK BIT(0) /* PM domain uses PM clk */ > }; > > static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) > -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH V2 1/3] PM / Domains: Initial PM clock support for genpd 2014-11-28 0:05 ` Rafael J. Wysocki @ 2014-11-28 7:26 ` Ulf Hansson 0 siblings, 0 replies; 6+ messages in thread From: Ulf Hansson @ 2014-11-28 7:26 UTC (permalink / raw) To: linux-arm-kernel > > If you defined the flag as > > #define PM_DOMAIN_FLAGS_PM_CLK (1U << 0) > > (which is a kind of usual way to do that), you wouldn't need the > bitops.h above. > > Moreover, I personally don't like #defines in struct definitions. > >> >> @@ -76,6 +77,8 @@ 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 */ >> +#define PM_DOMAIN_PM_CLK BIT(0) /* PM domain uses PM clk */ While I fix your above comments, I wonder whether I actually also should change the prefix of the define as well. >From "PM_DOMAIN" to "GENPD". Cause I think it's a genpd specific define and not a "PM domain" define. Please tell me if you have any objections to that. >> }; >> >> static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) >> > > -- > I speak only for myself. > Rafael J. Wysocki, Intel Open Source Technology Center. Thanks for review! Kind regards Uffe ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH V2 2/3] ARM: shmobile: Convert to genpd flags for PM clocks for r8a7779 2014-11-27 14:51 [PATCH V2 0/3] PM / Domains: Add initial PM clock support to genpd Ulf Hansson 2014-11-27 14:51 ` [PATCH V2 1/3] PM / Domains: Initial PM clock support for genpd Ulf Hansson @ 2014-11-27 14:51 ` Ulf Hansson 2014-11-27 14:51 ` [PATCH V2 3/3] ARM: shmobile: Convert to genpd flags for PM clocks for R-mobile Ulf Hansson 2 siblings, 0 replies; 6+ messages in thread From: Ulf Hansson @ 2014-11-27 14:51 UTC (permalink / raw) To: linux-arm-kernel Instead of using the dev_ops ->stop|start() callbacks for genpd, let's convert to use genpd's flag field and set it to PM_DOMAIN_PM_CLK. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> --- Changes in v2: None. --- arch/arm/mach-shmobile/pm-r8a7779.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm/mach-shmobile/pm-r8a7779.c b/arch/arm/mach-shmobile/pm-r8a7779.c index 82fe3d7..6d1c011 100644 --- a/arch/arm/mach-shmobile/pm-r8a7779.c +++ b/arch/arm/mach-shmobile/pm-r8a7779.c @@ -83,9 +83,8 @@ static void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd) { struct generic_pm_domain *genpd = &r8a7779_pd->genpd; + genpd->flags = PM_DOMAIN_PM_CLK; pm_genpd_init(genpd, NULL, false); - genpd->dev_ops.stop = pm_clk_suspend; - genpd->dev_ops.start = pm_clk_resume; genpd->dev_ops.active_wakeup = pd_active_wakeup; genpd->power_off = pd_power_down; genpd->power_on = pd_power_up; -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH V2 3/3] ARM: shmobile: Convert to genpd flags for PM clocks for R-mobile 2014-11-27 14:51 [PATCH V2 0/3] PM / Domains: Add initial PM clock support to genpd Ulf Hansson 2014-11-27 14:51 ` [PATCH V2 1/3] PM / Domains: Initial PM clock support for genpd Ulf Hansson 2014-11-27 14:51 ` [PATCH V2 2/3] ARM: shmobile: Convert to genpd flags for PM clocks for r8a7779 Ulf Hansson @ 2014-11-27 14:51 ` Ulf Hansson 2 siblings, 0 replies; 6+ messages in thread From: Ulf Hansson @ 2014-11-27 14:51 UTC (permalink / raw) To: linux-arm-kernel Instead of using the dev_ops ->stop|start() callbacks for genpd, let's convert to use genpd's flag field and set it to PM_DOMAIN_PM_CLK. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> --- Changes in v2: None. --- arch/arm/mach-shmobile/pm-rmobile.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c index 717e641..42af9bd 100644 --- a/arch/arm/mach-shmobile/pm-rmobile.c +++ b/arch/arm/mach-shmobile/pm-rmobile.c @@ -106,9 +106,8 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd) struct generic_pm_domain *genpd = &rmobile_pd->genpd; struct dev_power_governor *gov = rmobile_pd->gov; + genpd->flags = PM_DOMAIN_PM_CLK; pm_genpd_init(genpd, gov ? : &simple_qos_governor, false); - genpd->dev_ops.stop = pm_clk_suspend; - genpd->dev_ops.start = pm_clk_resume; genpd->dev_ops.active_wakeup = rmobile_pd_active_wakeup; genpd->power_off = rmobile_pd_power_down; genpd->power_on = rmobile_pd_power_up; -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-11-28 7:26 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-11-27 14:51 [PATCH V2 0/3] PM / Domains: Add initial PM clock support to genpd Ulf Hansson 2014-11-27 14:51 ` [PATCH V2 1/3] PM / Domains: Initial PM clock support for genpd Ulf Hansson 2014-11-28 0:05 ` Rafael J. Wysocki 2014-11-28 7:26 ` Ulf Hansson 2014-11-27 14:51 ` [PATCH V2 2/3] ARM: shmobile: Convert to genpd flags for PM clocks for r8a7779 Ulf Hansson 2014-11-27 14:51 ` [PATCH V2 3/3] ARM: shmobile: Convert to genpd flags for PM clocks for R-mobile Ulf Hansson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).