All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] serial-core: reset the console speed on resume
@ 2011-01-25 10:43 Yin Kangkai
  2011-01-30  0:20 ` Stanislav Brabec
  2011-01-30  3:15 ` [PATCH Resend] " Yin Kangkai
  0 siblings, 2 replies; 4+ messages in thread
From: Yin Kangkai @ 2011-01-25 10:43 UTC (permalink / raw)
  To: linux-serial
  Cc: Greg KH, Deepak Saxena, Jason Wang, Stanislav Brabec, Daniel Drake, LKML

Hi all,

On some platforms, we need to restore the console speed on resume even
it was not suspended (no_console_suspend), and on others we don't have
to do that.

So don't care about the "console_suspend_enabled" and unconditionally
reset the console speed if it is a console.


This is actually a redo of ba15ab0 (Set proper console speed on resume
if console suspend is disabled) from Deepak Saxena.  I also tried to
investigate more to find out if this change will break others, here is
what I've found out:


commit 891b9dd10764352926e1e107756aa229dfa2c210
Author: Jason Wang <jason77.wang@gmail.com>
    serial-core: restore termios settings when resume console ports

commit ca2e71aa8cfb0056ce720f3fd53f59f5fac4a3e1
Author: Jason Wang <jason77.wang@gmail.com>
    serial-core: skip call set_termios/console_start when no_console_suspend

commit 4547be7809a3b775ce750ec7f8b5748954741523
Author: Stanislav Brabec <sbrabec@suse.cz>
    serial-core: resume serial hardware with no_console_suspend

commit ba15ab0e8de0d4439a91342ad52d55ca9e313f3d
Author: Deepak Saxena <dsaxena@laptop.org>
    Set proper console speed on resume if console suspend is disabled

from ba15ab0, we learned that, even if the console suspend is disabled
(when no_console_suspend is set), we may still need to "reset the port
to the state it was in before we suspended."

Then with 4547be7, this piece of code is removed.

And then Jason Wang added that back in ca2e71a and 891b9dd, to fix
some breakage on OMAP3EVM platform. From ca2e71a we learned that the
"set_termios" things is actually needed by both console is suspended
and not suspended.

That's why I removed the console_suspended_enabled condition, and only
call console_start() when we actually suspeneded it.

I also noticed in this thread:
http://marc.info/?t=129079257100004&r=1&w=2, which talked about on
some platforms, UART HW will be cut power whether or not we set
no_console_suspend, and then on resume it does not work quite well. I
have a similar HW, and this patch fixed this issue, don't know if this
patch also works on their platforms.

Thanks,
Kangkai


>From 71a5c8e88f91febcd3714bf645023a5b9a4885d8 Mon Sep 17 00:00:00 2001
From: Yin Kangkai <kangkai.yin@intel.com>
Date: Mon, 24 Jan 2011 18:07:02 +0800
Subject: [PATCH] serial-core: reset the console speed on resume

On some platforms, we need to restore the console speed on resume even
it was not suspended (no_console_suspend), and on others we don't have
to do that.

So don't care about the "console_suspend_enabled" and unconditionally
reset the console speed if it is a console.

Signed-off-by: Yin Kangkai <kangkai.yin@intel.com>
---
 drivers/serial/serial_core.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 9ffa5be..af4a4c1 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -2060,7 +2060,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
 	/*
 	 * Re-enable the console device after suspending.
 	 */
