Re: [PATCH v4 tty-next 3/3] 8250: microchip: pci1xxxx: Add power management functions to quad-uart driver

From: Andy Shevchenko
Date: Fri Nov 11 2022 - 11:45:28 EST


On Fri, Nov 11, 2022 at 09:41:30PM +0530, Kumaravel Thiagarajan wrote:
> pci1xxxx's quad-uart function has the capability to wake up the host

UART

> from suspend state. Enable wakeup before entering into suspend and
> disable wakeup on resume.

> Signed-off-by: Tharun Kumar P <tharunkumar.pasumarthi@xxxxxxxxxxxxx>
> Signed-off-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@xxxxxxxxxxxxx>

No Co-developed-by?

> +static bool pci1xxxx_port_suspend(int line)
> +{
> + struct uart_8250_port *up = serial8250_get_port(line);
> + struct uart_port *port = &up->port;
> + struct tty_port *tport = &port->state->port;
> + unsigned long flags;
> + bool ret = false;
> + u8 wakeup_mask;
> +
> + mutex_lock(&tport->mutex);
> + if (port->suspended == 0 && port->dev) {
> + wakeup_mask = readb(up->port.membase + UART_WAKE_MASK_REG);
> +
> + spin_lock_irqsave(&port->lock, flags);
> + port->mctrl &= ~TIOCM_OUT2;
> + port->ops->set_mctrl(port, port->mctrl);
> + spin_unlock_irqrestore(&port->lock, flags);

> + if ((wakeup_mask & UART_WAKE_SRCS) != UART_WAKE_SRCS)
> + ret = true;

Can be
ret = (wakeup_mask & UART_WAKE_SRCS) != UART_WAKE_SRCS;

> + }
> +
> + writeb(UART_WAKE_SRCS, port->membase + UART_WAKE_REG);
> + mutex_unlock(&tport->mutex);
> +
> + return ret;
> +}

--
With Best Regards,
Andy Shevchenko