summaryrefslogtreecommitdiff
path: root/drivers/tty
diff options
context:
space:
mode:
authorDouglas Anderson <dianders@chromium.org>2023-03-16 13:20:56 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-29 10:51:52 +0200
commit5e227ef2aa388f14ceeafa65eb8a38fa37918eb4 (patch)
tree7dbdeb2f91221e5a3c209588c371879c09dd7c8a /drivers/tty
parentafe3154ba87e798de87ab65c72d6e3f6cd32d9d1 (diff)
downloadlwn-5e227ef2aa388f14ceeafa65eb8a38fa37918eb4.tar.gz
lwn-5e227ef2aa388f14ceeafa65eb8a38fa37918eb4.zip
serial: uart_poll_init() should power on the UART
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> Link: https://lore.kernel.org/r/20230316132027.RESEND.1.I106c39498d8094c6f5e7ada42c7db17aa5c64e48@changeid Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/serial_core.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index db7f6c0c39bf..afafbb7edb4a 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2590,6 +2590,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;
@@ -2607,6 +2608,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,
@@ -2623,6 +2627,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;
}