|
@@ -1440,15 +1440,31 @@ static void serial_omap_restore_context(struct uart_omap_port *up)
|
|
|
#ifdef CONFIG_PM_RUNTIME
|
|
|
static int serial_omap_runtime_suspend(struct device *dev)
|
|
|
{
|
|
|
+ struct uart_omap_port *up = dev_get_drvdata(dev);
|
|
|
+ struct omap_uart_port_info *pdata = dev->platform_data;
|
|
|
+
|
|
|
+ if (!up)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ if (pdata->get_context_loss_count)
|
|
|
+ up->context_loss_cnt = pdata->get_context_loss_count(dev);
|
|
|
+
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
static int serial_omap_runtime_resume(struct device *dev)
|
|
|
{
|
|
|
struct uart_omap_port *up = dev_get_drvdata(dev);
|
|
|
+ struct omap_uart_port_info *pdata = dev->platform_data;
|
|
|
|
|
|
- if (up)
|
|
|
- serial_omap_restore_context(up);
|
|
|
+ if (up) {
|
|
|
+ if (pdata->get_context_loss_count) {
|
|
|
+ u32 loss_cnt = pdata->get_context_loss_count(dev);
|
|
|
+
|
|
|
+ if (up->context_loss_cnt != loss_cnt)
|
|
|
+ serial_omap_restore_context(up);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
return 0;
|
|
|
}
|