Skip to content

Commit 20a41a6

Browse files
tmlindgregkh
authored andcommitted
serial: 8250_omap: Use force_suspend and resume for system suspend
We should not rely on autosuspend timeout for system suspend. Instead, let's use force_suspend and force_resume functions. Otherwise the serial port controller device may not be idled on suspend. As we are doing a register write on suspend to configure the serial port, we still need to runtime PM resume the port on suspend. While at it, let's switch to pm_runtime_resume_and_get() and check for errors returned. And let's add the missing line break before return to the suspend function while at it. Fixes: 09d8b2b ("serial: 8250: omap: Provide ability to enable/disable UART as wakeup source") Signed-off-by: Tony Lindgren <tony@atomide.com> Tested-by: Dhruva Gole <d-gole@ti.com> Message-ID: <20230614045922.4798-1-tony@atomide.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f3710f5 commit 20a41a6

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

drivers/tty/serial/8250/8250_omap.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,25 +1618,35 @@ static int omap8250_suspend(struct device *dev)
16181618
{
16191619
struct omap8250_priv *priv = dev_get_drvdata(dev);
16201620
struct uart_8250_port *up = serial8250_get_port(priv->line);
1621+
int err;
16211622

16221623
serial8250_suspend_port(priv->line);
16231624

1624-
pm_runtime_get_sync(dev);
1625+
err = pm_runtime_resume_and_get(dev);
1626+
if (err)
1627+
return err;
16251628
if (!device_may_wakeup(dev))
16261629
priv->wer = 0;
16271630
serial_out(up, UART_OMAP_WER, priv->wer);
1628-
pm_runtime_mark_last_busy(dev);
1629-
pm_runtime_put_autosuspend(dev);
1630-
1631+
err = pm_runtime_force_suspend(dev);
16311632
flush_work(&priv->qos_work);
1632-
return 0;
1633+
1634+
return err;
16331635
}
16341636

16351637
static int omap8250_resume(struct device *dev)
16361638
{
16371639
struct omap8250_priv *priv = dev_get_drvdata(dev);
1640+
int err;
16381641

1642+
err = pm_runtime_force_resume(dev);
1643+
if (err)
1644+
return err;
16391645
serial8250_resume_port(priv->line);
1646+
/* Paired with pm_runtime_resume_and_get() in omap8250_suspend() */
1647+
pm_runtime_mark_last_busy(dev);
1648+
pm_runtime_put_autosuspend(dev);
1649+
16401650
return 0;
16411651
}
16421652

0 commit comments

Comments
 (0)