aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2013-06-10 10:39:09 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-17 15:49:44 -0400
commita630fbfbb1beeffc5bbe542a7986bf2068874633 (patch)
tree5697270282fb15c8a6bfe218f1b031046fb62f52 /drivers/tty
parent80c48497f279a7ca25bfc6d2f9cae335a018ae17 (diff)
serial: omap: Fix device tree based PM runtime
In the runtime_suspend function pdata is not being used, and also blocks the function in device tree based booting. Fix it by removing the unused pdata from the runtime_suspend function. Further, context loss count is not being passed in pdata, so let's just reinitialize the port every time for those case. This can be further optimized later on for the device tree case by adding detection for the hardware state and possibly by adding a driver specific autosuspend timeout. And doing this, we can then make the related dev_err into a dev_dbg message instead of an error. In order for the wake-up events to work, we also need to set autosuspend_timeout to -1 if 0, and also device_init_wakeup() as that's not being done by the platform init code for the device tree case. Note that this does not affect legacy booting, and in fact might make it work for the cases where the context loss info is not being passed in pdata. Thanks to Kevin Hilman <khilman@linaro.org> for debugging and suggesting fixes for the autosuspend_timeout and device_init_wakeup() related initializiation. Reviewed-by: Kevin Hilman <khilman@linaro.org> Tested-by: Kevin Hilman <khilman@linaro.org> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/omap-serial.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 156b5aaed95b..b6d172873076 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -198,7 +198,7 @@ static int serial_omap_get_context_loss_count(struct uart_omap_port *up)
198 struct omap_uart_port_info *pdata = up->dev->platform_data; 198 struct omap_uart_port_info *pdata = up->dev->platform_data;
199 199
200 if (!pdata || !pdata->get_context_loss_count) 200 if (!pdata || !pdata->get_context_loss_count)
201 return 0; 201 return -EINVAL;
202 202
203 return pdata->get_context_loss_count(up->dev); 203 return pdata->get_context_loss_count(up->dev);
204} 204}
@@ -1502,6 +1502,9 @@ static int serial_omap_probe(struct platform_device *pdev)
1502 1502
1503 platform_set_drvdata(pdev, up); 1503 platform_set_drvdata(pdev, up);
1504 pm_runtime_enable(&pdev->dev); 1504 pm_runtime_enable(&pdev->dev);
1505 if (omap_up_info->autosuspend_timeout == 0)
1506 omap_up_info->autosuspend_timeout = -1;
1507 device_init_wakeup(up->dev, true);
1505 pm_runtime_use_autosuspend(&pdev->dev); 1508 pm_runtime_use_autosuspend(&pdev->dev);
1506 pm_runtime_set_autosuspend_delay(&pdev->dev, 1509 pm_runtime_set_autosuspend_delay(&pdev->dev,
1507 omap_up_info->autosuspend_timeout); 1510 omap_up_info->autosuspend_timeout);
@@ -1611,7 +1614,6 @@ static void serial_omap_restore_context(struct uart_omap_port *up)
1611static int serial_omap_runtime_suspend(struct device *dev) 1614static int serial_omap_runtime_suspend(struct device *dev)
1612{ 1615{
1613 struct uart_omap_port *up = dev_get_drvdata(dev); 1616 struct uart_omap_port *up = dev_get_drvdata(dev);
1614 struct omap_uart_port_info *pdata = dev->platform_data;
1615 1617
1616 if (!up) 1618 if (!up)
1617 return -EINVAL; 1619 return -EINVAL;
@@ -1626,9 +1628,6 @@ static int serial_omap_runtime_suspend(struct device *dev)
1626 uart_console(&up->port)) 1628 uart_console(&up->port))
1627 return -EBUSY; 1629 return -EBUSY;
1628 1630
1629 if (!pdata)
1630 return 0;
1631
1632 up->context_loss_cnt = serial_omap_get_context_loss_count(up); 1631 up->context_loss_cnt = serial_omap_get_context_loss_count(up);
1633 1632
1634 if (device_may_wakeup(dev)) { 1633 if (device_may_wakeup(dev)) {
@@ -1656,7 +1655,7 @@ static int serial_omap_runtime_resume(struct device *dev)
1656 int loss_cnt = serial_omap_get_context_loss_count(up); 1655 int loss_cnt = serial_omap_get_context_loss_count(up);
1657 1656
1658 if (loss_cnt < 0) { 1657 if (loss_cnt < 0) {
1659 dev_err(dev, "serial_omap_get_context_loss_count failed : %d\n", 1658 dev_dbg(dev, "serial_omap_get_context_loss_count failed : %d\n",
1660 loss_cnt); 1659 loss_cnt);
1661 serial_omap_restore_context(up); 1660 serial_omap_restore_context(up);
1662 } else if (up->context_loss_cnt != loss_cnt) { 1661 } else if (up->context_loss_cnt != loss_cnt) {