* [PATCH v5 0/2] Allow imx6qp PU domain off in suspend
@ 2019-04-30 15:06 Leonard Crestez
2019-04-30 15:06 ` [PATCH v5 1/2] PM / Domains: Add GENPD_FLAG_RPM_ALWAYS_ON flag Leonard Crestez
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Leonard Crestez @ 2019-04-30 15:06 UTC (permalink / raw)
To: Ulf Hansson, Lucas Stach, Shawn Guo
Cc: Aisheng Dong, linux-pm@vger.kernel.org, Viresh Kumar,
Rafael J. Wysocki, dl-linux-imx, kernel@pengutronix.de,
Fabio Estevam, linux-arm-kernel@lists.infradead.org
On imx6qp power gating on the PU domain is disabled because of errata
ERR009619. However power gating during suspend/resume can still be
performed.
Changes since V4:
* Rename GENPD_FLAG_NO_RUNTIME_OFF to GENPD_FLAG_RPM_ALWAYS_ON
Link to v4: https://patchwork.kernel.org/project/linux-arm-kernel/list/?series=110829
Implemented with a new core flag because otherwise distinguishing
between "runtime off" and "suspend off" is very complicated. Link to
previous much older attempts:
v3: https://lkml.org/lkml/2018/7/6/698
v2: https://lkml.org/lkml/2018/7/5/564
v1: https://lkml.org/lkml/2018/7/2/357
Leonard Crestez (2):
PM / Domains: Add GENPD_FLAG_RPM_ALWAYS_ON flag
soc: imx: gpc: Use GENPD_FLAG_RPM_ALWAYS_ON for ERR009619
drivers/base/power/domain.c | 8 ++++++--
drivers/soc/imx/gpc.c | 13 +++++++++++--
include/linux/pm_domain.h | 4 ++++
3 files changed, 21 insertions(+), 4 deletions(-)
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH v5 1/2] PM / Domains: Add GENPD_FLAG_RPM_ALWAYS_ON flag 2019-04-30 15:06 [PATCH v5 0/2] Allow imx6qp PU domain off in suspend Leonard Crestez @ 2019-04-30 15:06 ` Leonard Crestez 2019-05-02 9:19 ` Ulf Hansson 2019-04-30 15:06 ` [PATCH v5 2/2] soc: imx: gpc: Use GENPD_FLAG_RPM_ALWAYS_ON for ERR009619 Leonard Crestez 2019-05-14 21:35 ` [PATCH v5 0/2] Allow imx6qp PU domain off in suspend Rafael J. Wysocki 2 siblings, 1 reply; 6+ messages in thread From: Leonard Crestez @ 2019-04-30 15:06 UTC (permalink / raw) To: Ulf Hansson, Lucas Stach, Shawn Guo Cc: Aisheng Dong, linux-pm@vger.kernel.org, Viresh Kumar, Rafael J. Wysocki, dl-linux-imx, kernel@pengutronix.de, Fabio Estevam, linux-arm-kernel@lists.infradead.org This is for power domains which can only be powered off for suspend but not as part of runtime PM. Suggested-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> --- drivers/base/power/domain.c | 8 ++++++-- include/linux/pm_domain.h | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 7a6aa2318915..33c30c1e6a30 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -126,10 +126,11 @@ static const struct genpd_lock_ops genpd_spin_ops = { #define genpd_status_on(genpd) (genpd->status == GPD_STATE_ACTIVE) #define genpd_is_irq_safe(genpd) (genpd->flags & GENPD_FLAG_IRQ_SAFE) #define genpd_is_always_on(genpd) (genpd->flags & GENPD_FLAG_ALWAYS_ON) #define genpd_is_active_wakeup(genpd) (genpd->flags & GENPD_FLAG_ACTIVE_WAKEUP) #define genpd_is_cpu_domain(genpd) (genpd->flags & GENPD_FLAG_CPU_DOMAIN) +#define genpd_is_rpm_always_on(genpd) (genpd->flags & GENPD_FLAG_RPM_ALWAYS_ON) static inline bool irq_safe_dev_in_no_sleep_domain(struct device *dev, const struct generic_pm_domain *genpd) { bool ret; @@ -513,11 +514,13 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on, /* * Abort power off for the PM domain in the following situations: * (1) The domain is configured as always on. * (2) When the domain has a subdomain being powered on. */ - if (genpd_is_always_on(genpd) || atomic_read(&genpd->sd_count) > 0) + if (genpd_is_always_on(genpd) || + genpd_is_rpm_always_on(genpd) || + atomic_read(&genpd->sd_count) > 0) return -EBUSY; list_for_each_entry(pdd, &genpd->dev_list, list_node) { enum pm_qos_flags_status stat; @@ -1810,11 +1813,12 @@ int pm_genpd_init(struct generic_pm_domain *genpd, genpd->dev_ops.stop = pm_clk_suspend; genpd->dev_ops.start = pm_clk_resume; } /* Always-on domains must be powered on at initialization. */ - if (genpd_is_always_on(genpd) && !genpd_status_on(genpd)) + if ((genpd_is_always_on(genpd) || genpd_is_rpm_always_on(genpd)) && + !genpd_status_on(genpd)) return -EINVAL; if (genpd_is_cpu_domain(genpd) && !zalloc_cpumask_var(&genpd->cpus, GFP_KERNEL)) return -ENOMEM; diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 0e8e356bed6a..b21f35f0ee2e 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -51,16 +51,20 @@ * deploy idle power management support for CPUs * and groups of CPUs. Note that, the backend * driver must then comply with the so called, * last-man-standing algorithm, for the CPUs in the * PM domain. + * + * GENPD_FLAG_RPM_ALWAYS_ON: Instructs genpd to always keep the PM domain + * powered on except for system suspend. */ #define GENPD_FLAG_PM_CLK (1U << 0) #define GENPD_FLAG_IRQ_SAFE (1U << 1) #define GENPD_FLAG_ALWAYS_ON (1U << 2) #define GENPD_FLAG_ACTIVE_WAKEUP (1U << 3) #define GENPD_FLAG_CPU_DOMAIN (1U << 4) +#define GENPD_FLAG_RPM_ALWAYS_ON (1U << 5) enum gpd_status { GPD_STATE_ACTIVE = 0, /* PM domain is active */ GPD_STATE_POWER_OFF, /* PM domain is off */ }; -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v5 1/2] PM / Domains: Add GENPD_FLAG_RPM_ALWAYS_ON flag 2019-04-30 15:06 ` [PATCH v5 1/2] PM / Domains: Add GENPD_FLAG_RPM_ALWAYS_ON flag Leonard Crestez @ 2019-05-02 9:19 ` Ulf Hansson 0 siblings, 0 replies; 6+ messages in thread From: Ulf Hansson @ 2019-05-02 9:19 UTC (permalink / raw) To: Leonard Crestez Cc: Aisheng Dong, linux-pm@vger.kernel.org, Viresh Kumar, Rafael J. Wysocki, dl-linux-imx, kernel@pengutronix.de, Fabio Estevam, Shawn Guo, linux-arm-kernel@lists.infradead.org, Lucas Stach On Tue, 30 Apr 2019 at 17:06, Leonard Crestez <leonard.crestez@nxp.com> wrote: > > This is for power domains which can only be powered off for suspend but > not as part of runtime PM. > > Suggested-by: Ulf Hansson <ulf.hansson@linaro.org> > Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Kind regards Uffe > --- > drivers/base/power/domain.c | 8 ++++++-- > include/linux/pm_domain.h | 4 ++++ > 2 files changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c > index 7a6aa2318915..33c30c1e6a30 100644 > --- a/drivers/base/power/domain.c > +++ b/drivers/base/power/domain.c > @@ -126,10 +126,11 @@ static const struct genpd_lock_ops genpd_spin_ops = { > #define genpd_status_on(genpd) (genpd->status == GPD_STATE_ACTIVE) > #define genpd_is_irq_safe(genpd) (genpd->flags & GENPD_FLAG_IRQ_SAFE) > #define genpd_is_always_on(genpd) (genpd->flags & GENPD_FLAG_ALWAYS_ON) > #define genpd_is_active_wakeup(genpd) (genpd->flags & GENPD_FLAG_ACTIVE_WAKEUP) > #define genpd_is_cpu_domain(genpd) (genpd->flags & GENPD_FLAG_CPU_DOMAIN) > +#define genpd_is_rpm_always_on(genpd) (genpd->flags & GENPD_FLAG_RPM_ALWAYS_ON) > > static inline bool irq_safe_dev_in_no_sleep_domain(struct device *dev, > const struct generic_pm_domain *genpd) > { > bool ret; > @@ -513,11 +514,13 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on, > /* > * Abort power off for the PM domain in the following situations: > * (1) The domain is configured as always on. > * (2) When the domain has a subdomain being powered on. > */ > - if (genpd_is_always_on(genpd) || atomic_read(&genpd->sd_count) > 0) > + if (genpd_is_always_on(genpd) || > + genpd_is_rpm_always_on(genpd) || > + atomic_read(&genpd->sd_count) > 0) > return -EBUSY; > > list_for_each_entry(pdd, &genpd->dev_list, list_node) { > enum pm_qos_flags_status stat; > > @@ -1810,11 +1813,12 @@ int pm_genpd_init(struct generic_pm_domain *genpd, > genpd->dev_ops.stop = pm_clk_suspend; > genpd->dev_ops.start = pm_clk_resume; > } > > /* Always-on domains must be powered on at initialization. */ > - if (genpd_is_always_on(genpd) && !genpd_status_on(genpd)) > + if ((genpd_is_always_on(genpd) || genpd_is_rpm_always_on(genpd)) && > + !genpd_status_on(genpd)) > return -EINVAL; > > if (genpd_is_cpu_domain(genpd) && > !zalloc_cpumask_var(&genpd->cpus, GFP_KERNEL)) > return -ENOMEM; > diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h > index 0e8e356bed6a..b21f35f0ee2e 100644 > --- a/include/linux/pm_domain.h > +++ b/include/linux/pm_domain.h > @@ -51,16 +51,20 @@ > * deploy idle power management support for CPUs > * and groups of CPUs. Note that, the backend > * driver must then comply with the so called, > * last-man-standing algorithm, for the CPUs in the > * PM domain. > + * > + * GENPD_FLAG_RPM_ALWAYS_ON: Instructs genpd to always keep the PM domain > + * powered on except for system suspend. > */ > #define GENPD_FLAG_PM_CLK (1U << 0) > #define GENPD_FLAG_IRQ_SAFE (1U << 1) > #define GENPD_FLAG_ALWAYS_ON (1U << 2) > #define GENPD_FLAG_ACTIVE_WAKEUP (1U << 3) > #define GENPD_FLAG_CPU_DOMAIN (1U << 4) > +#define GENPD_FLAG_RPM_ALWAYS_ON (1U << 5) > > enum gpd_status { > GPD_STATE_ACTIVE = 0, /* PM domain is active */ > GPD_STATE_POWER_OFF, /* PM domain is off */ > }; > -- > 2.17.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v5 2/2] soc: imx: gpc: Use GENPD_FLAG_RPM_ALWAYS_ON for ERR009619 2019-04-30 15:06 [PATCH v5 0/2] Allow imx6qp PU domain off in suspend Leonard Crestez 2019-04-30 15:06 ` [PATCH v5 1/2] PM / Domains: Add GENPD_FLAG_RPM_ALWAYS_ON flag Leonard Crestez @ 2019-04-30 15:06 ` Leonard Crestez 2019-05-02 9:20 ` Ulf Hansson 2019-05-14 21:35 ` [PATCH v5 0/2] Allow imx6qp PU domain off in suspend Rafael J. Wysocki 2 siblings, 1 reply; 6+ messages in thread From: Leonard Crestez @ 2019-04-30 15:06 UTC (permalink / raw) To: Ulf Hansson, Lucas Stach, Shawn Guo Cc: Aisheng Dong, linux-pm@vger.kernel.org, Viresh Kumar, Rafael J. Wysocki, dl-linux-imx, kernel@pengutronix.de, Fabio Estevam, linux-arm-kernel@lists.infradead.org This allows PU domain to be turned off in suspend and save power. Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> --- drivers/soc/imx/gpc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/soc/imx/gpc.c b/drivers/soc/imx/gpc.c index a8f1e47ce698..d9231bd3c691 100644 --- a/drivers/soc/imx/gpc.c +++ b/drivers/soc/imx/gpc.c @@ -427,14 +427,23 @@ static int imx_gpc_probe(struct platform_device *pdev) dev_err(&pdev->dev, "failed to init regmap: %d\n", ret); return ret; } - /* Disable PU power down in normal operation if ERR009619 is present */ + /* + * Disable PU power down by runtime PM if ERR009619 is present. + * + * The PRE clock will be paused for several cycles when turning on the + * PU domain LDO from power down state. If PRE is in use at that time, + * the IPU/PRG cannot get the correct display data from the PRE. + * + * This is not a concern when the whole system enters suspend state, so + * it's safe to power down PU in this case. + */ if (of_id_data->err009619_present) imx_gpc_domains[GPC_PGC_DOMAIN_PU].base.flags |= - GENPD_FLAG_ALWAYS_ON; + GENPD_FLAG_RPM_ALWAYS_ON; /* Keep DISP always on if ERR006287 is present */ if (of_id_data->err006287_present) imx_gpc_domains[GPC_PGC_DOMAIN_DISPLAY].base.flags |= GENPD_FLAG_ALWAYS_ON; -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v5 2/2] soc: imx: gpc: Use GENPD_FLAG_RPM_ALWAYS_ON for ERR009619 2019-04-30 15:06 ` [PATCH v5 2/2] soc: imx: gpc: Use GENPD_FLAG_RPM_ALWAYS_ON for ERR009619 Leonard Crestez @ 2019-05-02 9:20 ` Ulf Hansson 0 siblings, 0 replies; 6+ messages in thread From: Ulf Hansson @ 2019-05-02 9:20 UTC (permalink / raw) To: Leonard Crestez Cc: Aisheng Dong, linux-pm@vger.kernel.org, Viresh Kumar, Rafael J. Wysocki, dl-linux-imx, kernel@pengutronix.de, Fabio Estevam, Shawn Guo, linux-arm-kernel@lists.infradead.org, Lucas Stach On Tue, 30 Apr 2019 at 17:06, Leonard Crestez <leonard.crestez@nxp.com> wrote: > > This allows PU domain to be turned off in suspend and save power. > > Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Kind regards Uffe > --- > drivers/soc/imx/gpc.c | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/drivers/soc/imx/gpc.c b/drivers/soc/imx/gpc.c > index a8f1e47ce698..d9231bd3c691 100644 > --- a/drivers/soc/imx/gpc.c > +++ b/drivers/soc/imx/gpc.c > @@ -427,14 +427,23 @@ static int imx_gpc_probe(struct platform_device *pdev) > dev_err(&pdev->dev, "failed to init regmap: %d\n", > ret); > return ret; > } > > - /* Disable PU power down in normal operation if ERR009619 is present */ > + /* > + * Disable PU power down by runtime PM if ERR009619 is present. > + * > + * The PRE clock will be paused for several cycles when turning on the > + * PU domain LDO from power down state. If PRE is in use at that time, > + * the IPU/PRG cannot get the correct display data from the PRE. > + * > + * This is not a concern when the whole system enters suspend state, so > + * it's safe to power down PU in this case. > + */ > if (of_id_data->err009619_present) > imx_gpc_domains[GPC_PGC_DOMAIN_PU].base.flags |= > - GENPD_FLAG_ALWAYS_ON; > + GENPD_FLAG_RPM_ALWAYS_ON; > > /* Keep DISP always on if ERR006287 is present */ > if (of_id_data->err006287_present) > imx_gpc_domains[GPC_PGC_DOMAIN_DISPLAY].base.flags |= > GENPD_FLAG_ALWAYS_ON; > -- > 2.17.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v5 0/2] Allow imx6qp PU domain off in suspend 2019-04-30 15:06 [PATCH v5 0/2] Allow imx6qp PU domain off in suspend Leonard Crestez 2019-04-30 15:06 ` [PATCH v5 1/2] PM / Domains: Add GENPD_FLAG_RPM_ALWAYS_ON flag Leonard Crestez 2019-04-30 15:06 ` [PATCH v5 2/2] soc: imx: gpc: Use GENPD_FLAG_RPM_ALWAYS_ON for ERR009619 Leonard Crestez @ 2019-05-14 21:35 ` Rafael J. Wysocki 2 siblings, 0 replies; 6+ messages in thread From: Rafael J. Wysocki @ 2019-05-14 21:35 UTC (permalink / raw) To: Leonard Crestez Cc: Aisheng Dong, Ulf Hansson, linux-pm@vger.kernel.org, Viresh Kumar, dl-linux-imx, kernel@pengutronix.de, Fabio Estevam, Shawn Guo, linux-arm-kernel@lists.infradead.org, Lucas Stach On Tuesday, April 30, 2019 5:06:10 PM CEST Leonard Crestez wrote: > On imx6qp power gating on the PU domain is disabled because of errata > ERR009619. However power gating during suspend/resume can still be > performed. > > Changes since V4: > * Rename GENPD_FLAG_NO_RUNTIME_OFF to GENPD_FLAG_RPM_ALWAYS_ON > Link to v4: https://patchwork.kernel.org/project/linux-arm-kernel/list/?series=110829 > > Implemented with a new core flag because otherwise distinguishing > between "runtime off" and "suspend off" is very complicated. Link to > previous much older attempts: > > v3: https://lkml.org/lkml/2018/7/6/698 > v2: https://lkml.org/lkml/2018/7/5/564 > v1: https://lkml.org/lkml/2018/7/2/357 > > Leonard Crestez (2): > PM / Domains: Add GENPD_FLAG_RPM_ALWAYS_ON flag > soc: imx: gpc: Use GENPD_FLAG_RPM_ALWAYS_ON for ERR009619 > > drivers/base/power/domain.c | 8 ++++++-- > drivers/soc/imx/gpc.c | 13 +++++++++++-- > include/linux/pm_domain.h | 4 ++++ > 3 files changed, 21 insertions(+), 4 deletions(-) > > -- Both patches applied, thanks! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-05-14 21:36 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-04-30 15:06 [PATCH v5 0/2] Allow imx6qp PU domain off in suspend Leonard Crestez 2019-04-30 15:06 ` [PATCH v5 1/2] PM / Domains: Add GENPD_FLAG_RPM_ALWAYS_ON flag Leonard Crestez 2019-05-02 9:19 ` Ulf Hansson 2019-04-30 15:06 ` [PATCH v5 2/2] soc: imx: gpc: Use GENPD_FLAG_RPM_ALWAYS_ON for ERR009619 Leonard Crestez 2019-05-02 9:20 ` Ulf Hansson 2019-05-14 21:35 ` [PATCH v5 0/2] Allow imx6qp PU domain off in suspend Rafael J. Wysocki
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).