linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: core: Fix s2idle
@ 2018-01-30 10:32 Geert Uytterhoeven
  2018-01-30 12:03 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2018-01-30 10:32 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Chunyan Zhang
  Cc: linux-kernel, linux-pm, Geert Uytterhoeven

Systems using regulators can no longer be frozen:

$ echo 0 > /sys/module/printk/parameters/console_suspend
$ echo freeze > /sys/power/state

    PM: suspend entry (s2idle)
    PM: Syncing filesystems ... done.
    Freezing user space processes ... (elapsed 0.011 seconds) done.
    OOM killer disabled.
    Freezing remaining freezable tasks ... (elapsed 0.009 seconds) done.
    dpm_run_callback(): regulator_suspend_late+0x0/0x44 returns -22
    PM: Device regulator.7 failed to suspend late: error -22
    PM: late suspend of devices failed

Fix this by adding the missing case for s2idle.  Treat s2idle the same
as standby, as there are no separate constraints defined for s2idle.

Fixes: f7efad10b5c49289 ("regulator: add PM suspend and resume hooks")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
regulator_check_states() also considers PM_SUSPEND_TO_IDLE an invalid
state:

    /* return 0 if the state is valid */
    static int regulator_check_states(suspend_state_t state)
    {
	    return (state > PM_SUSPEND_MAX || state == PM_SUSPEND_TO_IDLE);
    }

But I have no idea what impact it has.  So far it doesn't seem to hurt,
though.

 drivers/regulator/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 42681c10cbe4fa9f..5f411b0cca9aa838 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -333,6 +333,7 @@ regulator_get_suspend_state(struct regulator_dev *rdev, suspend_state_t state)
 		return NULL;
 
 	switch (state) {
+	case PM_SUSPEND_TO_IDLE:
 	case PM_SUSPEND_STANDBY:
 		return &rdev->constraints->state_standby;
 	case PM_SUSPEND_MEM:
-- 
2.7.4

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

end of thread, other threads:[~2018-01-30 16:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-30 10:32 [PATCH] regulator: core: Fix s2idle Geert Uytterhoeven
2018-01-30 12:03 ` Mark Brown
2018-01-30 12:11   ` Geert Uytterhoeven
2018-01-30 16:19   ` Applied "regulator: Fix suspend to idle" to the regulator tree Mark Brown

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