linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Fix no_console_suspend for PNP serial consoles
@ 2015-01-22 16:50 Peter Hurley
  2015-01-22 16:50 ` [PATCH v2 1/2] PNP: Allow console to override ACPI device sleep Peter Hurley
  2015-01-22 16:50 ` [PATCH v2 2/2] serial: 8250_pnp: Enable PNP_CONSOLE for console ports Peter Hurley
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Hurley @ 2015-01-22 16:50 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki
  Cc: linux-kernel, linux-serial, Peter Hurley

Hi Greg and Rafael,

This v2 of the earlier series submitted back in Nov addresses Rafael's
comments, specifically:

* Adds PNP_CONSOLE flag, which disables the pnp protocol's suspend() and
  disable() methods.

This greatly simplifies the PNP serial driver patch since the existing
pnp device capabilities does not need to be saved and restored now.

Note that it was necessary to continue to use macros, since
struct pnp_protocol is anonymous.

Regards,

Peter Hurley (2):
  PNP: Allow console to override ACPI device sleep
  serial: 8250_pnp: Enable PNP_CONSOLE for console ports

 drivers/pnp/driver.c               |  2 +-
 drivers/tty/serial/8250/8250_pnp.c |  8 +++++++-
 include/linux/pnp.h                | 12 ++++++++++--
 3 files changed, 18 insertions(+), 4 deletions(-)

-- 
2.2.2

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 1/2] PNP: Allow console to override ACPI device sleep
  2015-01-22 16:50 [PATCH v2 0/2] Fix no_console_suspend for PNP serial consoles Peter Hurley
@ 2015-01-22 16:50 ` Peter Hurley
  2015-01-22 16:50 ` [PATCH v2 2/2] serial: 8250_pnp: Enable PNP_CONSOLE for console ports Peter Hurley
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Hurley @ 2015-01-22 16:50 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki
  Cc: linux-kernel, linux-serial, Peter Hurley

If the serial console is an ACPI PNP device, the PNP bus always powers
down the device at system suspend, even though the no_console_suspend
command line parameter is specified (eg., when debugging suspend/resume).

Add PNP_CONSOLE capability, which when set, prevents calling both the
->disable() and ->suspend() PNP protocol methods if console suspend
is disabled.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
 drivers/pnp/driver.c |  2 +-
 include/linux/pnp.h  | 12 ++++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
index f748cc8..4e57d33 100644
--- a/drivers/pnp/driver.c
+++ b/drivers/pnp/driver.c
@@ -182,7 +182,7 @@ static int __pnp_bus_suspend(struct device *dev, pm_message_t state)
 			return error;
 	}
 
-	if (pnp_dev->protocol->suspend)
+	if (pnp_can_suspend(pnp_dev))
 		pnp_dev->protocol->suspend(pnp_dev, state);
 	return 0;
 }
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 195aafc..6512e9c 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -12,6 +12,7 @@
 #include <linux/list.h>
 #include <linux/errno.h>
 #include <linux/mod_devicetable.h>
+#include <linux/console.h>
 
 #define PNP_NAME_LEN		50
 
@@ -309,15 +310,22 @@ struct pnp_fixup {
 #define PNP_DISABLE		0x0004
 #define PNP_CONFIGURABLE	0x0008
 #define PNP_REMOVABLE		0x0010
+#define PNP_CONSOLE		0x0020
 
 #define pnp_can_read(dev)	(((dev)->protocol->get) && \
 				 ((dev)->capabilities & PNP_READ))
 #define pnp_can_write(dev)	(((dev)->protocol->set) && \
 				 ((dev)->capabilities & PNP_WRITE))
-#define pnp_can_disable(dev)	(((dev)->protocol->disable) && \
-				 ((dev)->capabilities & PNP_DISABLE))
+#define pnp_can_disable(dev)	(((dev)->protocol->disable) &&		  \
+				 ((dev)->capabilities & PNP_DISABLE) &&	  \
+				 (!((dev)->capabilities & PNP_CONSOLE) || \
+				  console_suspend_enabled))
 #define pnp_can_configure(dev)	((!(dev)->active) && \
 				 ((dev)->capabilities & PNP_CONFIGURABLE))
+#define pnp_can_suspend(dev)	(((dev)->protocol->suspend) &&		  \
+				 (!((dev)->capabilities & PNP_CONSOLE) || \
+				  console_suspend_enabled))
+
 
 #ifdef CONFIG_ISAPNP
 extern struct pnp_protocol isapnp_protocol;
-- 
2.2.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2 2/2] serial: 8250_pnp: Enable PNP_CONSOLE for console ports
  2015-01-22 16:50 [PATCH v2 0/2] Fix no_console_suspend for PNP serial consoles Peter Hurley
  2015-01-22 16:50 ` [PATCH v2 1/2] PNP: Allow console to override ACPI device sleep Peter Hurley
@ 2015-01-22 16:50 ` Peter Hurley
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Hurley @ 2015-01-22 16:50 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki
  Cc: linux-kernel, linux-serial, Peter Hurley

When the kernel command line parameter, no_console_suspend, is used,
the console should continue to output console messages during and
after system suspend. For a serial console, the serial core ensures
that the device is not shutdown when no_console_suspend is specified.
However, the default operation of the pnp bus will disable and suspend
the device and no further output occurs.

When registering the 8250 port, if the serial device is a console
set the PNP_CONSOLE capability, which prevents device power-off
if consoles are not suspending.

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

diff --git a/drivers/tty/serial/8250/8250_pnp.c b/drivers/tty/serial/8250/8250_pnp.c
index 682a2fb..50a09cd 100644
--- a/drivers/tty/serial/8250/8250_pnp.c
+++ b/drivers/tty/serial/8250/8250_pnp.c
@@ -426,7 +426,7 @@ static int serial_pnp_guess_board(struct pnp_dev *dev)
 static int
 serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
 {
-	struct uart_8250_port uart;
+	struct uart_8250_port uart, *port;
 	int ret, line, flags = dev_id->driver_data;
 
 	if (flags & UNKNOWN_DEV) {
@@ -471,6 +471,10 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
 	if (line < 0 || (flags & CIR_PORT))
 		return -ENODEV;
 
+	port = serial8250_get_port(line);
+	if (uart_console(&port->port))
+		dev->capabilities |= PNP_CONSOLE;
+
 	pnp_set_drvdata(dev, (void *)((long)line + 1));
 	return 0;
 }
@@ -478,6 +482,8 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
 static void serial_pnp_remove(struct pnp_dev *dev)
 {
 	long line = (long)pnp_get_drvdata(dev);
+
+	dev->capabilities &= ~PNP_CONSOLE;
 	if (line)
 		serial8250_unregister_port(line - 1);
 }
-- 
2.2.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-22 16:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-22 16:50 [PATCH v2 0/2] Fix no_console_suspend for PNP serial consoles Peter Hurley
2015-01-22 16:50 ` [PATCH v2 1/2] PNP: Allow console to override ACPI device sleep Peter Hurley
2015-01-22 16:50 ` [PATCH v2 2/2] serial: 8250_pnp: Enable PNP_CONSOLE for console ports Peter Hurley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).