[PATCH 4/4] serial: 8250_pnp: Override pnp suspend for no_console_suspend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Prevent PNP bus from powering down the serial console device
when suspending if the no_console_suspend command line option is set.

Signed-off-by: Peter Hurley <peter@xxxxxxxxxxxxxxxxxx>
---
 drivers/tty/serial/8250/8250_pnp.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_pnp.c b/drivers/tty/serial/8250/8250_pnp.c
index 50b7c89..f603581 100644
--- a/drivers/tty/serial/8250/8250_pnp.c
+++ b/drivers/tty/serial/8250/8250_pnp.c
@@ -487,7 +487,7 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
 
 	if (uart_console(&port8250->port) && !console_suspend_enabled) {
 		info->override_disable = !!(dev->capabilities & PNP_DISABLE);
-		dev->capabilities &= ~PNP_DISABLE;
+		dev->capabilities &= ~(PNP_DISABLE | PNP_SUSPEND);
 	}
 
 	pnp_set_drvdata(dev, info);
@@ -502,6 +502,7 @@ static void serial_pnp_remove(struct pnp_dev *dev)
 		serial8250_unregister_port(info->line);
 		if (info->override_disable)
 			dev->capabilities |= PNP_DISABLE;
+		dev->capabilities |= PNP_SUSPEND;
 	}
 }
 
@@ -519,10 +520,25 @@ static int serial_pnp_suspend(struct pnp_dev *dev, pm_message_t state)
 static int serial_pnp_resume(struct pnp_dev *dev)
 {
 	struct serial_pnp_info *info = pnp_get_drvdata(dev);
+	unsigned int ier, mcr, lcr, dll, dlm;
+	struct uart_8250_port *port8250;
 
 	if (!info)
 		return -ENODEV;
+
+	port8250 = serial8250_get_port(info->line);
+	ier = serial_port_in(&port8250->port, UART_IER);
+	mcr = serial_port_in(&port8250->port, UART_MCR);
+	lcr = serial_port_in(&port8250->port, UART_LCR);
+	serial_port_out(&port8250->port, UART_LCR, lcr | UART_LCR_DLAB);
+	dll = serial_port_in(&port8250->port, UART_DLL);
+	dlm = serial_port_in(&port8250->port, UART_DLM);
+	serial_port_out(&port8250->port, UART_LCR, lcr & ~UART_LCR_DLAB);
+
 	serial8250_resume_port(info->line);
+
+	dev_info(&dev->dev, "IER:%02x MCR:%02x LCR:%02x DL:%02x%02x\n",
+		 ier, mcr, lcr, dlm, dll);
 	return 0;
 }
 #else
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux