summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMagnus Damm <damm@opensource.se>2011-04-19 10:38:25 +0000
committerPaul Mundt <lethal@linux-sh.org>2011-05-23 12:22:04 +0900
commit5e50d2d622c745d4439fc9a33d932cc3add2318f (patch)
tree6262fe71647f6f09f0dbb686dea44da2368bb444 /drivers
parent972b1943becc2dd4335c1b9d8ecd07c5ad44dd88 (diff)
serial: sh-sci: Runtime PM support
Add support for Runtime PM in the sh-sci driver. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/tty/serial/sh-sci.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 920a6f929c8..bb682c4e72a 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -43,6 +43,7 @@
#include <linux/platform_device.h>
#include <linux/serial_sci.h>
#include <linux/notifier.h>
+#include <linux/pm_runtime.h>
#include <linux/cpufreq.h>
#include <linux/clk.h>
#include <linux/ctype.h>
@@ -562,6 +563,9 @@ static void sci_break_timer(unsigned long data)
{
struct sci_port *port = (struct sci_port *)data;
+ if (port->enable)
+ port->enable(&port->port);
+
if (sci_rxd_in(&port->port) == 0) {
port->break_flag = 1;
sci_schedule_break_timer(port);
@@ -571,6 +575,9 @@ static void sci_break_timer(unsigned long data)
sci_schedule_break_timer(port);
} else
port->break_flag = 0;
+
+ if (port->disable)
+ port->disable(&port->port);
}
static int sci_handle_errors(struct uart_port *port)
@@ -839,6 +846,8 @@ static void sci_clk_enable(struct uart_port *port)
{
struct sci_port *sci_port = to_sci_port(port);
+ pm_runtime_get_sync(port->dev);
+
clk_enable(sci_port->iclk);
sci_port->port.uartclk = clk_get_rate(sci_port->iclk);
clk_enable(sci_port->fclk);
@@ -850,6 +859,8 @@ static void sci_clk_disable(struct uart_port *port)
clk_disable(sci_port->fclk);
clk_disable(sci_port->iclk);
+
+ pm_runtime_put_sync(port->dev);
}
static int sci_request_irq(struct sci_port *port)
@@ -1758,6 +1769,8 @@ static int __devinit sci_init_single(struct platform_device *dev,
sci_port->enable = sci_clk_enable;
sci_port->disable = sci_clk_disable;
port->dev = &dev->dev;
+
+ pm_runtime_enable(&dev->dev);
}
sci_port->break_timer.data = (unsigned long)sci_port;
@@ -1938,6 +1951,7 @@ static int sci_remove(struct platform_device *dev)
clk_put(port->iclk);
clk_put(port->fclk);
+ pm_runtime_disable(&dev->dev);
return 0;
}