Skip to contentSkip to conversation

regulator: core: Handle PM_SUSPEND_TO_IDLE suspend_state_t

PATCH In review Hans de Goede 2 participants 6 messages Feb 18, 2018 – Feb 20, 2018 Voltage and current regulator framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 regulator: core: Handle PM_SUSPEND_TO_IDLE suspend_state_t

The regulator framework is used on x86 in some cases now and x86 has a PM_SUSPEND_TO_IDLE suspend_state_t, treat this as PM_SUSPEND_STANDBY, this fixes these errors on resume:

dpm_run_callback(): regulator_resume_early+0x0/0x60 returns -22
PM: Device regulator.0 failed to resume early: error -22

---
 drivers/regulator/core.c | 1 +
 1 file changed, 1 insertion(+)
drivers/regulator/core.c +1 -0
index dd4708c58480..c980703ba705 100644
@@ -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:
Signature · 1 line
2.14.3
maintainer
#1 lore raw
Quoted 3 lines · Hans de Goede

The regulator framework is used on x86 in some cases now and x86 has a PM_SUSPEND_TO_IDLE suspend_state_t, treat this as PM_SUSPEND_STANDBY, this fixes these errors on resume:

This was already fixed by Geert.

#2 lore raw

Hi,

Quoted 6 lines · Mark Brown
Quoted 3 lines · Hans de Goede

The regulator framework is used on x86 in some cases now and x86 has a PM_SUSPEND_TO_IDLE suspend_state_t, treat this as PM_SUSPEND_STANDBY, this fixes these errors on resume:

This was already fixed by Geert.

There are multiple callers of regulator_get_suspend_state() in drivers/regulator/core.c, I assume you refer to this commit:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/regulator/core.c?id=57a0dd187956ea04870f4bbbf25a63c425ee7cad

Even with that commit I'm still seeing these errors on resume:

[  753.064002] dpm_run_callback(): regulator_resume_early+0x0/0x60 returns -22
[  753.064014] PM: Device regulator.0 failed to resume early: error -22

These are caused by the -EINVAL return after the regulator_get_suspend_state() call in _regulator_resume_early() and there are other callers of regulator_get_suspend_state() which return -EINVAL too.

I think just returning 0 in this case makes sense, but it looks like that needs to be done in several places.

Regards,

Hans

#4 lore raw

Hi,

Quoted 8 lines · Mark Brown
Quoted 5 lines · Hans de Goede

On 19-02-18 12:34, Mark Brown wrote:

There are multiple callers of regulator_get_suspend_state() in drivers/regulator/core.c, I assume you refer to this commit:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/regulator/core.c?id=57a0dd187956ea04870f4bbbf25a63c425ee7cad

No, he sent a second fix which isn't in Linus' tree yet, see my -next.

I might just be looking at the wrong place and if so I'm sorry, but I don't see any (additional) fixes related to this here:

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git/log/drivers/regulator?h=for-next

Regards,

Hans

maintainer
#5 lore raw
Quoted 2 lines · Hans de Goede

I might just be looking at the wrong place and if so I'm sorry, but I don't see any (additional) fixes related to this here:

Seems to have got stuck somewhere, sorry - pushed now.