linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Alan Stern <stern@rowland.harvard.edu>
Cc: Andreas Fenkart <afenkart@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Felipe Balbi <balbi@ti.com>,
	Huiquan Zhong <huiquan.zhong@intel.com>,
	Kevin Hilman <khilman@kernel.org>, NeilBrown <neilb@suse.de>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Nishanth Menon <nm@ti.com>,
	Peter Hurley <peter@hurleysoftware.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-serial@vger.kernel.org, linux-omap@vger.kernel.org
Subject: [PATCH 3/5] serial: omap: Switch wake-up interrupt to generic wakeirq
Date: Wed, 13 May 2015 16:36:34 -0700	[thread overview]
Message-ID: <1431560196-5722-4-git-send-email-tony@atomide.com> (raw)
In-Reply-To: <1431560196-5722-1-git-send-email-tony@atomide.com>

We can now use generic wakeirq handling and remove the custom handling
for the wake-up interrupts.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/tty/serial/omap-serial.c | 38 +++++++-------------------------------
 1 file changed, 7 insertions(+), 31 deletions(-)

diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 211479a..b0cadaa 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -38,6 +38,7 @@
 #include <linux/serial_core.h>
 #include <linux/irq.h>
 #include <linux/pm_runtime.h>
+#include <linux/pm_wakeirq.h>
 #include <linux/of.h>
 #include <linux/of_irq.h>
 #include <linux/gpio.h>
@@ -160,7 +161,6 @@ struct uart_omap_port {
 	unsigned long		port_activity;
 	int			context_loss_cnt;
 	u32			errata;
-	u8			wakeups_enabled;
 	u32			features;
 
 	int			rts_gpio;
@@ -209,28 +209,11 @@ static int serial_omap_get_context_loss_count(struct uart_omap_port *up)
 	return pdata->get_context_loss_count(up->dev);
 }
 
-static inline void serial_omap_enable_wakeirq(struct uart_omap_port *up,
-				       bool enable)
-{
-	if (!up->wakeirq)
-		return;
-
-	if (enable)
-		enable_irq(up->wakeirq);
-	else
-		disable_irq_nosync(up->wakeirq);
-}
-
+/* REVISIT: Remove this when omap3 boots in device tree only mode */
 static void serial_omap_enable_wakeup(struct uart_omap_port *up, bool enable)
 {
 	struct omap_uart_port_info *pdata = dev_get_platdata(up->dev);
 
-	if (enable == up->wakeups_enabled)
-		return;
-
-	serial_omap_enable_wakeirq(up, enable);
-	up->wakeups_enabled = enable;
-
 	if (!pdata || !pdata->enable_wakeup)
 		return;
 
@@ -750,13 +733,12 @@ static int serial_omap_startup(struct uart_port *port)
 
 	/* Optional wake-up IRQ */
 	if (up->wakeirq) {
-		retval = request_irq(up->wakeirq, serial_omap_irq,
-				     up->port.irqflags, up->name, up);
+		retval = dev_pm_request_wake_irq(up->dev, up->wakeirq,
+						 NULL, 0, NULL);
 		if (retval) {
 			free_irq(up->port.irq, up);
 			return retval;
 		}
-		disable_irq(up->wakeirq);
 	}
 
 	dev_dbg(up->port.dev, "serial_omap_startup+%d\n", up->port.line);
@@ -845,8 +827,7 @@ static void serial_omap_shutdown(struct uart_port *port)
 	pm_runtime_mark_last_busy(up->dev);
 	pm_runtime_put_autosuspend(up->dev);
 	free_irq(up->port.irq, up);
-	if (up->wakeirq)
-		free_irq(up->wakeirq, up);
+	dev_pm_free_wake_irq(up->dev);
 }
 
 static void serial_omap_uart_qos_work(struct work_struct *work)
@@ -1139,13 +1120,6 @@ serial_omap_pm(struct uart_port *port, unsigned int state,
 	serial_out(up, UART_EFR, efr);
 	serial_out(up, UART_LCR, 0);
 
-	if (!device_may_wakeup(up->dev)) {
-		if (!state)
-			pm_runtime_forbid(up->dev);
-		else
-			pm_runtime_allow(up->dev);
-	}
-
 	pm_runtime_mark_last_busy(up->dev);
 	pm_runtime_put_autosuspend(up->dev);
 }
