linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] PM / Domains: Remove gpd_dev_ops.active_wakeup() callback
@ 2017-10-31 18:11 Geert Uytterhoeven
  2017-10-31 18:11 ` [PATCH v2 1/5] PM / Domains: Allow genpd users to specify default active wakeup behavior Geert Uytterhoeven
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Geert Uytterhoeven @ 2017-10-31 18:11 UTC (permalink / raw)
  To: Rafael J . Wysocki, Ulf Hansson, Kevin Hilman
  Cc: Simon Horman, Magnus Damm, Matthias Brugger, Heiko Stuebner,
	linux-pm, linux-mediatek, linux-rockchip, linux-renesas-soc,
	linux-kernel, Geert Uytterhoeven

	Hi Rafael, Ulf, Kevin,

It is quite common for PM Domains to require slave devices to be kept
active during system suspend if they are to be used as wakeup sources.
To enable this, currently each PM Domain or driver has to provide its
own gpd_dev_ops.active_wakeup() callback.

All existing callbacks either return always true, or a fixed value
depending on the PM Domain.

Hence this patch series simplifies active wakeup handling by replacing
the callback by a flag:
  - Patch 1 adds a new new flag GENPD_FLAG_ACTIVE_WAKEUP, to be set by
    PM Domain drivers that want to use the new handling,
  - Patches 2-4 convert all existing users of the callback to the new
    flag,
  - Patch 5 removes the callback.

This series was extracted from "[PATCH 00/10] PM / Domain: renesas: Fix
active wakeup behavior", and retains only PM Domain changes to existing
drivers.
Changes compared to v1 (most suggested by Ulf):
  - Use the flag in se instead of setting up an "always true" callback,
  - Convert the mediatek and rockchip PM Domain drivers,
  - Remove the callback.

If this idea is accepted, I think it would be good to still queue the first
patch for v4.15.  That would allow the changes to the PM Domain drivers
to go in through the respective platform trees in v4.16.
Then the final patch has to be postponed until v4.17.
Alternatively, everything can go in through the PM tree in one shot.

Thanks for your comments!

Geert Uytterhoeven (5):
  PM / Domains: Allow genpd users to specify default active wakeup
    behavior
  [RFC] ARM: shmobile: pm-rmobile: Use GENPD_FLAG_ACTIVE_WAKEUP
  [RFC] soc: mediatek: Use GENPD_FLAG_ACTIVE_WAKEUP
  [RFC] soc: rockchip: power-domain: Use GENPD_FLAG_ACTIVE_WAKEUP
  [RFC] PM / Domains: Remove gpd_dev_ops.active_wakeup() callback

 arch/arm/mach-shmobile/pm-rmobile.c |  8 +-------
 drivers/base/power/domain.c         | 13 ++++---------
 drivers/soc/mediatek/mtk-scpsys.c   | 14 ++------------
 drivers/soc/rockchip/pm_domains.c   | 14 ++------------
 include/linux/pm_domain.h           |  8 ++++----
 5 files changed, 13 insertions(+), 44 deletions(-)

-- 
2.7.4

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/5] PM / Domains: Allow genpd users to specify default active wakeup behavior
  2017-10-31 18:11 [PATCH v2 0/5] PM / Domains: Remove gpd_dev_ops.active_wakeup() callback Geert Uytterhoeven
@ 2017-10-31 18:11 ` Geert Uytterhoeven
  2017-11-02 13:59   ` Kevin Hilman
  2017-10-31 18:11 ` [PATCH v2 2/5] [RFC] ARM: shmobile: pm-rmobile: Use GENPD_FLAG_ACTIVE_WAKEUP Geert Uytterhoeven
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Geert Uytterhoeven @ 2017-10-31 18:11 UTC (permalink / raw)
  To: Rafael J . Wysocki, Ulf Hansson, Kevin Hilman
  Cc: Simon Horman, Magnus Damm, Matthias Brugger, Heiko Stuebner,
	linux-pm, linux-mediatek, linux-rockchip, linux-renesas-soc,
	linux-kernel, Geert Uytterhoeven

It is quite common for PM Domains to require slave devices to be kept
active during system suspend if they are to be used as wakeup sources.
To enable this, currently each PM Domain or driver has to provide its
own gpd_dev_ops.active_wakeup() callback.

