From: Magnus Damm <magnus.damm@gmail.com>
To: linux-sh@vger.kernel.org
Subject: [PATCH] serial: sh-sci: suspend/resume wakeup support
Date: Tue, 19 Apr 2011 10:43:44 +0000 [thread overview]
Message-ID: <20110419104344.23764.93511.sendpatchset@t400s> (raw)
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;
}
next reply other threads:[~2011-04-19 10:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-19 10:43 Magnus Damm [this message]
2011-04-19 21:49 ` [PATCH] serial: sh-sci: suspend/resume wakeup support 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
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=20110419104344.23764.93511.sendpatchset@t400s \
--to=magnus.damm@gmail.com \
--cc=linux-sh@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.