aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2015-06-10 02:35:00 -0400
committerTony Lindgren <tony@atomide.com>2015-06-10 02:35:00 -0400
commitee83bd3b6483d59b0d4b509e46dae688d8e5759d (patch)
treec35e9c0d8d5172984f2570e97c541448ace08b7d
parent00fda1682efdbd62a20a8a21aee52d994c323c7f (diff)
serial: omap: Switch wake-up interrupt to generic wakeirq
We can now use generic wakeirq handling and remove the custom handling for the wake-up interrupts. Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r--drivers/tty/serial/omap-serial.c35
1 files changed, 4 insertions, 31 deletions
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 7f49172ccd86..7a2172b5e93c 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -38,6 +38,7 @@
38#include <linux/serial_core.h> 38#include <linux/serial_core.h>
39#include <linux/irq.h> 39#include <linux/irq.h>
40#include <linux/pm_runtime.h> 40#include <linux/pm_runtime.h>
41#include <linux/pm_wakeirq.h>
41#include <linux/of.h> 42#include <linux/of.h>
42#include <linux/of_irq.h> 43#include <linux/of_irq.h>
43#include <linux/gpio.h> 44#include <linux/gpio.h>
@@ -160,7 +161,6 @@ struct uart_omap_port {
160 unsigned long port_activity; 161 unsigned long port_activity;
161 int context_loss_cnt; 162 int context_loss_cnt;
162 u32 errata; 163 u32 errata;
163 u8 wakeups_enabled;
164 u32 features; 164 u32 features;
165 165
166 int rts_gpio; 166 int rts_gpio;
@@ -209,28 +209,11 @@ static int serial_omap_get_context_loss_count(struct uart_omap_port *up)
209 return pdata->get_context_loss_count(up->dev); 209 return pdata->get_context_loss_count(up->dev);
210} 210}
211 211
212static inline void serial_omap_enable_wakeirq(struct uart_omap_port *up, 212/* REVISIT: Remove this when omap3 boots in device tree only mode */
213 bool enable)
214{
215 if (!up->wakeirq)
216 return;
217
218 if (enable)
219 enable_irq(up->wakeirq);
220 else
221 disable_irq_nosync(up->wakeirq);
222}
223
224static void serial_omap_enable_wakeup(struct uart_omap_port *up, bool enable) 213static void serial_omap_enable_wakeup(struct uart_omap_port *up, bool enable)
225{ 214{
226 struct omap_uart_port_info *pdata = dev_get_platdata(up->dev); 215 struct omap_uart_port_info *pdata = dev_get_platdata(up->dev);
227 216
228 if (enable == up->wakeups_enabled)
229 return;
230
231 serial_omap_enable_wakeirq(up, enable);
232 up->wakeups_enabled = enable;
233
234 if (!pdata || !pdata->enable_wakeup) 217 if (!pdata || !pdata->enable_wakeup)
235 return; 218 return;
236 219
@@ -750,13 +733,11 @@ static int serial_omap_startup(struct uart_port *port)
750 733
751 /* Optional wake-up IRQ */ 734 /* Optional wake-up IRQ */
752 if (up->wakeirq) { 735 if (up->wakeirq) {
753 retval = request_irq(up->wakeirq, serial_omap_irq, 736 retval = dev_pm_set_dedicated_wake_irq(up->dev, up->wakeirq);
754 up->port.irqflags, up->name, up);
755 if (retval) { 737 if (retval) {
756 free_irq(up->port.irq, up); 738 free_irq(up->port.irq, up);
757 return retval; 739 return retval;
758 } 740 }
759 disable_irq(up->wakeirq);
760 } 741 }
761 742
762 dev_dbg(up->port.dev, "serial_omap_startup+%d\n", up->port.line); 743 dev_dbg(up->port.dev, "serial_omap_startup+%d\n", up->port.line);
@@ -845,8 +826,7 @@ static void serial_omap_shutdown(struct uart_port *port)
845 pm_runtime_mark_last_busy(up->dev); 826 pm_runtime_mark_last_busy(up->dev);
846 pm_runtime_put_autosuspend(up->dev); 827 pm_runtime_put_autosuspend(up->dev);
847 free_irq(up->port.irq, up); 828 free_irq(up->port.irq, up);
848 if (up->wakeirq) 829 dev_pm_clear_wake_irq(up->dev);
849 free_irq(up->wakeirq, up);
850} 830}
851 831
852static void serial_omap_uart_qos_work(struct work_struct *work) 832static void serial_omap_uart_qos_work(struct work_struct *work)
@@ -1139,13 +1119,6 @@ serial_omap_pm(struct uart_port *port, unsigned int state,
1139 serial_out(up, UART_EFR, efr); 1119 serial_out(up, UART_EFR, efr);
1140 serial_out(up, UART_LCR, 0); 1120 serial_out(up, UART_LCR, 0);
1141 1121
1142 if (!device_may_wakeup(up->dev)) {
1143 if (!state)
1144 pm_runtime_forbid(up->dev);
1145 else
1146 pm_runtime_allow(up->dev);
1147 }
1148
1149 pm_runtime_mark_last_busy(up->dev); 1122 pm_runtime_mark_last_busy(up->dev);
1150 pm_runtime_put_autosuspend(up->dev); 1123 pm_runtime_put_autosuspend(up->dev);
1151} 1124}