Introduce a new flag GENPD_FLAG_ACTIVE_WAKEUP to consolidate this.
If specified, all slave devices configured as wakeup sources will be
kept active during system suspend.

PM Domains that need more fine-grained controls, based on the slave
device, can still provide their own callbacks, as before.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v2:
  - Use the flag in se instead of setting up an "always true" callback.
---
 drivers/base/power/domain.c | 3 +++
 include/linux/pm_domain.h   | 7 ++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 7eaee557aa615dbc..c5172d70b742f288 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -124,6 +124,7 @@ 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)
 
 static inline bool irq_safe_dev_in_no_sleep_domain(struct device *dev,
 		const struct generic_pm_domain *genpd)
@@ -866,6 +867,8 @@ static bool genpd_present(const struct generic_pm_domain *genpd)
 static bool genpd_dev_active_wakeup(const struct generic_pm_domain *genpd,
 				    struct device *dev)
 {
+	if (genpd_is_active_wakeup(genpd))
+		return true;
 	return GENPD_DEV_CALLBACK(genpd, bool, active_wakeup, dev);
 }
 
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 9af0356bd69c1597..28c24c58d479e3b4 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -18,9 +18,10 @@
 #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 */
-#define GENPD_FLAG_ALWAYS_ON	(1U << 2) /* PM domain is always powered on */
+#define GENPD_FLAG_PM_CLK	 (1U << 0) /* PM domain uses PM clk */
+#define GENPD_FLAG_IRQ_SAFE	 (1U << 1) /* PM domain operates in atomic */
+#define GENPD_FLAG_ALWAYS_ON	 (1U << 2) /* PM domain is always powered on */
+#define GENPD_FLAG_ACTIVE_WAKEUP (1U << 3) /* Keep devices active if wakeup */
 
 enum gpd_status {
 	GPD_STATE_ACTIVE = 0,	/* PM domain is active */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 2/5] [RFC] ARM: shmobile: pm-rmobile: Use GENPD_FLAG_ACTIVE_WAKEUP
  2017-10-31 18:11 [PATCH v2 0/5] PM / Domains: Remove gpd_dev_ops.active_wakeup() callback Geert Uytterhoeven
  2017-10-31 18:11 ` [PATCH v2 1/5] PM / Domains: Allow genpd users to specify default active wakeup behavior Geert Uytterhoeven
@ 2017-10-31 18:11 ` Geert Uytterhoeven
  2017-11-02  8:18   ` Simon Horman
  2017-10-31 18:11 ` [PATCH v2 3/5] [RFC] soc: mediatek: " Geert Uytterhoeven
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Geert Uytterhoeven @ 2017-10-31 18:11 UTC (permalink / raw)
  To: Rafael J . Wysocki, Ulf Hansson, Kevin Hilman
  Cc: Simon Horman, Magnus Damm, Matthias Brugger, Heiko Stuebner,
	linux-pm, linux-mediatek, linux-rockchip, linux-renesas-soc,
	linux-kernel, Geert Uytterhoeven

Set the newly introduced GENPD_FLAG_ACTIVE_WAKEUP, which allows to
remove the driver's own "always true" callback.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This must not be applied before "PM / Domain: Enable genpd users to
specify default active wakeup behavior" has landed upstream, hence the
"RFC".

v2:
  - No changes.
---
 arch/arm/mach-shmobile/pm-rmobile.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
index 3a4ed4c33a68e51e..e348bcfe389da51b 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.c
+++ b/arch/arm/mach-shmobile/pm-rmobile.c
@@ -120,18 +120,12 @@ static int rmobile_pd_power_up(struct generic_pm_domain *genpd)
 	return __rmobile_pd_power_up(to_rmobile_pd(genpd), true);
 }
 
-static bool rmobile_pd_active_wakeup(struct device *dev)
-{
-	return true;
-}
-
 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 |= GENPD_FLAG_PM_CLK;
