Re: [PATCH 4/5] serial: 8250: omap: Support wakeup pinctrl state

From: Andy Shevchenko
Date: Mon May 27 2024 - 12:35:28 EST


On Thu, May 23, 2024 at 09:58:18AM +0200, Markus Schneider-Pargmann wrote:
> UART can be used as a wakeup source for am62 from a powered-off SoC
> state. To enable wakeup from UART am62 requires a wakeup flag being set
> in the pinctrl.
>
> If the device is marked as wakeup enabled, select the 'wakeup' pinctrl
> state on sys_off.

..

> #include <linux/pm_qos.h>
> #include <linux/pm_wakeirq.h>
> #include <linux/dma-mapping.h>

> +#include <linux/reboot.h>

See below.

> #include <linux/sys_soc.h>
> #include <linux/pm_domain.h>

> +#include <linux/pinctrl/consumer.h>

Can we make some order here and put this before above pm_*.h or even earlier
according to the alphabet?

..

> + priv->pinctrl = devm_pinctrl_get(&pdev->dev);
> + if (!IS_ERR_OR_NULL(priv->pinctrl))

Shouldn't we report an error to the user? I assume that NULL is for optional
pin control, otherwise it's an error state which at bare minimum has to be
reported.

> + priv->pinctrl_wakeup = pinctrl_lookup_state(priv->pinctrl, "wakeup");

> + devm_register_sys_off_handler(&pdev->dev,

No error check?

> + SYS_OFF_MODE_POWER_OFF_PREPARE,
> + SYS_OFF_PRIO_DEFAULT,
> + omap8250_sysoff_handler, NULL);
> +

--
With Best Regards,
Andy Shevchenko