Re: [PATCH 5/5] serial: 8250: omap: Set wakeup pinctrl on suspend

From: Kevin Hilman
Date: Tue Jul 30 2024 - 17:23:04 EST


Markus Schneider-Pargmann <msp@xxxxxxxxxxxx> writes:

> To enable the serial driver and it's pin to be a wakeup source in
> suspend to ram states, select the wakeup pinctrl state on suspend and
> restore the default pinctrl state on resume.
>
> Signed-off-by: Markus Schneider-Pargmann <msp@xxxxxxxxxxxx>

Reviewed-by: Kevin Hilman <khilman@xxxxxxxxxxxx>

but with a minor nit below...

> ---
> drivers/tty/serial/8250/8250_omap.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
> index 617a421a1396..61f056c4e78e 100644
> --- a/drivers/tty/serial/8250/8250_omap.c
> +++ b/drivers/tty/serial/8250/8250_omap.c
> @@ -1663,6 +1663,13 @@ static int omap8250_suspend(struct device *dev)
> struct generic_pm_domain *genpd = pd_to_genpd(dev->pm_domain);
> int err = 0;
>
> + err = omap8250_select_wakeup_pinctrl(dev, priv);
> + if (err) {
> + dev_err(dev, "Failed to select wakeup pinctrl, aborting suspend %pe\n",
> + ERR_PTR(err));
> + return err;
> + }
> +
> serial8250_suspend_port(priv->line);
>
> err = pm_runtime_resume_and_get(dev);
> @@ -1696,6 +1703,13 @@ static int omap8250_resume(struct device *dev)
> struct generic_pm_domain *genpd = pd_to_genpd(dev->pm_domain);
> int err;
>
> + err = pinctrl_select_default_state(dev);
> + if (err) {
> + dev_err(dev, "Failed to select default pinctrl state on resume: %pe\n",
> + ERR_PTR(err));
> + return err;
> + }

Shouldn't this bit should be at the end of this resume function?
Otherwise, if this fails, the UART could be left unusable, and if it's
the console UART, you wouldn't get any logs to know why.

> if (uart_console(&up->port) && console_suspend_enabled) {
> if (console_suspend_enabled) {
> err = pm_runtime_force_resume(dev);
> --
> 2.43.0

Kevin