* [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
* Re: [PATCH] serial: sh-sci: suspend/resume wakeup support
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
2 siblings, 0 replies; 4+ messages in thread
From: Paul Mundt @ 2011-04-19 21:49 UTC (permalink / raw)
To: linux-sh
On Tue, Apr 19, 2011 at 07:43:44PM +0900, Magnus Damm wrote:
> 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>
The serial core already does all of this, so I'm not sure I see the
point. If you've stumbled upon something the generic infrastructure
doesn't handle properly, then fix that up instead of reinventing it and
sidestepping the rest of the suspend/resume port ops.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] serial: sh-sci: suspend/resume wakeup support
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
2 siblings, 0 replies; 4+ messages in thread
From: Magnus Damm @ 2011-04-21 13:03 UTC (permalink / raw)
To: linux-sh
On Wed, Apr 20, 2011 at 6:49 AM, Paul Mundt <lethal@linux-sh.org> wrote:
> On Tue, Apr 19, 2011 at 07:43:44PM +0900, Magnus Damm wrote:
>> 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>
>
> The serial core already does all of this, so I'm not sure I see the
> point. If you've stumbled upon something the generic infrastructure
> doesn't handle properly, then fix that up instead of reinventing it and
> sidestepping the rest of the suspend/resume port ops.
Sure, I overlooked that. Have a look at V2.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] serial: sh-sci: suspend/resume wakeup support V2
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 ` Magnus Damm
2 siblings, 0 replies; 4+ messages in thread
From: Magnus Damm @ 2011-04-21 13:08 UTC (permalink / raw)
To: linux-sh
From: Magnus Damm <damm@opensource.se>
This patch adds wakeup support to the sh-sci driver. The serial
core deals with all details but defaults to wakeup disabled. So
to make use of this feature enable wakeup in sysfs:
echo enabled > /sys/class/tty/ttySC0/power/wakeup
Signed-off-by: Magnus Damm <damm@opensource.se>
---
Changes since V1:
- drop device_init_wakeup() and enable/disable_irq_wake() bits
- let port->irq point out receive IRQ
drivers/tty/serial/sh-sci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- 0001/drivers/tty/serial/sh-sci.c
+++ work/drivers/tty/serial/sh-sci.c 2011-04-21 17:53:17.000000000 +0900
@@ -1777,7 +1777,7 @@ static int __devinit sci_init_single(str
*
* For the muxed case there's nothing more to do.
*/
- port->irq = p->irqs[SCIx_TXI_IRQ];
+ port->irq = p->irqs[SCIx_RXI_IRQ];
if (p->dma_dev)
dev_dbg(port->dev, "DMA device %p, tx %d, rx %d\n",
^ 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 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.