[RESEND,1/2] serial: uart_poll_init() should power on the UART
Commit Message
On Qualcomm devices which use the "geni" serial driver, kdb/kgdb won't
be very happy if you use it but the resources of the port haven't been
powered on. Today kdb/kgdb rely on someone else powering the port
on. This could be the normal kernel console or an agetty running.
Let's fix this to explicitly power things on when setting up a polling
driver.
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---
drivers/tty/serial/serial_core.c | 6 ++++++
1 file changed, 6 insertions(+)
@@ -2593,6 +2593,7 @@ static int uart_poll_init(struct tty_driver *driver, int line, char *options)
{
struct uart_driver *drv = driver->driver_state;
struct uart_state *state = drv->state + line;
+ enum uart_pm_state pm_state;
struct tty_port *tport;
struct uart_port *port;
int baud = 9600;
@@ -2610,6 +2611,9 @@ static int uart_poll_init(struct tty_driver *driver, int line, char *options)
goto out;
}
+ pm_state = state->pm_state;
+ uart_change_pm(state, UART_PM_STATE_ON);
+
if (port->ops->poll_init) {
/*
* We don't set initialized as we only initialized the hw,
@@ -2626,6 +2630,8 @@ static int uart_poll_init(struct tty_driver *driver, int line, char *options)
console_list_unlock();
}
out:
+ if (ret)
+ uart_change_pm(state, pm_state);
mutex_unlock(&tport->mutex);
return ret;
}