diff mbox

[3/5] serial: omap: Switch wake-up interrupt to generic wakeirq

Message ID 1431560196-5722-4-git-send-email-tony@atomide.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tony Lindgren May 13, 2015, 11:36 p.m. UTC
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(-)

Comments

Tony Lindgren May 28, 2015, 2:56 p.m. UTC | #1
Hi Greg,

* Tony Lindgren <tony@atomide.com> [150513 16:38]:
> We can now use generic wakeirq handling and remove the custom handling
> for the wake-up interrupts.

How do you prefer to handle the two omap specific serial driver
changes in this series?

There's a dependency to Rafael's pm-wakeirq branch that contains:

4990d4fe327b ("PM / Wakeirq: Add automated device wake IRQ handling")
56f487c78015 ("PM / Runtime: Update last_busy in rpm_resume")
f6a2fbb903d5 ("PM / runtime: add note about re-calling in during
device probe()")

The 8250_omap.c driver change also needs to be merged with:

9e91597f2423 ("serial: 8250_omap: provide complete custom startup &
shutdown callbacks")

Not sure if 9e91597f2423 is immutable, but if so then I could:

a) Send you a pull request for the two serial driver patches
   based on Rafael's pm-wakeirq branch merged with 9e91597f2423 to
   avoid the merge conflict.

b) Apply both serial driver patches into omap-for-v4.2/wakeirq
   based on Rafael's pm-wakeirq branch merged with 9e91597f2423.

Or do you have some better ideas?

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Greg KH May 31, 2015, 7:16 a.m. UTC | #2
On Thu, May 28, 2015 at 07:56:16AM -0700, Tony Lindgren wrote:
> Hi Greg,
> 
> * Tony Lindgren <tony@atomide.com> [150513 16:38]:
> > We can now use generic wakeirq handling and remove the custom handling
> > for the wake-up interrupts.
> 
> How do you prefer to handle the two omap specific serial driver
> changes in this series?
> 
> There's a dependency to Rafael's pm-wakeirq branch that contains:
> 
> 4990d4fe327b ("PM / Wakeirq: Add automated device wake IRQ handling")
> 56f487c78015 ("PM / Runtime: Update last_busy in rpm_resume")
> f6a2fbb903d5 ("PM / runtime: add note about re-calling in during
> device probe()")
> 
> The 8250_omap.c driver change also needs to be merged with:
> 
> 9e91597f2423 ("serial: 8250_omap: provide complete custom startup &
> shutdown callbacks")
> 
> Not sure if 9e91597f2423 is immutable, but if so then I could:
> 
> a) Send you a pull request for the two serial driver patches
>    based on Rafael's pm-wakeirq branch merged with 9e91597f2423 to
>    avoid the merge conflict.
> 
> b) Apply both serial driver patches into omap-for-v4.2/wakeirq
>    based on Rafael's pm-wakeirq branch merged with 9e91597f2423.

That one sounds good to me, feel free to do so and add:

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

It's the easiest for everyone involved, right?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tony Lindgren June 1, 2015, 10:05 p.m. UTC | #3
* Greg Kroah-Hartman <gregkh@linuxfoundation.org> [150531 00:24]:
> On Thu, May 28, 2015 at 07:56:16AM -0700, Tony Lindgren wrote:
> > Hi Greg,
> > 
> > * Tony Lindgren <tony@atomide.com> [150513 16:38]:
> > > We can now use generic wakeirq handling and remove the custom handling
> > > for the wake-up interrupts.
> > 
> > How do you prefer to handle the two omap specific serial driver
> > changes in this series?
> > 
> > There's a dependency to Rafael's pm-wakeirq branch that contains:
> > 
> > 4990d4fe327b ("PM / Wakeirq: Add automated device wake IRQ handling")
> > 56f487c78015 ("PM / Runtime: Update last_busy in rpm_resume")
> > f6a2fbb903d5 ("PM / runtime: add note about re-calling in during
> > device probe()")
> > 
> > The 8250_omap.c driver change also needs to be merged with:
> > 
> > 9e91597f2423 ("serial: 8250_omap: provide complete custom startup &
> > shutdown callbacks")
> > 
> > Not sure if 9e91597f2423 is immutable, but if so then I could:
> > 
> > a) Send you a pull request for the two serial driver patches
> >    based on Rafael's pm-wakeirq branch merged with 9e91597f2423 to
> >    avoid the merge conflict.
> > 
> > b) Apply both serial driver patches into omap-for-v4.2/wakeirq
> >    based on Rafael's pm-wakeirq branch merged with 9e91597f2423.
> 
> That one sounds good to me, feel free to do so and add:
> 
> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> It's the easiest for everyone involved, right?

OK thanks, looks like there's a new commit for the fix as
9809889c708e, I'll base on that and wait that the commit gets
merged before sending out any pull request.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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",