From patchwork Fri Apr 5 13:15:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Poddar, Sourav" X-Patchwork-Id: 2398391 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 226B13FD8C for ; Fri, 5 Apr 2013 13:16:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161717Ab3DENQ0 (ORCPT ); Fri, 5 Apr 2013 09:16:26 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:36481 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753372Ab3DENQZ (ORCPT ); Fri, 5 Apr 2013 09:16:25 -0400 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r35DGIni021476; Fri, 5 Apr 2013 08:16:19 -0500 Received: from DBDE71.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id r35DGF55025087; Fri, 5 Apr 2013 18:46:16 +0530 (IST) Received: from dbdp33.itg.ti.com (172.24.170.252) by DBDE71.ent.ti.com (172.24.170.149) with Microsoft SMTP Server id 14.1.323.3; Fri, 5 Apr 2013 18:46:15 +0530 Received: from a0131647.apr.dhcp.ti.com (smtpvbd.itg.ti.com [172.24.170.250]) by dbdp33.itg.ti.com (8.13.8/8.13.8) with ESMTP id r35DGBxH004995; Fri, 5 Apr 2013 18:46:11 +0530 From: Sourav Poddar To: , , , CC: , , , Sourav Poddar , Santosh Shilimkar , Felipe Balbi , Rajendra nayak Subject: [PATCHv3] driver: serial: prevent UART console idle on suspend while using "no_console_suspend" Date: Fri, 5 Apr 2013 18:45:33 +0530 Message-ID: <1365167733-28083-1-git-send-email-sourav.poddar@ti.com> X-Mailer: git-send-email 1.7.1 MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org With dt boot, uart wakeup after suspend is non functional while using "no_console_suspend" in the bootargs. With "no_console_suspend" used, we should prevent the runtime suspend of the uart port which is getting used as an console. Cc: Santosh Shilimkar Cc: Felipe Balbi Cc: Rajendra nayak Tested on omap5430evm, omap4430sdp. Signed-off-by: Sourav Poddar --- v2->v3 Based on Kevin Hilman and Santosh Shilimkar comments, modified serial core/driver layer to bypass runtime suspend for console uart while using "no_console_suspend". This patch is based on Santosh Shilimkar serial patch[1] [1]: http://permalink.gmane.org/gmane.linux.ports.arm.omap/95828 drivers/tty/serial/omap-serial.c | 5 ++++- drivers/tty/serial/serial_core.c | 3 +++ include/linux/serial_core.h | 1 + 3 files changed, 8 insertions(+), 1 deletions(-) diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index 08332f3..81a1760 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c @@ -1582,7 +1582,7 @@ static int serial_omap_runtime_suspend(struct device *dev) struct uart_omap_port *up = dev_get_drvdata(dev); struct omap_uart_port_info *pdata = dev->platform_data; - if (!up) + if (!up || (!console_suspend_enabled && up->port.port_is_console)) return -EINVAL; if (!pdata) @@ -1614,6 +1614,9 @@ static int serial_omap_runtime_resume(struct device *dev) int loss_cnt = serial_omap_get_context_loss_count(up); + if (!console_suspend_enabled && up->port.port_is_console) + return -EINVAL; + if (loss_cnt < 0) { dev_err(dev, "serial_omap_get_context_loss_count failed : %d\n", loss_cnt); diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index a400002..6c8b041 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -2594,6 +2594,9 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport) uport->cons = drv->cons; uport->state = state; + if (uart_console(uport)) + uport->port_is_console = true; + /* * If this port is a console, then the spinlock is already * initialised. diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 87d4bbc..c944414 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -194,6 +194,7 @@ struct uart_port { unsigned char irq_wake; unsigned char unused[2]; void *private_data; /* generic platform data pointer */ + bool port_is_console; }; static inline int serial_port_in(struct uart_port *up, int offset)