From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mayank Rana Subject: Re: [PATCH] serial-core: power up uart port early before we do set_termios when resuming Date: Mon, 05 Sep 2011 14:47:25 +0530 Message-ID: <4E6493A5.50807@codeaurora.org> References: <1315211298-17318-1-git-send-email-ning.jiang@marvell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from wolverine01.qualcomm.com ([199.106.114.254]:16934 "EHLO wolverine01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751738Ab1IEJRe (ORCPT ); Mon, 5 Sep 2011 05:17:34 -0400 In-Reply-To: <1315211298-17318-1-git-send-email-ning.jiang@marvell.com> Sender: linux-serial-owner@vger.kernel.org List-Id: linux-serial@vger.kernel.org To: Ning Jiang Cc: Greg Kroah-Hartman , Alan Cox , Yin Kangkai , linux-serial@vger.kernel.orglinux-serial@vger.kernel.org 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 > 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: > [] (unwind_backtrace+0x0/0xf0) from [] (warn_slowpath_common+0x4c/0x64) > [] (warn_slowpath_common+0x4c/0x64) from [] (warn_slowpath_null+0x18/0x1c) > [] (warn_slowpath_null+0x18/0x1c) from [] (serial_pxa_set_termios+0x1dc/0x250) > [] (serial_pxa_set_termios+0x1dc/0x250) from [] (uart_resume_port+0x128/0x2dc) > [] (uart_resume_port+0x128/0x2dc) from [] (serial_pxa_resume+0x18/0x24) > [] (serial_pxa_resume+0x18/0x24) from [] (platform_pm_resume+0x40/0x4c) > [] (platform_pm_resume+0x40/0x4c) from [] (pm_op+0x68/0xb4) > [] (pm_op+0x68/0xb4) from [] (device_resume+0xb0/0xec) > [] (device_resume+0xb0/0xec) from [] (dpm_resume+0xe0/0x194) > [] (dpm_resume+0xe0/0x194) from [] (dpm_resume_end+0xc/0x18) > [] (dpm_resume_end+0xc/0x18) from [] (suspend_devices_and_enter+0x16c/0x1ac) > [] (suspend_devices_and_enter+0x16c/0x1ac) from [] (enter_state+0xac/0xdc) > [] (enter_state+0xac/0xdc) from [] (state_store+0xa0/0xbc) > [] (state_store+0xa0/0xbc) from [] (kobj_attr_store+0x18/0x1c) > [] (kobj_attr_store+0x18/0x1c) from [] (sysfs_write_file+0x108/0x140) > [] (sysfs_write_file+0x108/0x140) from [] (vfs_write+0xac/0x134) > [] (vfs_write+0xac/0x134) from [] (sys_write+0x3c/0x68) > [] (sys_write+0x3c/0x68) from [] (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 > --- > 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 -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.