-	if (console_suspend_enabled && uart_console(uport)) {
+	if (uart_console(uport)) {
 		/*
 		 * First try to use the console cflag setting.
 		 */
@@ -2073,9 +2073,9 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
 		if (port->tty && port->tty->termios && termios.c_cflag == 0)
 			termios = *(port->tty->termios);
 
-		uart_change_pm(state, 0);
 		uport->ops->set_termios(uport, &termios, NULL);
-		console_start(uport->cons);
+		if (console_suspend_enabled)
+			console_start(uport->cons);
 	}
 
 	if (port->flags & ASYNC_SUSPENDED) {
-- 
1.6.5

-- 
Don't worry, be happy.

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

* Re: [PATCH RFC] serial-core: reset the console speed on resume
  2011-01-25 10:43 [PATCH RFC] serial-core: reset the console speed on resume Yin Kangkai
@ 2011-01-30  0:20 ` Stanislav Brabec
  2011-01-30  2:25   ` Yin Kangkai
  2011-01-30  3:15 ` [PATCH Resend] " Yin Kangkai
  1 sibling, 1 reply; 4+ messages in thread
From: Stanislav Brabec @ 2011-01-30  0:20 UTC (permalink / raw)
  To: Yin Kangkai
  Cc: linux-serial, Greg KH, Deepak Saxena, Jason Wang, Daniel Drake, LKML

Yin Kangkai wrote on Tue 25 Jan 2011 at 18:43 +0800:

> On some platforms, we need to restore the console speed on resume even
> it was not suspended (no_console_suspend), and on others we don't have
> to do that.
> 
> So don't care about the "console_suspend_enabled" and unconditionally
> reset the console speed if it is a console.

Well, there is currently another breakage on Zaurus. But it improves the
situation.
(Note: Your patch has bad file path. I'll agree with such change after
this fix.)

Test report on Zaurus
(serial hardware itself is in undefined state after resume):

                                       before  after
login:                                   OK     OK
console:                               broken broken
console + login:                         OK     OK
console + no_console_suspend:          broken broken
login + no_console_suspend:              OK     OK
console + login + no_console_suspend:  broken   OK

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                          e-mail: sbrabec@suse.cz
Lihovarská 1060/12                            tel: +49 911 7405384547
190 00 Praha 9                                  fax: +420 284 028 951
Czech Republic                                    http://www.suse.cz/


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

* Re: [PATCH RFC] serial-core: reset the console speed on resume
  2011-01-30  0:20 ` Stanislav Brabec
@ 2011-01-30  2:25   ` Yin Kangkai
  0 siblings, 0 replies; 4+ messages in thread
From: Yin Kangkai @ 2011-01-30  2:25 UTC (permalink / raw)
  To: Stanislav Brabec
  Cc: linux-serial, Greg KH, Deepak Saxena, Jason Wang, Daniel Drake, LKML

On 2011-01-30, 01:20 +0100, Stanislav Brabec wrote:
> Yin Kangkai wrote on Tue 25 Jan 2011 at 18:43 +0800:
> 
> > On some platforms, we need to restore the console speed on resume even
> > it was not suspended (no_console_suspend), and on others we don't have
> > to do that.
> > 
> > So don't care about the "console_suspend_enabled" and unconditionally
> > reset the console speed if it is a console.
> 
> Well, there is currently another breakage on Zaurus. But it improves the
> situation.
> (Note: Your patch has bad file path. I'll agree with such change after
> this fix.)

OK, I was based on .37 stable kernel. Will base on linus tree and
resend the patch right away. Thanks.

> Test report on Zaurus
> (serial hardware itself is in undefined state after resume):
> 
>                                        before  after
> login:                                   OK     OK
> console:                               broken broken
> console + login:                         OK     OK
> console + no_console_suspend:          broken broken
> login + no_console_suspend:              OK     OK
> console + login + no_console_suspend:  broken   OK

Thanks for the test, Stanislav. Good to know it improves the
situation.

Regards,
Kangkai

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

* [PATCH Resend] serial-core: reset the console speed on resume
  2011-01-25 10:43 [PATCH RFC] serial-core: reset the console speed on resume Yin Kangkai
  2011-01-30  0:20 ` Stanislav Brabec
@ 2011-01-30  3:15 ` Yin Kangkai
  1 sibling, 0 replies; 4+ messages in thread
From: Yin Kangkai @ 2011-01-30  3:15 UTC (permalink / raw)
  To: linux-serial
  Cc: linux-kernel, Yin Kangkai, Greg KH, Deepak Saxena, Jason Wang,
	Stanislav Brabec, Daniel Drake

On some platforms, we need to restore the console speed on resume even
it was not suspended (no_console_suspend), and on others we don't have
to do that.

So don't care about the "console_suspend_enabled" and unconditionally
reset the console speed if it is a console.

This is actually a redo of ba15ab0 (Set proper console speed on resume
if console suspend is disabled) from Deepak Saxena.  I also tried to
investigate more to find out if this change will break others, here is
what I've found out:

commit 891b9dd10764352926e1e107756aa229dfa2c210
Author: Jason Wang <jason77.wang@gmail.com>
    serial-core: restore termios settings when resume console ports

commit ca2e71aa8cfb0056ce720f3fd53f59f5fac4a3e1
Author: Jason Wang <jason77.wang@gmail.com>
    serial-core: skip call set_termios/console_start when no_console_suspend

commit 4547be7809a3b775ce750ec7f8b5748954741523
Author: Stanislav Brabec <sbrabec@suse.cz>
    serial-core: resume serial hardware with no_console_suspend

commit ba15ab0e8de0d4439a91342ad52d55ca9e313f3d
Author: Deepak Saxena <dsaxena@laptop.org>
    Set proper console speed on resume if console suspend is disabled

from ba15ab0, we learned that, even if the console suspend is disabled
(when no_console_suspend is set), we may still need to "reset the port
to the state it was in before we suspended."

Then with 4547be7, this piece of code is removed.

And then Jason Wang added that back in ca2e71a and 891b9dd, to fix
some breakage on OMAP3EVM platform. From ca2e71a we learned that the
"set_termios" things is actually needed by both console is suspended
and not suspended.

That's why I removed the console_suspended_enabled condition, and only
call console_start() when we actually suspeneded it.

I also noticed in this thread:
http://marc.info/?t=129079257100004&r=1&w=2, which talked about on
some platforms, UART HW will be cut power whether or not we set
no_console_suspend, and then on resume it does not work quite well. I
have a similar HW, and this patch fixed this issue, don't know if this
patch also works on their platforms.

[Update: Stanislav tested this patch on Zaurus and reported it improves the
situation. Thanks.]

CC: Greg KH <greg@kroah.com>
CC: Deepak Saxena <dsaxena@laptop.org>
CC: Jason Wang <jason77.wang@gmail.com>
CC: Stanislav Brabec <sbrabec@suse.cz>
CC: Daniel Drake <dsd@laptop.org>
Signed-off-by: Yin Kangkai <kangkai.yin@linux.intel.com>
---
 drivers/tty/serial/serial_core.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 460a72d..20563c5 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2064,7 +2064,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
 	/*
 	 * Re-enable the console device after suspending.
 	 */
-	if (console_suspend_enabled && uart_console(uport)) {
+	if (uart_console(uport)) {
 		/*
 		 * First try to use the console cflag setting.
 		 */
@@ -2077,9 +2077,9 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
 		if (port->tty && port->tty->termios && termios.c_cflag == 0)
 			termios = *(port->tty->termios);
 
-		uart_change_pm(state, 0);
 		uport->ops->set_termios(uport, &termios, NULL);
-		console_start(uport->cons);
+		if (console_suspend_enabled)
+			console_start(uport->cons);
 	}
 
 	if (port->flags & ASYNC_SUSPENDED) {
-- 
1.7.2.3


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

end of thread, other threads:[~2011-01-30  3:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-25 10:43 [PATCH RFC] serial-core: reset the console speed on resume Yin Kangkai
2011-01-30  0:20 ` Stanislav Brabec
2011-01-30  2:25   ` Yin Kangkai
2011-01-30  3:15 ` [PATCH Resend] " Yin Kangkai

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.