* [PATCH] serial-core: power up uart port early before we do set_termios when resuming
@ 2011-09-05 8:28 Ning Jiang
2011-09-05 9:17 ` Mayank Rana
2011-09-05 14:03 ` Yin Kangkai
0 siblings, 2 replies; 4+ messages in thread
From: Ning Jiang @ 2011-09-05 8:28 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Alan Cox, Yin Kangkai, linux-serial
The following patch removed uart_change_pm() in uart_resume_port():
commit 5933a161abcb8d83a2c145177f48027c3c0a8995
Author: Yin Kangkai <kangkai.yin@linux.intel.com>
serial-core: reset the console speed on resume
It will break the pxa serial driver when the system resumes from suspend mode
as it will try to set baud rate divider register in set_termios but with
clock off. The register value can not be set correctly on some platform if
the clock is disabled. The pxa driver will check the value and report the
following warning:
------------[ cut here ]------------
WARNING: at drivers/tty/serial/pxa.c:545 serial_pxa_set_termios+0x1dc/0x250()
Modules linked in:
[<c0281f30>] (unwind_backtrace+0x0/0xf0) from [<c029341c>] (warn_slowpath_common+0x4c/0x64)
[<c029341c>] (warn_slowpath_common+0x4c/0x64) from [<c029344c>] (warn_slowpath_null+0x18/0x1c)
[<c029344c>] (warn_slowpath_null+0x18/0x1c) from [<c044b1e4>] (serial_pxa_set_termios+0x1dc/0x250)
[<c044b1e4>] (serial_pxa_set_termios+0x1dc/0x250) from [<c044a840>] (uart_resume_port+0x128/0x2dc)
[<c044a840>] (uart_resume_port+0x128/0x2dc) from [<c044bbe0>] (serial_pxa_resume+0x18/0x24)
[<c044bbe0>] (serial_pxa_resume+0x18/0x24) from [<c0454d34>] (platform_pm_resume+0x40/0x4c)
[<c0454d34>] (platform_pm_resume+0x40/0x4c) from [<c0457ebc>] (pm_op+0x68/0xb4)
[<c0457ebc>] (pm_op+0x68/0xb4) from [<c0458368>] (device_resume+0xb0/0xec)
[<c0458368>] (device_resume+0xb0/0xec) from [<c04584c8>] (dpm_resume+0xe0/0x194)
[<c04584c8>] (dpm_resume+0xe0/0x194) from [<c0458588>] (dpm_resume_end+0xc/0x18)
[<c0458588>] (dpm_resume_end+0xc/0x18) from [<c02c518c>] (suspend_devices_and_enter+0x16c/0x1ac)
[<c02c518c>] (suspend_devices_and_enter+0x16c/0x1ac) from [<c02c5278>] (enter_state+0xac/0xdc)
[<c02c5278>] (enter_state+0xac/0xdc) from [<c02c48ec>] (state_store+0xa0/0xbc)
[<c02c48ec>] (state_store+0xa0/0xbc) from [<c0408f7c>] (kobj_attr_store+0x18/0x1c)
[<c0408f7c>] (kobj_attr_store+0x18/0x1c) from [<c034a6a4>] (sysfs_write_file+0x108/0x140)
[<c034a6a4>] (sysfs_write_file+0x108/0x140) from [<c02fb798>] (vfs_write+0xac/0x134)
[<c02fb798>] (vfs_write+0xac/0x134) from [<c02fb8cc>] (sys_write+0x3c/0x68)
[<c02fb8cc>] (sys_write+0x3c/0x68) from [<c027c700>] (ret_fast_syscall+0x0/0x2c)
---[ end trace 88289eceb4675b04 ]---
This patch fix the problem by adding the power on opertion back for uart
console when console_suspend_enabled is true.
Signed-off-by: Ning Jiang <ning.jiang@marvell.com>
---
drivers/tty/serial/serial_core.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 5c04cb9..4f75918 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1981,6 +1981,8 @@ 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);
+ if (console_suspend_enabled)
+ uart_change_pm(state, 0);
uport->ops->set_termios(uport, &termios, NULL);
if (console_suspend_enabled)
console_start(uport->cons);
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] serial-core: power up uart port early before we do set_termios when resuming
2011-09-05 8:28 [PATCH] serial-core: power up uart port early before we do set_termios when resuming Ning Jiang
@ 2011-09-05 9:17 ` Mayank Rana
2011-09-06 2:23 ` Ning Jiang
2011-09-05 14:03 ` Yin Kangkai
1 sibling, 1 reply; 4+ messages in thread
From: Mayank Rana @ 2011-09-05 9:17 UTC (permalink / raw)
To: Ning Jiang; +Cc: Greg Kroah-Hartman, Alan Cox, Yin Kangkai, linux-serial
On 9/5/2011 1:58 PM, Ning Jiang wrote:
> The following patch removed uart_change_pm() in uart_resume_port():
>
> commit 5933a161abcb8d83a2c145177f48027c3c0a8995
> Author: Yin Kangkai<kangkai.yin@linux.intel.com>
> serial-core: reset the console speed on resume
>
> It will break the pxa serial driver when the system resumes from suspend mode
> as it will try to set baud rate divider register in set_termios but with
> clock off. The register value can not be set correctly on some platform if
> the clock is disabled. The pxa driver will check the value and report the
> following warning:
>
> ------------[ cut here ]------------
> WARNING: at drivers/tty/serial/pxa.c:545 serial_pxa_set_termios+0x1dc/0x250()
> Modules linked in:
> [<c0281f30>] (unwind_backtrace+0x0/0xf0) from [<c029341c>] (warn_slowpath_common+0x4c/0x64)
> [<c029341c>] (warn_slowpath_common+0x4c/0x64) from [<c029344c>] (warn_slowpath_null+0x18/0x1c)
> [<c029344c>] (warn_slowpath_null+0x18/0x1c) from [<c044b1e4>] (serial_pxa_set_termios+0x1dc/0x250)
> [<c044b1e4>] (serial_pxa_set_termios+0x1dc/0x250) from [<c044a840>] (uart_resume_port+0x128/0x2dc)
> [<c044a840>] (uart_resume_port+0x128/0x2dc) from [<c044bbe0>] (serial_pxa_resume+0x18/0x24)
> [<c044bbe0>] (serial_pxa_resume+0x18/0x24) from [<c0454d34>] (platform_pm_resume+0x40/0x4c)
> [<c0454d34>] (platform_pm_resume+0x40/0x4c) from [<c0457ebc>] (pm_op+0x68/0xb4)
> [<c0457ebc>] (pm_op+0x68/0xb4) from [<c0458368>] (device_resume+0xb0/0xec)
> [<c0458368>] (device_resume+0xb0/0xec) from [<c04584c8>] (dpm_resume+0xe0/0x194)
> [<c04584c8>] (dpm_resume+0xe0/0x194) from [<c0458588>] (dpm_resume_end+0xc/0x18)
> [<c0458588>] (dpm_resume_end+0xc/0x18) from [<c02c518c>] (suspend_devices_and_enter+0x16c/0x1ac)
> [<c02c518c>] (suspend_devices_and_enter+0x16c/0x1ac) from [<c02c5278>] (enter_state+0xac/0xdc)
> [<c02c5278>] (enter_state+0xac/0xdc) from [<c02c48ec>] (state_store+0xa0/0xbc)
> [<c02c48ec>] (state_store+0xa0/0xbc) from [<c0408f7c>] (kobj_attr_store+0x18/0x1c)
> [<c0408f7c>] (kobj_attr_store+0x18/0x1c) from [<c034a6a4>] (sysfs_write_file+0x108/0x140)
> [<c034a6a4>] (sysfs_write_file+0x108/0x140) from [<c02fb798>] (vfs_write+0xac/0x134)
> [<c02fb798>] (vfs_write+0xac/0x134) from [<c02fb8cc>] (sys_write+0x3c/0x68)
> [<c02fb8cc>] (sys_write+0x3c/0x68) from [<c027c700>] (ret_fast_syscall+0x0/0x2c)
> ---[ end trace 88289eceb4675b04 ]---
>
> This patch fix the problem by adding the power on opertion back for uart
> console when console_suspend_enabled is true.
>
> Signed-off-by: Ning Jiang<ning.jiang@marvell.com>
> ---
> drivers/tty/serial/serial_core.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index 5c04cb9..4f75918 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -1981,6 +1981,8 @@ 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);
>
> + if (console_suspend_enabled)
> + uart_change_pm(state, 0);
> uport->ops->set_termios(uport,&termios, NULL);
> if (console_suspend_enabled)
> console_start(uport->cons);
I just found the same issue. Looks good to me.
Feel free to add,
Tested-by: Mayank Rana <mrana@codeaurora.org>
--
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] serial-core: power up uart port early before we do set_termios when resuming
2011-09-05 8:28 [PATCH] serial-core: power up uart port early before we do set_termios when resuming Ning Jiang
2011-09-05 9:17 ` Mayank Rana
@ 2011-09-05 14:03 ` Yin Kangkai
1 sibling, 0 replies; 4+ messages in thread
From: Yin Kangkai @ 2011-09-05 14:03 UTC (permalink / raw)
To: Ning Jiang; +Cc: Greg Kroah-Hartman, Alan Cox, Yin Kangkai, linux-serial
On 2011-09-05, 16:28 +0800, Ning Jiang wrote:
> termios = *(port->tty->termios);
>
> + if (console_suspend_enabled)
> + uart_change_pm(state, 0);
> uport->ops->set_termios(uport, &termios, NULL);
Good catch, thanks. What I was thinking...
Kangkai
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] serial-core: power up uart port early before we do set_termios when resuming
2011-09-05 9:17 ` Mayank Rana
@ 2011-09-06 2:23 ` Ning Jiang
0 siblings, 0 replies; 4+ messages in thread
From: Ning Jiang @ 2011-09-06 2:23 UTC (permalink / raw)
To: Mayank Rana
Cc: Greg Kroah-Hartman, Alan Cox, Yin Kangkai,
linux-serial@vger.kernel.org
-----Original Message-----
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index 5c04cb9..4f75918 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -1981,6 +1981,8 @@ 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);
>
> + if (console_suspend_enabled)
> + uart_change_pm(state, 0);
> uport->ops->set_termios(uport,&termios, NULL);
> if (console_suspend_enabled)
> console_start(uport->cons);
I just found the same issue. Looks good to me.
Feel free to add,
Tested-by: Mayank Rana <mrana@codeaurora.org>
-----
Thanks, Mayank. I've only tested it on pxa platform. More testing on other platforms is welcome.
Sincerely Yours,
Ning Jiang
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-09-06 2:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-05 8:28 [PATCH] serial-core: power up uart port early before we do set_termios when resuming Ning Jiang
2011-09-05 9:17 ` Mayank Rana
2011-09-06 2:23 ` Ning Jiang
2011-09-05 14:03 ` Yin Kangkai
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).