diff options
author | Magnus Damm <damm@opensource.se> | 2011-04-19 06:38:25 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2011-05-22 23:22:04 -0400 |
commit | 5e50d2d622c745d4439fc9a33d932cc3add2318f (patch) | |
tree | 6262fe71647f6f09f0dbb686dea44da2368bb444 /drivers/tty | |
parent | 972b1943becc2dd4335c1b9d8ecd07c5ad44dd88 (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/tty')
-rw-r--r-- | drivers/tty/serial/sh-sci.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 920a6f929c8b..bb682c4e72a8 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <linux/platform_device.h> | 43 | #include <linux/platform_device.h> |
44 | #include <linux/serial_sci.h> | 44 | #include <linux/serial_sci.h> |
45 | #include <linux/notifier.h> | 45 | #include <linux/notifier.h> |
46 | #include <linux/pm_runtime.h> | ||
46 | #include <linux/cpufreq.h> | 47 | #include <linux/cpufreq.h> |
47 | #include <linux/clk.h> | 48 | #include <linux/clk.h> |
48 | #include <linux/ctype.h> | 49 | #include <linux/ctype.h> |
@@ -562,6 +563,9 @@ static void sci_break_timer(unsigned long data) | |||
562 | { | 563 | { |
563 | struct sci_port *port = (struct sci_port *)data; | 564 | struct sci_port *port = (struct sci_port *)data; |
564 | 565 | ||
566 | if (port->enable) | ||
567 | port->enable(&port->port); | ||
568 | |||
565 | if (sci_rxd_in(&port->port) == 0) { | 569 | if (sci_rxd_in(&port->port) == 0) { |
566 | port->break_flag = 1; | 570 | port->break_flag = 1; |
567 | sci_schedule_break_timer(port); | 571 | sci_schedule_break_timer(port); |
@@ -571,6 +575,9 @@ static void sci_break_timer(unsigned long data) | |||
571 | sci_schedule_break_timer(port); | 575 | sci_schedule_break_timer(port); |
572 | } else | 576 | } else |
573 | port->break_flag = 0; | 577 | port->break_flag = 0; |
578 | |||
579 | if (port->disable) | ||
580 | port->disable(&port->port); | ||
574 | } | 581 | } |
575 | 582 | ||
576 | static int sci_handle_errors(struct uart_port *port) | 583 | static int sci_handle_errors(struct uart_port *port) |
@@ -839,6 +846,8 @@ static void sci_clk_enable(struct uart_port *port) | |||
839 | { | 846 | { |
840 | struct sci_port *sci_port = to_sci_port(port); | 847 | struct sci_port *sci_port = to_sci_port(port); |
841 | 848 | ||
849 | pm_runtime_get_sync(port->dev); | ||
850 | |||
842 | clk_enable(sci_port->iclk); | 851 | clk_enable(sci_port->iclk); |
843 | sci_port->port.uartclk = clk_get_rate(sci_port->iclk); | 852 | sci_port->port.uartclk = clk_get_rate(sci_port->iclk); |
844 | clk_enable(sci_port->fclk); | 853 | clk_enable(sci_port->fclk); |
@@ -850,6 +859,8 @@ static void sci_clk_disable(struct uart_port *port) | |||
850 | 859 | ||
851 | clk_disable(sci_port->fclk); | 860 | clk_disable(sci_port->fclk); |
852 | clk_disable(sci_port->iclk); | 861 | clk_disable(sci_port->iclk); |
862 | |||
863 | pm_runtime_put_sync(port->dev); | ||
853 | } | 864 | } |
854 | 865 | ||
855 | static int sci_request_irq(struct sci_port *port) | 866 | static int sci_request_irq(struct sci_port *port) |
@@ -1758,6 +1769,8 @@ static int __devinit sci_init_single(struct platform_device *dev, | |||
1758 | sci_port->enable = sci_clk_enable; | 1769 | sci_port->enable = sci_clk_enable; |
1759 | sci_port->disable = sci_clk_disable; | 1770 | sci_port->disable = sci_clk_disable; |
1760 | port->dev = &dev->dev; | 1771 | port->dev = &dev->dev; |
1772 | |||
1773 | pm_runtime_enable(&dev->dev); | ||
1761 | } | 1774 | } |
1762 | 1775 | ||
1763 | sci_port->break_timer.data = (unsigned long)sci_port; | 1776 | sci_port->break_timer.data = (unsigned long)sci_port; |
@@ -1938,6 +1951,7 @@ static int sci_remove(struct platform_device *dev) | |||
1938 | clk_put(port->iclk); | 1951 | clk_put(port->iclk); |
1939 | clk_put(port->fclk); | 1952 | clk_put(port->fclk); |
1940 | 1953 | ||
1954 | pm_runtime_disable(&dev->dev); | ||
1941 | return 0; | 1955 | return 0; |
1942 | } | 1956 | } |
1943 | 1957 | ||