@@ -1838,6 +1812,7 @@ static int serial_omap_runtime_suspend(struct device *dev)
 	up->context_loss_cnt = serial_omap_get_context_loss_count(up);
 
 	serial_omap_enable_wakeup(up, true);
+	dev_pm_enable_wake_irq(dev);
 
 	up->latency = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE;
 	schedule_work(&up->qos_work);
@@ -1852,6 +1827,7 @@ static int serial_omap_runtime_resume(struct device *dev)
 	int loss_cnt = serial_omap_get_context_loss_count(up);
 
 	serial_omap_enable_wakeup(up, false);
+	dev_pm_disable_wake_irq(dev);
 
 	if (loss_cnt < 0) {
 		dev_dbg(dev, "serial_omap_get_context_loss_count failed : %d\n",
-- 
2.1.4


  parent reply	other threads:[~2015-05-13 23:55 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-13 23:36 [PATCHv3 0/5] Linux generic wakeirq handling Tony Lindgren
2015-05-13 23:36 ` [PATCH 1/5] PM / Runtime: Update last_busy in rpm_resume Tony Lindgren
2015-05-20  7:36   ` Ulf Hansson
2015-05-13 23:36 ` [PATCH 2/5] PM / Wakeirq: Add automated device wake IRQ handling Tony Lindgren
2015-05-14  2:06   ` Felipe Balbi
2015-05-14 15:51     ` Alan Stern
2015-05-14 15:54       ` Felipe Balbi
2015-05-14 15:59     ` Tony Lindgren
2015-05-14 16:09       ` Felipe Balbi
2015-05-14 16:28         ` Tony Lindgren
2015-05-14 17:51           ` Tony Lindgren
2015-05-14 21:15       ` Tony Lindgren
2015-05-14 21:25         ` Felipe Balbi
2015-05-14 22:00         ` Rafael J. Wysocki
2015-05-14 21:59           ` Tony Lindgren
2015-05-15 22:25             ` Tony Lindgren
2015-05-16  1:56               ` Felipe Balbi
2015-05-18 22:05                 ` Tony Lindgren
2015-05-18 23:44                   ` Tony Lindgren
2015-05-19 14:04                     ` Rafael J. Wysocki
2015-05-19 14:26                       ` Rafael J. Wysocki
2015-05-19 15:09                         ` Tony Lindgren
2015-05-19 18:18                           ` Tony Lindgren
2015-05-19 23:01                             ` Rafael J. Wysocki
2015-05-19 22:41                               ` Thomas Gleixner
2015-05-19 23:31                                 ` Rafael J. Wysocki
2015-05-19 23:27                                   ` Tony Lindgren
2015-05-20  0:25                                     ` Rafael J. Wysocki
2015-05-20  2:10                                       ` Tony Lindgren
2015-05-21  0:54                                         ` Rafael J. Wysocki
2015-05-21  0:35                                           ` Tony Lindgren
2015-05-21  1:40                                           ` Felipe Balbi
2015-05-19 15:15                       ` Tony Lindgren
2015-05-13 23:36 ` Tony Lindgren [this message]
2015-05-28 14:56   ` [PATCH 3/5] serial: omap: Switch wake-up interrupt to generic wakeirq Tony Lindgren
2015-05-31  7:16     ` Greg Kroah-Hartman
2015-06-01 22:05       ` Tony Lindgren
2015-05-13 23:36 ` [PATCH 4/5] serial: 8250_omap: Move " Tony Lindgren
2015-05-13 23:36 ` [PATCH 5/5] mmc: omap_hsmmc: Change wake-up interrupt to use " Tony Lindgren
2015-05-25  8:38   ` Ulf Hansson
2015-05-27 22:42     ` Rafael J. Wysocki
2015-05-27 22:45       ` Tony Lindgren
2015-05-28 14:36         ` Tony Lindgren

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=1431560196-5722-4-git-send-email-tony@atomide.com \
    --to=tony@atomide.com \
    --cc=afenkart@gmail.com \
    --cc=balbi@ti.com \
    --cc=bigeasy@linutronix.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=huiquan.zhong@intel.com \
    --cc=khilman@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=neilb@suse.de \
    --cc=nm@ti.com \
    --cc=peter@hurleysoftware.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=stern@rowland.harvard.edu \
    --cc=tglx@linutronix.de \
    --cc=ulf.hansson@linaro.org \
    /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).