diff mbox series

[3/3] PM / Domains: Take WAKEUP_POWERED driver flag into account

Message ID 1510154134-1248-4-git-send-email-ulf.hansson@linaro.org
State New
Headers show
Series PM / core: Invent a WAKEUP_POWERED driver flag | expand

Commit Message

Ulf Hansson Nov. 8, 2017, 3:15 p.m. UTC
Make genpd to take the WAKEUP_POWERED driver flag into account during
system suspend/resume. More precisely, in case the WAKEUP_POWERED flag is
set, let's leave the device in full power state and prevent the PM domain
from being powered off.

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

---
 drivers/base/power/domain.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

-- 
2.7.4

Comments

Geert Uytterhoeven Nov. 8, 2017, 3:32 p.m. UTC | #1
On Wed, Nov 8, 2017 at 4:15 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> Make genpd to take the WAKEUP_POWERED driver flag into account during

> system suspend/resume. More precisely, in case the WAKEUP_POWERED flag is

> set, let's leave the device in full power state and prevent the PM domain

> from being powered off.

>

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


Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>


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
diff mbox series

Patch

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 24e39ce..dc18f88 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1037,8 +1037,11 @@  static int genpd_finish_suspend(struct device *dev, bool poweroff)
 	if (IS_ERR(genpd))
 		return -EINVAL;
 
-	if (dev->power.wakeup_path && genpd_is_active_wakeup(genpd))
-		return 0;
+	if (dev->power.wakeup_path) {
+		if (dev_pm_test_driver_flags(dev, DPM_FLAG_WAKEUP_POWERED) ||
+		    genpd_is_active_wakeup(genpd))
+			return 0;
+	}
 
 	if (poweroff)
 		ret = pm_generic_poweroff_noirq(dev);
@@ -1092,8 +1095,11 @@  static int genpd_resume_noirq(struct device *dev)
 	if (IS_ERR(genpd))
 		return -EINVAL;
 
-	if (dev->power.wakeup_path && genpd_is_active_wakeup(genpd))
-		return 0;
+	if (dev->power.wakeup_path) {
+		if (dev_pm_test_driver_flags(dev, DPM_FLAG_WAKEUP_POWERED) ||
+		    genpd_is_active_wakeup(genpd))
+			return 0;
+	}
 
 	genpd_lock(genpd);
 	genpd_sync_power_on(genpd, true, 0);