-	genpd->dev_ops.active_wakeup	= rmobile_pd_active_wakeup;
+	genpd->flags |= GENPD_FLAG_PM_CLK | GENPD_FLAG_ACTIVE_WAKEUP;
 	genpd->power_off		= rmobile_pd_power_down;
 	genpd->power_on			= rmobile_pd_power_up;
 	genpd->attach_dev		= cpg_mstp_attach_dev;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 3/5] [RFC] soc: mediatek: Use GENPD_FLAG_ACTIVE_WAKEUP
  2017-10-31 18:11 [PATCH v2 0/5] PM / Domains: Remove gpd_dev_ops.active_wakeup() callback Geert Uytterhoeven
  2017-10-31 18:11 ` [PATCH v2 1/5] PM / Domains: Allow genpd users to specify default active wakeup behavior Geert Uytterhoeven
  2017-10-31 18:11 ` [PATCH v2 2/5] [RFC] ARM: shmobile: pm-rmobile: Use GENPD_FLAG_ACTIVE_WAKEUP Geert Uytterhoeven
@ 2017-10-31 18:11 ` Geert Uytterhoeven
  2017-11-02 11:32   ` Matthias Brugger
  2017-10-31 18:11 ` [PATCH v2 4/5] [RFC] soc: rockchip: power-domain: " Geert Uytterhoeven
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Geert Uytterhoeven @ 2017-10-31 18:11 UTC (permalink / raw)
  To: Rafael J . Wysocki, Ulf Hansson, Kevin Hilman
  Cc: Simon Horman, Magnus Damm, Matthias Brugger, Heiko Stuebner,
	linux-pm, linux-mediatek, linux-rockchip, linux-renesas-soc,
	linux-kernel, Geert Uytterhoeven

Set the newly introduced GENPD_FLAG_ACTIVE_WAKEUP, which allows to
remove the driver's own flag-based callback.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This must not be applied before "PM / Domain: Enable genpd users to
specify default active wakeup behavior" has landed upstream, hence the
"RFC".

Compile-tested only.

v2:
  - New.
---
 drivers/soc/mediatek/mtk-scpsys.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c
index e1ce8b1b5090aa0a..e570b6af2e6ffbdd 100644
--- a/drivers/soc/mediatek/mtk-scpsys.c
+++ b/drivers/soc/mediatek/mtk-scpsys.c
@@ -361,17 +361,6 @@ static int scpsys_power_off(struct generic_pm_domain *genpd)
 	return ret;
 }
 
-static bool scpsys_active_wakeup(struct device *dev)
-{
-	struct generic_pm_domain *genpd;
-	struct scp_domain *scpd;
-
-	genpd = pd_to_genpd(dev->pm_domain);
-	scpd = container_of(genpd, struct scp_domain, genpd);
-
-	return scpd->data->active_wakeup;
-}
-
 static void init_clks(struct platform_device *pdev, struct clk **clk)
 {
 	int i;
@@ -466,7 +455,8 @@ static struct scp *init_scp(struct platform_device *pdev,
 		genpd->name = data->name;
 		genpd->power_off = scpsys_power_off;
 		genpd->power_on = scpsys_power_on;
-		genpd->dev_ops.active_wakeup = scpsys_active_wakeup;
+		if (scpd->data->active_wakeup)
+			genpd->flags |= GENPD_FLAG_ACTIVE_WAKEUP;
 	}
 
 	return scp;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 4/5] [RFC] soc: rockchip: power-domain: Use GENPD_FLAG_ACTIVE_WAKEUP
  2017-10-31 18:11 [PATCH v2 0/5] PM / Domains: Remove gpd_dev_ops.active_wakeup() callback Geert Uytterhoeven
                   ` (2 preceding siblings ...)
  2017-10-31 18:11 ` [PATCH v2 3/5] [RFC] soc: mediatek: " Geert Uytterhoeven
@ 2017-10-31 18:11 ` Geert Uytterhoeven
  2017-11-02  9:51   ` Heiko Stübner
  2017-10-31 18:11 ` [PATCH v2 5/5] [RFC] PM / Domains: Remove gpd_dev_ops.active_wakeup() callback Geert Uytterhoeven
  2017-11-01 10:10 ` [PATCH v2 0/5] " Ulf Hansson
  5 siblings, 1 reply; 13+ messages in thread
From: Geert Uytterhoeven @ 2017-10-31 18:11 UTC (permalink / raw)
  To: Rafael J . Wysocki, Ulf Hansson, Kevin Hilman
  Cc: Simon Horman, Magnus Damm, Matthias Brugger, Heiko Stuebner,
	linux-pm, linux-mediatek, linux-rockchip, linux-renesas-soc,
	linux-kernel, Geert Uytterhoeven

Set the newly introduced GENPD_FLAG_ACTIVE_WAKEUP, which allows to
remove the driver's own flag-based callback.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This must not be applied before "PM / Domain: Enable genpd users to
specify default active wakeup behavior" has landed upstream, hence the
"RFC".

Compile-tested only.

v2:
  - New.
---
 drivers/soc/rockchip/pm_domains.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c
index 40b75748835f552c..5c342167b9db7a16 100644
--- a/drivers/soc/rockchip/pm_domains.c
+++ b/drivers/soc/rockchip/pm_domains.c
@@ -358,17 +358,6 @@ static void rockchip_pd_detach_dev(struct generic_pm_domain *genpd,
 	pm_clk_destroy(dev);
 }
 
-static bool rockchip_active_wakeup(struct device *dev)
-{
-	struct generic_pm_domain *genpd;
-	struct rockchip_pm_domain *pd;
-
-	genpd = pd_to_genpd(dev->pm_domain);
-	pd = container_of(genpd, struct rockchip_pm_domain, genpd);
-
-	return pd->info->active_wakeup;
-}
-
 static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
 				      struct device_node *node)
 {
@@ -489,8 +478,9 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
 	pd->genpd.power_on = rockchip_pd_power_on;
 	pd->genpd.attach_dev = rockchip_pd_attach_dev;
 	pd->genpd.detach_dev = rockchip_pd_detach_dev;
-	pd->genpd.dev_ops.active_wakeup = rockchip_active_wakeup;
 	pd->genpd.flags = GENPD_FLAG_PM_CLK;
+	if (pd_info->active_wakeup)
+		pd->genpd.flags |= GENPD_FLAG_ACTIVE_WAKEUP;
 	pm_genpd_init(&pd->genpd, NULL, false);
 
 	pmu->genpd_data.domains[id] = &pd->genpd;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 5/5] [RFC] PM / Domains: Remove gpd_dev_ops.active_wakeup() callback
  2017-10-31 18:11 [PATCH v2 0/5] PM / Domains: Remove gpd_dev_ops.active_wakeup() callback Geert Uytterhoeven
                   ` (3 preceding siblings ...)
  2017-10-31 18:11 ` [PATCH v2 4/5] [RFC] soc: rockchip: power-domain: " Geert Uytterhoeven
@ 2017-10-31 18:11 ` Geert Uytterhoeven
  2017-11-02 14:00   ` Kevin Hilman
  2017-11-01 10:10 ` [PATCH v2 0/5] " Ulf Hansson
  5 siblings, 1 reply; 13+ messages in thread
