diff options
author | Govindraj.R <govindraj.raja@ti.com> | 2011-10-11 15:41:27 +0200 |
---|---|---|
committer | Kevin Hilman <khilman@ti.com> | 2011-12-15 01:05:22 +0100 |
commit | ec3bebc6ec64aac23500e6b8ef5c0aaaeda735cf (patch) | |
tree | 8d47117285aecdb37e65f1fc72b3070f45444433 /drivers | |
parent | ARM: OMAP2+: UART: Remove uart reset function. (diff) | |
download | linux-ec3bebc6ec64aac23500e6b8ef5c0aaaeda735cf.tar.xz linux-ec3bebc6ec64aac23500e6b8ef5c0aaaeda735cf.zip |
ARM: OMAP2+: UART: Get context loss count to context restore
Avoid unconditional context restore every time we gate uart
clocks. Check whether context loss happened based on which
we can context restore uart regs from uart_port structure.
Signed-off-by: Govindraj.R <govindraj.raja@ti.com>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de> (for drivers/tty changes)
Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/tty/serial/omap-serial.c | 20 |
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) #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; } |