linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] modify pl011 driver to work as wakeup source
@ 2015-08-14 10:24 Zhaoyang Huang
  2015-08-14 10:58 ` Daniel Lezcano
  0 siblings, 1 reply; 7+ messages in thread
From: Zhaoyang Huang @ 2015-08-14 10:24 UTC (permalink / raw)
  To: linux-pm; +Cc: amit.kucheria

add IRQF_NO_SUSPEND flag when requiring irq line and call
the pm_system_wakeup when RX interrupt happens

Signed-off-by: Zhaoyang Huang <zhaoyang.huang@linaro.org>
---
 drivers/tty/serial/amba-pl011.c |   24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 50cf5b1..6285819 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -59,6 +59,7 @@
 #include <linux/sizes.h>
 #include <linux/io.h>
 #include <linux/acpi.h>
+#include <linux/suspend.h>
 
 #define UART_NR			14
 
@@ -127,6 +128,7 @@ static struct vendor_data vendor_st = {
 	.get_fifosize		= get_fifosize_st,
 };
 
+static int is_suspended = 0;
 /* Deals with DMA transactions */
 
 struct pl011_sgbuf {
@@ -1376,6 +1378,10 @@ static irqreturn_t pl011_int(int irq, void *dev_id)
 					pl011_dma_rx_irq(uap);
 				else
 					pl011_rx_chars(uap);
+
+				if(is_suspended)
+					pm_system_wakeup();
+
 			}
 			if (status & (UART011_DSRMIS|UART011_DCDMIS|
 				      UART011_CTSMIS|UART011_RIMIS))
@@ -1585,7 +1591,7 @@ static int pl011_allocate_irq(struct uart_amba_port *uap)
 {
 	writew(uap->im, uap->port.membase + UART011_IMSC);
 
-	return request_irq(uap->port.irq, pl011_int, 0, "uart-pl011", uap);
+	return request_irq(uap->port.irq, pl011_int, IRQF_NO_SUSPEND, "uart-pl011", uap);
 }
 
 /*
@@ -2403,21 +2409,33 @@ static int pl011_remove(struct amba_device *dev)
 static int pl011_suspend(struct device *dev)
 {
 	struct uart_amba_port *uap = dev_get_drvdata(dev);
+	int ret = 0;
 
 	if (!uap)
 		return -EINVAL;
 
-	return uart_suspend_port(&amba_reg, &uap->port);
+	ret =uart_suspend_port(&amba_reg, &uap->port);
+
+	if(!ret)
+		is_suspended = 1;
+
+	return ret;
 }
 
 static int pl011_resume(struct device *dev)
 {
 	struct uart_amba_port *uap = dev_get_drvdata(dev);
+	int ret = 0;
 
 	if (!uap)
 		return -EINVAL;
 
-	return uart_resume_port(&amba_reg, &uap->port);
+	ret = uart_resume_port(&amba_reg, &uap->port);
+
+	if(!ret)
+		is_suspended = 0;
+
+	return ret;
 }
 #endif
 
-- 
1.7.9.5


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

end of thread, other threads:[~2015-08-28 13:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-14 10:24 [PATCH] modify pl011 driver to work as wakeup source Zhaoyang Huang
2015-08-14 10:58 ` Daniel Lezcano
     [not found]   ` <CAN2waFv+8KM_TCw=iy1BOn-KmYuZRVmr5jKAniJwCaxBjqXvNQ@mail.gmail.com>
2015-08-26 13:46     ` Amit Kucheria
2015-08-26 14:00     ` Daniel Lezcano
2015-08-26 15:36       ` Sudeep Holla
     [not found]         ` <CAN2waFtcVHoSX6QGZQFzJJ2fkYVk1mUsgMn1HYGGd-+TT-XMjw@mail.gmail.com>
2015-08-27 10:51           ` Sudeep Holla
     [not found]             ` <CAN2waFsMVEYHy4rb7qJX8Tgxs1d+EuAOXPpbn2SVEoQuXkt9DA@mail.gmail.com>
     [not found]               ` <CAN2waFuNChUJcTbwM-yZPqzptQmRFW2Mhg1fA0VPEKRyT+9kFg@mail.gmail.com>
2015-08-28 13:14                 ` Sudeep Holla

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