diff options
-rw-r--r-- | arch/arm/mach-omap2/serial.c | 2 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/omap-serial.h | 3 | ||||
-rw-r--r-- | drivers/tty/serial/omap-serial.c | 20 |
3 files changed, 23 insertions, 2 deletions
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index b3f3284bf6ba..78ca7e8fc10b 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <plat/dma.h> | 33 | #include <plat/dma.h> |
34 | #include <plat/omap_hwmod.h> | 34 | #include <plat/omap_hwmod.h> |
35 | #include <plat/omap_device.h> | 35 | #include <plat/omap_device.h> |
36 | #include <plat/omap-pm.h> | ||
36 | 37 | ||
37 | #include "prm2xxx_3xxx.h" | 38 | #include "prm2xxx_3xxx.h" |
38 | #include "pm.h" | 39 | #include "pm.h" |
@@ -478,6 +479,7 @@ void __init omap_serial_init_port(struct omap_board_data *bdata) | |||
478 | omap_up.dma_enabled = uart->dma_enabled; | 479 | omap_up.dma_enabled = uart->dma_enabled; |
479 | omap_up.uartclk = OMAP24XX_BASE_BAUD * 16; | 480 | omap_up.uartclk = OMAP24XX_BASE_BAUD * 16; |
480 | omap_up.flags = UPF_BOOT_AUTOCONF; | 481 | omap_up.flags = UPF_BOOT_AUTOCONF; |
482 | omap_up.get_context_loss_count = omap_pm_get_dev_context_loss_count; | ||
481 | 483 | ||
482 | pdata = &omap_up; | 484 | pdata = &omap_up; |
483 | pdata_size = sizeof(struct omap_uart_port_info); | 485 | pdata_size = sizeof(struct omap_uart_port_info); |
diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h index 5b913c71cd7f..348c9ead6edb 100644 --- a/arch/arm/plat-omap/include/plat/omap-serial.h +++ b/arch/arm/plat-omap/include/plat/omap-serial.h | |||
@@ -62,6 +62,8 @@ struct omap_uart_port_info { | |||
62 | bool dma_enabled; /* To specify DMA Mode */ | 62 | bool dma_enabled; /* To specify DMA Mode */ |
63 | unsigned int uartclk; /* UART clock rate */ | 63 | unsigned int uartclk; /* UART clock rate */ |
64 | upf_t flags; /* UPF_* flags */ | 64 | upf_t flags; /* UPF_* flags */ |
65 | |||
66 | int (*get_context_loss_count)(struct device *); | ||
65 | }; | 67 | }; |
66 | 68 | ||
67 | struct uart_omap_dma { | 69 | struct uart_omap_dma { |
@@ -114,6 +116,7 @@ struct uart_omap_port { | |||
114 | unsigned char msr_saved_flags; | 116 | unsigned char msr_saved_flags; |
115 | char name[20]; | 117 | char name[20]; |
116 | unsigned long port_activity; | 118 | unsigned long port_activity; |
119 | u32 context_loss_cnt; | ||
117 | }; | 120 | }; |
118 | 121 | ||
119 | #endif /* __OMAP_SERIAL_H__ */ | 122 | #endif /* __OMAP_SERIAL_H__ */ |
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 |
1441 | static int serial_omap_runtime_suspend(struct device *dev) | 1441 | static 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 | ||
1446 | static int serial_omap_runtime_resume(struct device *dev) | 1455 | static 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 | } |