linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: sh-sci: suspend/resume wakeup support
@ 2011-04-19 10:43 Magnus Damm
  2011-04-19 21:49 ` Paul Mundt
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Magnus Damm @ 2011-04-19 10:43 UTC (permalink / raw)
  To: linux-sh

From: Magnus Damm <damm@opensource.se>

This patch adds wakeup support to the sh-sci driver. As usual,
device_init_wakeup() and enable_irq_wake()/disable_irq_wake()
are used to determine if the port should be suspended/resumed
as usual or if it should be enabled to act as a wakeup source.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 drivers/tty/serial/sh-sci.c |   22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

--- 0001/drivers/tty/serial/sh-sci.c
+++ work/drivers/tty/serial/sh-sci.c	2011-04-19 18:32:51.000000000 +0900
@@ -1962,7 +1962,11 @@ static int __devinit sci_probe_single(st
 	if (ret)
 		return ret;
 
-	return uart_add_one_port(&sci_uart_driver, &sciport->port);
+	ret = uart_add_one_port(&sci_uart_driver, &sciport->port);
+	if (!ret)
+		device_init_wakeup(&dev->dev, 1);
+
+	return ret;
 }
 
 static int __devinit sci_probe(struct platform_device *dev)
@@ -2007,8 +2011,12 @@ static int sci_suspend(struct device *de
 {
 	struct sci_port *sport = dev_get_drvdata(dev);
 
-	if (sport)
-		uart_suspend_port(&sci_uart_driver, &sport->port);
+	if (sport) {
+		if (device_may_wakeup(dev))
+			enable_irq_wake(sport->cfg->irqs[SCIx_RXI_IRQ]);
+		else
+			uart_suspend_port(&sci_uart_driver, &sport->port);
+	}
 
 	return 0;
 }
@@ -2017,8 +2025,12 @@ static int sci_resume(struct device *dev
 {
 	struct sci_port *sport = dev_get_drvdata(dev);
 
-	if (sport)
-		uart_resume_port(&sci_uart_driver, &sport->port);
+	if (sport) {
+		if (device_may_wakeup(dev))
+			disable_irq_wake(sport->cfg->irqs[SCIx_RXI_IRQ]);
+		else
+			uart_resume_port(&sci_uart_driver, &sport->port);
+	}
 
 	return 0;
 }

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-04-21 13:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-19 10:43 [PATCH] serial: sh-sci: suspend/resume wakeup support Magnus Damm
2011-04-19 21:49 ` Paul Mundt
2011-04-21 13:03 ` Magnus Damm
2011-04-21 13:08 ` [PATCH] serial: sh-sci: suspend/resume wakeup support V2 Magnus Damm

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).