aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/tty/serial/omap-serial.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index f5a5ed676825..ea4c24aa8c87 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1440,15 +1440,31 @@ static void serial_omap_restore_context(struct uart_omap_port *up)
1440#ifdef CONFIG_PM_RUNTIME 1440#ifdef CONFIG_PM_RUNTIME
1441static int serial_omap_runtime_suspend(struct device *dev) 1441static int serial_omap_runtime_suspend(struct device *dev)
1442{ 1442{
1443 struct uart_omap_port *up = dev_get_drvdata(dev);
1444 struct omap_uart_port_info *pdata = dev->platform_data;
1445
1446 if (!up)
1447 return -EINVAL;
1448
1449 if (pdata->get_context_loss_count)
1450 up->context_loss_cnt = pdata->get_context_loss_count(dev);
1451
1443 return 0; 1452 return 0;
1444} 1453}
1445 1454
1446static int serial_omap_runtime_resume(struct device *dev) 1455static int serial_omap_runtime_resume(struct device *dev)
1447{ 1456{
1448 struct uart_omap_port *up = dev_get_drvdata(dev); 1457 struct uart_omap_port *up = dev_get_drvdata(dev);
1458 struct omap_uart_port_info *pdata = dev->platform_data;
1449 1459
1450 if (up) 1460 if (up) {
1451 serial_omap_restore_context(up); 1461 if (pdata->get_context_loss_count) {
1462 u32 loss_cnt = pdata->get_context_loss_count(dev);
1463
1464 if (up->context_loss_cnt != loss_cnt)
1465 serial_omap_restore_context(up);
1466 }
1467 }
1452 1468
1453 return 0; 1469 return 0;
1454} 1470}