Skip to content

Commit 9219982

Browse files
storulfWolfram Sang
authored andcommitted
i2c: nomadik: Fixup system suspend
For !CONFIG_PM_RUNTIME, the device were never put back into active state while resuming. For CONFIG_PM_RUNTIME, we blindly trusted the device to be inactive while we were about to handle it at suspend late, which is just too optimistic. Even if the driver uses pm_runtime_put_sync() after each tranfer to return it's runtime PM resources, there are no guarantees this will actually mean the device will inactivated. The reason is that the PM core will prevent runtime suspend during system suspend, and thus when a transfer occurs during the early phases of system suspend the device will be kept active after the transfer. To handle both issues above, use pm_runtime_force_suspend|resume() from the system suspend|resume callbacks. Signed-off-by: Ulf Hansson <[email protected]> Acked-by: Linus Walleij <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 8e8782c commit 9219982

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/i2c/busses/i2c-nomadik.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -879,19 +879,19 @@ static irqreturn_t i2c_irq_handler(int irq, void *arg)
879879
#ifdef CONFIG_PM_SLEEP
880880
static int nmk_i2c_suspend_late(struct device *dev)
881881
{
882-
pinctrl_pm_select_sleep_state(dev);
882+
int ret;
883883

884+
ret = pm_runtime_force_suspend(dev);
885+
if (ret)
886+
return ret;
887+
888+
pinctrl_pm_select_sleep_state(dev);
884889
return 0;
885890
}
886891

887892
static int nmk_i2c_resume_early(struct device *dev)
888893
{
889-
/* First go to the default state */
890-
pinctrl_pm_select_default_state(dev);
891-
/* Then let's idle the pins until the next transfer happens */
892-
pinctrl_pm_select_idle_state(dev);
893-
894-
return 0;
894+
return pm_runtime_force_resume(dev);
895895
}
896896
#endif
897897

0 commit comments

Comments
 (0)