From patchwork Mon Jul 22 10:01:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajendra Nayak X-Patchwork-Id: 2831198 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C7020C0319 for ; Mon, 22 Jul 2013 10:02:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 72F4520166 for ; Mon, 22 Jul 2013 10:02:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0681F20176 for ; Mon, 22 Jul 2013 10:02:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757297Ab3GVKCP (ORCPT ); Mon, 22 Jul 2013 06:02:15 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:50255 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757284Ab3GVKCL (ORCPT ); Mon, 22 Jul 2013 06:02:11 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id r6MA1iIo030784; Mon, 22 Jul 2013 05:01:44 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r6MA1i2f023078; Mon, 22 Jul 2013 05:01:44 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.2.342.3; Mon, 22 Jul 2013 05:01:43 -0500 Received: from ula0131687.apr.dhcp.ti.com (ula0131687-172024145046.apr.dhcp.ti.com [172.24.145.46]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r6MA1VnN027460; Mon, 22 Jul 2013 05:01:40 -0500 From: Rajendra Nayak To: , CC: , , , , , , , , , , Rajendra Nayak Subject: [PATCH 2/4] serial: omap: enable PM runtime only when its fully configured Date: Mon, 22 Jul 2013 15:31:15 +0530 Message-ID: <1374487277-26099-3-git-send-email-rnayak@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1374487277-26099-1-git-send-email-rnayak@ti.com> References: <1374487277-26099-1-git-send-email-rnayak@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Grygorii Strashko If earlyprintk is enabled and current UART is console port the platform code can mark it as RPM_ACTIVE to sync real IP state with PM Runtime and avoid resuming of already active device, but now, driver initialization will be performed in the wrong way: pm_runtime_enable(&pdev->dev); <-- PM runtime alowed (device state RPM_ACTIVE) if (omap_up_info->autosuspend_timeout == 0) omap_up_info->autosuspend_timeout = -1; device_init_wakeup(up->dev, true); pm_runtime_use_autosuspend(&pdev->dev); <-- update_autosuspend() will be called and it will disable device (device state RPM_SUSPENDED) pm_runtime_set_autosuspend_delay(&pdev->dev, omap_up_info->autosuspend_timeout); <-- update_autosuspend() will be called which will re-enable device (device state RPM_ACTIVE), because autosuspend_timeout < 0 pm_runtime_irq_safe(&pdev->dev); pm_runtime_get_sync(&pdev->dev); <-- will do nothing Such behavior isn't expected by OMAP serial drivers and causes unpredictable calls of serial_omap_runtime_suspend() and serial_omap_runtime_resume(). Hence, fix it by allowing PM runtime only after all its parameters are configured. CC: Tony Lindgren CC: Rajendra Nayak CC: Felipe Balbi CC: Kevin Hilman Signed-off-by: Grygorii Strashko Signed-off-by: Rajendra Nayak --- drivers/tty/serial/omap-serial.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index b6d1728..f39bf0c 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c @@ -1501,7 +1501,6 @@ static int serial_omap_probe(struct platform_device *pdev) INIT_WORK(&up->qos_work, serial_omap_uart_qos_work); platform_set_drvdata(pdev, up); - pm_runtime_enable(&pdev->dev); if (omap_up_info->autosuspend_timeout == 0) omap_up_info->autosuspend_timeout = -1; device_init_wakeup(up->dev, true); @@ -1510,6 +1509,8 @@ static int serial_omap_probe(struct platform_device *pdev) omap_up_info->autosuspend_timeout); pm_runtime_irq_safe(&pdev->dev); + pm_runtime_enable(&pdev->dev); + pm_runtime_get_sync(&pdev->dev); omap_serial_fill_features_erratas(up);