All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Hurley <peter@hurleysoftware.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	Jiri Slaby <jslaby@suse.cz>,
	Peter Hurley <peter@hurleysoftware.com>
Subject: [PATCH 4/4] serial: 8250_pnp: Override pnp suspend for no_console_suspend
Date: Wed,  5 Nov 2014 13:40:54 -0500	[thread overview]
Message-ID: <1415212854-16944-5-git-send-email-peter@hurleysoftware.com> (raw)
In-Reply-To: <1415212854-16944-1-git-send-email-peter@hurleysoftware.com>

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@hurleysoftware.com>
---
 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

  parent reply	other threads:[~2014-11-05 18:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-05 18:40 [PATCH 0/4] fix serial console suspend on PNP Peter Hurley
2014-11-05 18:40 ` [PATCH 1/4] serial: core: Simplify console suspend logic in uart_suspend_port() Peter Hurley
2014-11-05 18:40 ` [PATCH 2/4] serial: 8250_pnp: Override pnp disable for no_console_suspend Peter Hurley
2014-11-05 18:40 ` [PATCH 3/4] PNP: Allow device to override ACPI device sleep Peter Hurley
2014-11-05 22:28   ` Rafael J. Wysocki
2014-11-05 22:14     ` Peter Hurley
2014-11-05 18:40 ` Peter Hurley [this message]
2014-11-05 18:45   ` [PATCH 4/4] serial: 8250_pnp: Override pnp suspend for no_console_suspend Peter Hurley
2014-11-05 19:02   ` [PATCH v2 " Peter Hurley
2014-11-06 19:06 ` [PATCH 0/4] fix serial console suspend on PNP Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1415212854-16944-5-git-send-email-peter@hurleysoftware.com \
    --to=peter@hurleysoftware.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.