diff options
Diffstat (limited to 'drivers/tty/serial/omap-serial.c')
-rw-r--r-- | drivers/tty/serial/omap-serial.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index dd8b1a5458ff..08b6b9419f0d 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c | |||
@@ -225,14 +225,19 @@ static inline void serial_omap_enable_wakeirq(struct uart_omap_port *up, | |||
225 | if (enable) | 225 | if (enable) |
226 | enable_irq(up->wakeirq); | 226 | enable_irq(up->wakeirq); |
227 | else | 227 | else |
228 | disable_irq(up->wakeirq); | 228 | disable_irq_nosync(up->wakeirq); |
229 | } | 229 | } |
230 | 230 | ||
231 | static void serial_omap_enable_wakeup(struct uart_omap_port *up, bool enable) | 231 | static void serial_omap_enable_wakeup(struct uart_omap_port *up, bool enable) |
232 | { | 232 | { |
233 | struct omap_uart_port_info *pdata = dev_get_platdata(up->dev); | 233 | struct omap_uart_port_info *pdata = dev_get_platdata(up->dev); |
234 | 234 | ||
235 | if (enable == up->wakeups_enabled) | ||
236 | return; | ||
237 | |||
235 | serial_omap_enable_wakeirq(up, enable); | 238 | serial_omap_enable_wakeirq(up, enable); |
239 | up->wakeups_enabled = enable; | ||
240 | |||
236 | if (!pdata || !pdata->enable_wakeup) | 241 | if (!pdata || !pdata->enable_wakeup) |
237 | return; | 242 | return; |
238 | 243 | ||
@@ -1495,6 +1500,11 @@ static int serial_omap_suspend(struct device *dev) | |||
1495 | uart_suspend_port(&serial_omap_reg, &up->port); | 1500 | uart_suspend_port(&serial_omap_reg, &up->port); |
1496 | flush_work(&up->qos_work); | 1501 | flush_work(&up->qos_work); |
1497 | 1502 | ||
1503 | if (device_may_wakeup(dev)) | ||
1504 | serial_omap_enable_wakeup(up, true); | ||
1505 | else | ||
1506 | serial_omap_enable_wakeup(up, false); | ||
1507 | |||
1498 | return 0; | 1508 | return 0; |
1499 | } | 1509 | } |
1500 | 1510 | ||
@@ -1502,6 +1512,9 @@ static int serial_omap_resume(struct device *dev) | |||
1502 | { | 1512 | { |
1503 | struct uart_omap_port *up = dev_get_drvdata(dev); | 1513 | struct uart_omap_port *up = dev_get_drvdata(dev); |
1504 | 1514 | ||
1515 | if (device_may_wakeup(dev)) | ||
1516 | serial_omap_enable_wakeup(up, false); | ||
1517 | |||
1505 | uart_resume_port(&serial_omap_reg, &up->port); | 1518 | uart_resume_port(&serial_omap_reg, &up->port); |
1506 | 1519 | ||
1507 | return 0; | 1520 | return 0; |
@@ -1789,6 +1802,7 @@ static int serial_omap_remove(struct platform_device *dev) | |||
1789 | pm_runtime_disable(up->dev); | 1802 | pm_runtime_disable(up->dev); |
1790 | uart_remove_one_port(&serial_omap_reg, &up->port); | 1803 | uart_remove_one_port(&serial_omap_reg, &up->port); |
1791 | pm_qos_remove_request(&up->pm_qos_request); | 1804 | pm_qos_remove_request(&up->pm_qos_request); |
1805 | device_init_wakeup(&dev->dev, false); | ||
1792 | 1806 | ||
1793 | return 0; | 1807 | return 0; |
1794 | } | 1808 | } |
@@ -1877,17 +1891,7 @@ static int serial_omap_runtime_suspend(struct device *dev) | |||
1877 | 1891 | ||
1878 | up->context_loss_cnt = serial_omap_get_context_loss_count(up); | 1892 | up->context_loss_cnt = serial_omap_get_context_loss_count(up); |
1879 | 1893 | ||
1880 | if (device_may_wakeup(dev)) { | 1894 | serial_omap_enable_wakeup(up, true); |
1881 | if (!up->wakeups_enabled) { | ||
1882 | serial_omap_enable_wakeup(up, true); | ||
1883 | up->wakeups_enabled = true; | ||
1884 | } | ||
1885 | } else { | ||
1886 | if (up->wakeups_enabled) { | ||
1887 | serial_omap_enable_wakeup(up, false); | ||
1888 | up->wakeups_enabled = false; | ||
1889 | } | ||
1890 | } | ||
1891 | 1895 | ||
1892 | up->latency = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE; | 1896 | up->latency = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE; |
1893 | schedule_work(&up->qos_work); | 1897 | schedule_work(&up->qos_work); |
@@ -1901,6 +1905,8 @@ static int serial_omap_runtime_resume(struct device *dev) | |||
1901 | 1905 | ||
1902 | int loss_cnt = serial_omap_get_context_loss_count(up); | 1906 | int loss_cnt = serial_omap_get_context_loss_count(up); |
1903 | 1907 | ||
1908 | serial_omap_enable_wakeup(up, false); | ||
1909 | |||
1904 | if (loss_cnt < 0) { | 1910 | if (loss_cnt < 0) { |
1905 | dev_dbg(dev, "serial_omap_get_context_loss_count failed : %d\n", | 1911 | dev_dbg(dev, "serial_omap_get_context_loss_count failed : %d\n", |
1906 | loss_cnt); | 1912 | loss_cnt); |