linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rajendra Nayak <rnayak@ti.com>
To: tony@atomide.com, linux-omap@vger.kernel.org
Cc: paul@pwsan.com, balbi@ti.com, mpfj-list@newflow.co.uk,
	vaibhav.bedia@ti.com, khilman@linaro.org, sourav.poddar@ti.com,
	linux-arm-kernel@lists.infradead.org, gregkh@linuxfoundation.org,
	linux-serial@vger.kernel.org, grygorii.strashko@ti.com,
	Rajendra Nayak <rnayak@ti.com>
Subject: [PATCH 2/4] serial: omap: enable PM runtime only when its fully configured
Date: Mon, 22 Jul 2013 15:31:15 +0530	[thread overview]
Message-ID: <1374487277-26099-3-git-send-email-rnayak@ti.com> (raw)
In-Reply-To: <1374487277-26099-1-git-send-email-rnayak@ti.com>

From: Grygorii Strashko <grygorii.strashko@ti.com>

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 <tony@atomide.com>
CC: Rajendra Nayak <rnayak@ti.com>
CC: Felipe Balbi <balbi@ti.com>
CC: Kevin Hilman <khilman@linaro.org>

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
 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);
-- 
1.7.9.5


  parent reply	other threads:[~2013-07-22 10:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-22 10:01 [PATCH 0/4] OMAP2+: Fix boot hang with earlycon enabled Rajendra Nayak
2013-07-22 10:01 ` [PATCH 1/4] ARM: OMAP2+: hwmod: Fix a crash in _setup_reset() with DEBUG_LL Rajendra Nayak
2013-07-22 10:01 ` Rajendra Nayak [this message]
2013-07-29  8:44   ` [PATCH 2/4] serial: omap: enable PM runtime only when its fully configured Paul Walmsley
2013-07-29  8:50     ` Rajendra Nayak
2013-07-30  5:16       ` Rajendra Nayak
2013-07-30 10:20         ` Paul Walmsley
2013-07-22 10:01 ` [PATCH 3/4] ARM: OMAP2+: Avoid idling memory controllers with no drivers Rajendra Nayak
2013-07-22 17:48   ` Paul Walmsley
2013-07-23  4:59     ` Rajendra Nayak
2013-07-22 10:01 ` [PATCH 4/4] ARM: OMAP2+: Sync hwmod state with the pm_runtime and omap_device state Rajendra Nayak
2013-08-05 15:43   ` Kevin Hilman
2013-07-22 14:52 ` [PATCH 0/4] OMAP2+: Fix boot hang with earlycon enabled Mark Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1374487277-26099-3-git-send-email-rnayak@ti.com \
    --to=rnayak@ti.com \
    --cc=balbi@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=grygorii.strashko@ti.com \
    --cc=khilman@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mpfj-list@newflow.co.uk \
    --cc=paul@pwsan.com \
    --cc=sourav.poddar@ti.com \
    --cc=tony@atomide.com \
    --cc=vaibhav.bedia@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).