aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorDeepak Saxena <dsaxena@laptop.org>2009-09-19 16:13:33 -0400
committerLive-CD User <linux@linux.site>2009-09-19 16:13:33 -0400
commitba15ab0e8de0d4439a91342ad52d55ca9e313f3d (patch)
tree9b593e0406eb0a1a11249d3d1b8767aab8206195 /drivers/serial
parent7b01478f97a671c97fad9254aa91892209b018b5 (diff)
Set proper console speed on resume if console suspend is disabled
Commit b5b82df6, from May 2007, breaks no_console_suspend on the OLPC XO laptop. Basically what happens is that upon returning from resume, serial8250_resume_port() will reconfigure the port for high speed mode and all console output will be garbled, making debug of the resume path painful. This patch modifies uart_resume_port() to reset the port to the state it was in before we suspended. Original patch by Marcelo Tosatti Second patch by Deepak then reworked by Alan to fit with the tty changes before it got submitted. Also fixed the console path to set c_i/ospeed as some drivers require the termios fields are valid Signed-off-by: Deepak Saxena <dsaxena@laptop.org> Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/serial_core.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 3fd0134d36bf..2514d00c0f6f 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -2068,11 +2068,29 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
2068 struct tty_port *port = &state->port; 2068 struct tty_port *port = &state->port;
2069 struct device *tty_dev; 2069 struct device *tty_dev;
2070 struct uart_match match = {uport, drv}; 2070 struct uart_match match = {uport, drv};
2071 struct ktermios termios;
2071 2072
2072 mutex_lock(&port->mutex); 2073 mutex_lock(&port->mutex);
2073 2074
2074 if (!console_suspend_enabled && uart_console(uport)) { 2075 if (!console_suspend_enabled && uart_console(uport)) {
2075 /* no need to resume serial console, it wasn't suspended */ 2076 /* no need to resume serial console, it wasn't suspended */
2077 /*
2078 * First try to use the console cflag setting.
2079 */
2080 memset(&termios, 0, sizeof(struct ktermios));
2081 termios.c_cflag = uport->cons->cflag;
2082 /*
2083 * If that's unset, use the tty termios setting.
2084 */
2085 if (termios.c_cflag == 0)
2086 termios = *state->port.tty->termios;
2087 else {
2088 termios.c_ispeed = termios.c_ospeed =
2089 tty_termios_input_baud_rate(&termios);
2090 termios.c_ispeed = termios.c_ospeed =
2091 tty_termios_baud_rate(&termios);
2092 }
2093 uport->ops->set_termios(uport, &termios, NULL);
2076 mutex_unlock(&port->mutex); 2094 mutex_unlock(&port->mutex);
2077 return 0; 2095 return 0;
2078 } 2096 }
@@ -2089,20 +2107,6 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
2089 * Re-enable the console device after suspending. 2107 * Re-enable the console device after suspending.
2090 */ 2108 */
2091 if (uart_console(uport)) { 2109 if (uart_console(uport)) {
2092 struct ktermios termios;
2093
2094 /*
2095 * First try to use the console cflag setting.
2096 */
2097 memset(&termios, 0, sizeof(struct ktermios));
2098 termios.c_cflag = uport->cons->cflag;
2099
2100 /*
2101 * If that's unset, use the tty termios setting.
2102 */
2103 if (port->tty && termios.c_cflag == 0)
2104 termios = *port->tty->termios;
2105
2106 uart_change_pm(state, 0); 2110 uart_change_pm(state, 0);
2107 uport->ops->set_termios(uport, &termios, NULL); 2111 uport->ops->set_termios(uport, &termios, NULL);
2108 console_start(uport->cons); 2112 console_start(uport->cons);