From: Geert Uytterhoeven @ 2017-10-31 18:11 UTC (permalink / raw)
  To: Rafael J . Wysocki, Ulf Hansson, Kevin Hilman
  Cc: Simon Horman, Magnus Damm, Matthias Brugger, Heiko Stuebner,
	linux-pm, linux-mediatek, linux-rockchip, linux-renesas-soc,
	linux-kernel, Geert Uytterhoeven

There are no more users left of the gpd_dev_ops.active_wakeup()
callback.  All have been converted to GENPD_FLAG_ACTIVE_WAKEUP.
Hence remove the callback.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This must not be applied before all users of active_wakup have been
converted, hence the "RFC".

v2:
  - New.
---
 drivers/base/power/domain.c | 14 +++-----------
 include/linux/pm_domain.h   |  1 -
 2 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index c5172d70b742f288..8768e56ecf101203 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -864,14 +864,6 @@ static bool genpd_present(const struct generic_pm_domain *genpd)
 
 #ifdef CONFIG_PM_SLEEP
 
-static bool genpd_dev_active_wakeup(const struct generic_pm_domain *genpd,
-				    struct device *dev)
-{
-	if (genpd_is_active_wakeup(genpd))
-		return true;
-	return GENPD_DEV_CALLBACK(genpd, bool, active_wakeup, dev);
-}
-
 /**
  * genpd_sync_power_off - Synchronously power off a PM domain and its masters.
  * @genpd: PM domain to power off, if possible.
@@ -976,7 +968,7 @@ static bool resume_needed(struct device *dev,
 	if (!device_can_wakeup(dev))
 		return false;
 
-	active_wakeup = genpd_dev_active_wakeup(genpd, dev);
+	active_wakeup = genpd_is_active_wakeup(genpd);
 	return device_may_wakeup(dev) ? active_wakeup : !active_wakeup;
 }
 
@@ -1045,7 +1037,7 @@ static int genpd_finish_suspend(struct device *dev, bool poweroff)
 	if (IS_ERR(genpd))
 		return -EINVAL;
 
-	if (dev->power.wakeup_path && genpd_dev_active_wakeup(genpd, dev))
+	if (dev->power.wakeup_path && genpd_is_active_wakeup(genpd))
 		return 0;
 
 	if (poweroff)
@@ -1100,7 +1092,7 @@ static int genpd_resume_noirq(struct device *dev)
 	if (IS_ERR(genpd))
 		return -EINVAL;
 
-	if (dev->power.wakeup_path && genpd_dev_active_wakeup(genpd, dev))
+	if (dev->power.wakeup_path && genpd_is_active_wakeup(genpd))
 		return 0;
 
 	genpd_lock(genpd);
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 28c24c58d479e3b4..04dbef9847d3ad3b 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -36,7 +36,6 @@ struct dev_power_governor {
 struct gpd_dev_ops {
 	int (*start)(struct device *dev);
 	int (*stop)(struct device *dev);
-	bool (*active_wakeup)(struct device *dev);
 };
 
 struct genpd_power_state {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 0/5] PM / Domains: Remove gpd_dev_ops.active_wakeup() callback
  2017-10-31 18:11 [PATCH v2 0/5] PM / Domains: Remove gpd_dev_ops.active_wakeup() callback Geert Uytterhoeven
                   ` (4 preceding siblings ...)
  2017-10-31 18:11 ` [PATCH v2 5/5] [RFC] PM / Domains: Remove gpd_dev_ops.active_wakeup() callback Geert Uytterhoeven
@ 2017-11-01 10:10 ` Ulf Hansson
  2017-11-02  9:14   ` Geert Uytterhoeven
  5 siblings, 1 reply; 13+ messages in thread
From: Ulf Hansson @ 2017-11-01 10:10 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J . Wysocki, Kevin Hilman, Simon Horman, Magnus Damm,
	Matthias Brugger, Heiko Stuebner, linux-pm, linux-mediatek,
	open list:ARM/Rockchip SoC...,
	Linux-Renesas, linux-kernel

On 31 October 2017 at 19:11, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
>         Hi Rafael, Ulf, Kevin,
>
> It is quite common for PM Domains to require slave devices to be kept
> active during system suspend if they are to be used as wakeup sources.
> To enable this, currently each PM Domain or driver has to provide its
> own gpd_dev_ops.active_wakeup() callback.
>
> All existing callbacks either return always true, or a fixed value
> depending on the PM Domain.
>
> Hence this patch series simplifies active wakeup handling by replacing
> the callback by a flag:
>   - Patch 1 adds a new new flag GENPD_FLAG_ACTIVE_WAKEUP, to be set by
>     PM Domain drivers that want to use the new handling,
>   - Patches 2-4 convert all existing users of the callback to the new
>     flag,
>   - Patch 5 removes the callback.
>
> This series was extracted from "[PATCH 00/10] PM / Domain: renesas: Fix
> active wakeup behavior", and retains only PM Domain changes to existing
> drivers.
> Changes compared to v1 (most suggested by Ulf):
>   - Use the flag in se instead of setting up an "always true" callback,
>   - Convert the mediatek and rockchip PM Domain drivers,
>   - Remove the callback.
>
> If this idea is accepted, I think it would be good to still queue the first
> patch for v4.15.  That would allow the changes to the PM Domain drivers
> to go in through the respective platform trees in v4.16.
> Then the final patch has to be postponed until v4.17.
> Alternatively, everything can go in through the PM tree in one shot.

For the series:

Acked-by: Ulf Hansson <ulf.hansson@linaro.org>

It's easier if everything goes via Rafael's PM tree. Moreover, this
series is to me rather trivial, so I would actually recommend to pick
it all for 4.15. Mainly because, moving too slowly forward, allows new
users to show up of the callback you remove in patch5.

Kind regards
Uffe

>
> Thanks for your comments!
>
> Geert Uytterhoeven (5):
>   PM / Domains: Allow genpd users to specify default active wakeup
>     behavior
>   [RFC] ARM: shmobile: pm-rmobile: Use GENPD_FLAG_ACTIVE_WAKEUP
>   [RFC] soc: mediatek: Use GENPD_FLAG_ACTIVE_WAKEUP
>   [RFC] soc: rockchip: power-domain: Use GENPD_FLAG_ACTIVE_WAKEUP
>   [RFC] PM / Domains: Remove gpd_dev_ops.active_wakeup() callback
>
>  arch/arm/mach-shmobile/pm-rmobile.c |  8 +-------
>  drivers/base/power/domain.c         | 13 ++++---------
>  drivers/soc/mediatek/mtk-scpsys.c   | 14 ++------------
>  drivers/soc/rockchip/pm_domains.c   | 14 ++------------
>  include/linux/pm_domain.h           |  8 ++++----
>  5 files changed, 13 insertions(+), 44 deletions(-)
>
> --
> 2.7.4
>
> Gr{oetje,eeting}s,
>
>                                                 Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                                             -- Linus Torvalds

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/5] [RFC] ARM: shmobile: pm-rmobile: Use GENPD_FLAG_ACTIVE_WAKEUP
  2017-10-31 18:11 ` [PATCH v2 2/5] [RFC] ARM: shmobile: pm-rmobile: Use GENPD_FLAG_ACTIVE_WAKEUP Geert Uytterhoeven
@ 2017-11-02  8:18   ` Simon Horman
  0 siblings, 0 replies; 13+ messages in thread
From: Simon Horman @ 2017-11-02  8:18 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J . Wysocki, Ulf Hansson, Kevin Hilman, Magnus Damm,
	Matthias Brugger, Heiko Stuebner, linux-pm, linux-mediatek,
	linux-rockchip, linux-renesas-soc, linux-kernel

On Tue, Oct 31, 2017 at 07:11:31PM +0100, Geert Uytterhoeven wrote:
> Set the newly introduced GENPD_FLAG_ACTIVE_WAKEUP, which allows to
> remove the driver's own "always true" callback.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> This must not be applied before "PM / Domain: Enable genpd users to
> specify default active wakeup behavior" has landed upstream, hence the
> "RFC".

Assuming you would like this to go through Rafael's tree rather than mine:

Acked-by: Simon Horman <horms+renesas@verge.net.au>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 0/5] PM / Domains: Remove gpd_dev_ops.active_wakeup() callback
  2017-11-01 10:10 ` [PATCH v2 0/5] " Ulf Hansson
@ 2017-11-02  9:14   ` Geert Uytterhoeven
  0 siblings, 0 replies; 13+ messages in thread
From: Geert Uytterhoeven @ 2017-11-02  9:14 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Geert Uytterhoeven, Rafael J . Wysocki, Kevin Hilman,
	Simon Horman, Magnus Damm, Matthias Brugger, Heiko Stuebner,
	linux-pm, linux-mediatek, open list:ARM/Rockchip SoC...,
	Linux-Renesas, linux-kernel

Hi Ulf,

On Wed, Nov 1, 2017 at 11:10 AM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On 31 October 2017 at 19:11, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
>> It is quite common for PM Domains to require slave devices to be kept
>> active during system suspend if they are to be used as wakeup sources.
>> To enable this, currently each PM Domain or driver has to provide its
>> own gpd_dev_ops.active_wakeup() callback.
>>
>> All existing callbacks either return always true, or a fixed value
>> depending on the PM Domain.
>>
>> Hence this patch series simplifies active wakeup handling by replacing
>> the callback by a flag:
>>   - Patch 1 adds a new new flag GENPD_FLAG_ACTIVE_WAKEUP, to be set by
>>     PM Domain drivers that want to use the new handling,
>>   - Patches 2-4 convert all existing users of the callback to the new
>>     flag,
>>   - Patch 5 removes the callback.
>>
>> This series was extracted from "[PATCH 00/10] PM / Domain: renesas: Fix
>> active wakeup behavior", and retains only PM Domain changes to existing
>> drivers.
>> Changes compared to v1 (most suggested by Ulf):
>>   - Use the flag in se instead of setting up an "always true" callback,
>>   - Convert the mediatek and rockchip PM Domain drivers,
>>   - Remove the callback.
>>
>> If this idea is accepted, I think it would be good to still queue the first
>> patch for v4.15.  That would allow the changes to the PM Domain drivers
>> to go in through the respective platform trees in v4.16.
>> Then the final patch has to be postponed until v4.17.
>> Alternatively, everything can go in through the PM tree in one shot.
>
> For the series:
>
> Acked-by: Ulf Hansson <ulf.hansson@linaro.org>

Thanks!

> It's easier if everything goes via Rafael's PM tree. Moreover, this
> series is to me rather trivial, so I would actually recommend to pick
> it all for 4.15. Mainly because, moving too slowly forward, allows new
> users to show up of the callback you remove in patch5.

Obviously, that's fine for me.
Guess I've just became a bit too cautious with treewide changes ;-)

>>   [RFC] ARM: shmobile: pm-rmobile: Use GENPD_FLAG_ACTIVE_WAKEUP

We already have an ack from Simon...

>>   [RFC] soc: mediatek: Use GENPD_FLAG_ACTIVE_WAKEUP
>>   [RFC] soc: rockchip: power-domain: Use GENPD_FLAG_ACTIVE_WAKEUP

... we still need one for mediatek and rockchip?

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 4/5] [RFC] soc: rockchip: power-domain: Use GENPD_FLAG_ACTIVE_WAKEUP
  2017-10-31 18:11 ` [PATCH v2 4/5] [RFC] soc: rockchip: power-domain: " Geert Uytterhoeven
@ 2017-11-02  9:51   ` Heiko Stübner
  0 siblings, 0 replies; 13+ messages in thread
From: Heiko Stübner @ 2017-11-02  9:51 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J . Wysocki, Ulf Hansson, Kevin Hilman, Simon Horman,
	Magnus Damm, Matthias Brugger, linux-pm, linux-mediatek,
	linux-rockchip, linux-renesas-soc, linux-kernel

Am Dienstag, 31. Oktober 2017, 19:11:33 CET schrieb Geert Uytterhoeven:
> Set the newly introduced GENPD_FLAG_ACTIVE_WAKEUP, which allows to
> remove the driver's own flag-based callback.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

looks ok, so
Acked-by: Heiko Stuebner <heiko@sntech.de>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 3/5] [RFC] soc: mediatek: Use GENPD_FLAG_ACTIVE_WAKEUP
  2017-10-31 18:11 ` [PATCH v2 3/5] [RFC] soc: mediatek: " Geert Uytterhoeven
@ 2017-11-02 11:32   ` Matthias Brugger
  0 siblings, 0 replies; 13+ messages in thread
From: Matthias Brugger @ 2017-11-02 11:32 UTC (permalink / raw)
  To: Geert Uytterhoeven, Rafael J . Wysocki, Ulf Hansson, Kevin Hilman
  Cc: Simon Horman, Magnus Damm, Heiko Stuebner, linux-pm,
	linux-mediatek, linux-rockchip, linux-renesas-soc, linux-kernel



On 10/31/2017 07:11 PM, Geert Uytterhoeven wrote:
> Set the newly introduced GENPD_FLAG_ACTIVE_WAKEUP, which allows to
> remove the driver's own flag-based callback.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> This must not be applied before "PM / Domain: Enable genpd users to
> specify default active wakeup behavior" has landed upstream, hence the
> "RFC".
> 
> Compile-tested only.
> 
> v2:
>   - New.
> ---
>  drivers/soc/mediatek/mtk-scpsys.c | 14 ++------------
>  1 file changed, 2 insertions(+), 12 deletions(-)
> 

Acked-by: Matthias Brugger <matthias.bgg@gmail.com>

> diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c
> index e1ce8b1b5090aa0a..e570b6af2e6ffbdd 100644
> --- a/drivers/soc/mediatek/mtk-scpsys.c
> +++ b/drivers/soc/mediatek/mtk-scpsys.c
> @@ -361,17 +361,6 @@ static int scpsys_power_off(struct generic_pm_domain *genpd)
>  	return ret;
>  }
>  
> -static bool scpsys_active_wakeup(struct device *dev)
> -{
> -	struct generic_pm_domain *genpd;
> -	struct scp_domain *scpd;
> -
> -	genpd = pd_to_genpd(dev->pm_domain);
> -	scpd = container_of(genpd, struct scp_domain, genpd);
> -
> -	return scpd->data->active_wakeup;
> -}
> -
>  static void init_clks(struct platform_device *pdev, struct clk **clk)
>  {
>  	int i;
> @@ -466,7 +455,8 @@ static struct scp *init_scp(struct platform_device *pdev,
>  		genpd->name = data->name;
>  		genpd->power_off = scpsys_power_off;
>  		genpd->power_on = scpsys_power_on;
> -		genpd->dev_ops.active_wakeup = scpsys_active_wakeup;
> +		if (scpd->data->active_wakeup)
> +			genpd->flags |= GENPD_FLAG_ACTIVE_WAKEUP;
>  	}
>  
>  	return scp;
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/5] PM / Domains: Allow genpd users to specify default active wakeup behavior
  2017-10-31 18:11 ` [PATCH v2 1/5] PM / Domains: Allow genpd users to specify default active wakeup behavior Geert Uytterhoeven
@ 2017-11-02 13:59   ` Kevin Hilman
  0 siblings, 0 replies; 13+ messages in thread
From: Kevin Hilman @ 2017-11-02 13:59 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J . Wysocki, Ulf Hansson, Simon Horman, Magnus Damm,
	Matthias Brugger, Heiko Stuebner, linux-pm, linux-mediatek,
	linux-rockchip, linux-renesas-soc, linux-kernel

Geert Uytterhoeven <geert+renesas@glider.be> writes:

> It is quite common for PM Domains to require slave devices to be kept
> active during system suspend if they are to be used as wakeup sources.
> To enable this, currently each PM Domain or driver has to provide its
> own gpd_dev_ops.active_wakeup() callback.
>
> Introduce a new flag GENPD_FLAG_ACTIVE_WAKEUP to consolidate this.
> If specified, all slave devices configured as wakeup sources will be
> kept active during system suspend.
>
> PM Domains that need more fine-grained controls, based on the slave
> device, can still provide their own callbacks, as before.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Kevin Hilman <khilman@baylibre.com>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 5/5] [RFC] PM / Domains: Remove gpd_dev_ops.active_wakeup() callback
  2017-10-31 18:11 ` [PATCH v2 5/5] [RFC] PM / Domains: Remove gpd_dev_ops.active_wakeup() callback Geert Uytterhoeven
@ 2017-11-02 14:00   ` Kevin Hilman
  0 siblings, 0 replies; 13+ messages in thread
From: Kevin Hilman @ 2017-11-02 14:00 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J . Wysocki, Ulf Hansson, Simon Horman, Magnus Damm,
	Matthias Brugger, Heiko Stuebner, linux-pm, linux-mediatek,
	linux-rockchip, linux-renesas-soc, linux-kernel

Geert Uytterhoeven <geert+renesas@glider.be> writes:

> There are no more users left of the gpd_dev_ops.active_wakeup()
> callback.  All have been converted to GENPD_FLAG_ACTIVE_WAKEUP.
> Hence remove the callback.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> This must not be applied before all users of active_wakup have been
> converted, hence the "RFC".


Reviewed-by: Kevin Hilman <khilman@baylibre.com>

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-11-02 14:00 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-31 18:11 [PATCH v2 0/5] PM / Domains: Remove gpd_dev_ops.active_wakeup() callback Geert Uytterhoeven
2017-10-31 18:11 ` [PATCH v2 1/5] PM / Domains: Allow genpd users to specify default active wakeup behavior Geert Uytterhoeven
2017-11-02 13:59   ` Kevin Hilman
2017-10-31 18:11 ` [PATCH v2 2/5] [RFC] ARM: shmobile: pm-rmobile: Use GENPD_FLAG_ACTIVE_WAKEUP Geert Uytterhoeven
2017-11-02  8:18   ` Simon Horman
2017-10-31 18:11 ` [PATCH v2 3/5] [RFC] soc: mediatek: " Geert Uytterhoeven
2017-11-02 11:32   ` Matthias Brugger
2017-10-31 18:11 ` [PATCH v2 4/5] [RFC] soc: rockchip: power-domain: " Geert Uytterhoeven
2017-11-02  9:51   ` Heiko Stübner
2017-10-31 18:11 ` [PATCH v2 5/5] [RFC] PM / Domains: Remove gpd_dev_ops.active_wakeup() callback Geert Uytterhoeven
2017-11-02 14:00   ` Kevin Hilman
2017-11-01 10:10 ` [PATCH v2 0/5] " Ulf Hansson
2017-11-02  9:14   ` Geert Uytterhoeven

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).