diff options
author | Manjunathappa, Prakash <prakash.pm@ti.com> | 2012-09-25 10:11:41 -0400 |
---|---|---|
committer | Florian Tobias Schandinat <FlorianSchandinat@gmx.de> | 2012-10-09 22:05:12 -0400 |
commit | 7a93cbbb51c56d021907ba6863d469feee73f379 (patch) | |
tree | 7fcdff07814ce7e9630ed8392b32385f07c3b2f0 | |
parent | 9dd44d5d2305862e61bf610b343658db38d9bd76 (diff) |
da8xx-fb: save and restore LCDC context across suspend/resume cycle
Save and restore register context of LCDC respectively
before suspend and after resume.
Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com>
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
-rw-r--r-- | drivers/video/da8xx-fb.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c index 4280d23e3300..65a11ef87e1c 100644 --- a/drivers/video/da8xx-fb.c +++ b/drivers/video/da8xx-fb.c | |||
@@ -1491,6 +1491,69 @@ err_request_mem: | |||
1491 | } | 1491 | } |
1492 | 1492 | ||
1493 | #ifdef CONFIG_PM | 1493 | #ifdef CONFIG_PM |
1494 | struct lcdc_context { | ||
1495 | u32 clk_enable; | ||
1496 | u32 ctrl; | ||
1497 | u32 dma_ctrl; | ||
1498 | u32 raster_timing_0; | ||
1499 | u32 raster_timing_1; | ||
1500 | u32 raster_timing_2; | ||
1501 | u32 int_enable_set; | ||
1502 | u32 dma_frm_buf_base_addr_0; | ||
1503 | u32 dma_frm_buf_ceiling_addr_0; | ||
1504 | u32 dma_frm_buf_base_addr_1; | ||
1505 | u32 dma_frm_buf_ceiling_addr_1; | ||
1506 | u32 raster_ctrl; | ||
1507 | } reg_context; | ||
1508 | |||
1509 | static void lcd_context_save(void) | ||
1510 | { | ||
1511 | if (lcd_revision == LCD_VERSION_2) { | ||
1512 | reg_context.clk_enable = lcdc_read(LCD_CLK_ENABLE_REG); | ||
1513 | reg_context.int_enable_set = lcdc_read(LCD_INT_ENABLE_SET_REG); | ||
1514 | } | ||
1515 | |||
1516 | reg_context.ctrl = lcdc_read(LCD_CTRL_REG); | ||
1517 | reg_context.dma_ctrl = lcdc_read(LCD_DMA_CTRL_REG); | ||
1518 | reg_context.raster_timing_0 = lcdc_read(LCD_RASTER_TIMING_0_REG); | ||
1519 | reg_context.raster_timing_1 = lcdc_read(LCD_RASTER_TIMING_1_REG); | ||
1520 | reg_context.raster_timing_2 = lcdc_read(LCD_RASTER_TIMING_2_REG); | ||
1521 | reg_context.dma_frm_buf_base_addr_0 = | ||
1522 | lcdc_read(LCD_DMA_FRM_BUF_BASE_ADDR_0_REG); | ||
1523 | reg_context.dma_frm_buf_ceiling_addr_0 = | ||
1524 | lcdc_read(LCD_DMA_FRM_BUF_CEILING_ADDR_0_REG); | ||
1525 | reg_context.dma_frm_buf_base_addr_1 = | ||
1526 | lcdc_read(LCD_DMA_FRM_BUF_BASE_ADDR_1_REG); | ||
1527 | reg_context.dma_frm_buf_ceiling_addr_1 = | ||
1528 | lcdc_read(LCD_DMA_FRM_BUF_CEILING_ADDR_1_REG); | ||
1529 | reg_context.raster_ctrl = lcdc_read(LCD_RASTER_CTRL_REG); | ||
1530 | return; | ||
1531 | } | ||
1532 | |||
1533 | static void lcd_context_restore(void) | ||
1534 | { | ||
1535 | if (lcd_revision == LCD_VERSION_2) { | ||
1536 | lcdc_write(reg_context.clk_enable, LCD_CLK_ENABLE_REG); | ||
1537 | lcdc_write(reg_context.int_enable_set, LCD_INT_ENABLE_SET_REG); | ||
1538 | } | ||
1539 | |||
1540 | lcdc_write(reg_context.ctrl, LCD_CTRL_REG); | ||
1541 | lcdc_write(reg_context.dma_ctrl, LCD_DMA_CTRL_REG); | ||
1542 | lcdc_write(reg_context.raster_timing_0, LCD_RASTER_TIMING_0_REG); | ||
1543 | lcdc_write(reg_context.raster_timing_1, LCD_RASTER_TIMING_1_REG); | ||
1544 | lcdc_write(reg_context.raster_timing_2, LCD_RASTER_TIMING_2_REG); | ||
1545 | lcdc_write(reg_context.dma_frm_buf_base_addr_0, | ||
1546 | LCD_DMA_FRM_BUF_BASE_ADDR_0_REG); | ||
1547 | lcdc_write(reg_context.dma_frm_buf_ceiling_addr_0, | ||
1548 | LCD_DMA_FRM_BUF_CEILING_ADDR_0_REG); | ||
1549 | lcdc_write(reg_context.dma_frm_buf_base_addr_1, | ||
1550 | LCD_DMA_FRM_BUF_BASE_ADDR_1_REG); | ||
1551 | lcdc_write(reg_context.dma_frm_buf_ceiling_addr_1, | ||
1552 | LCD_DMA_FRM_BUF_CEILING_ADDR_1_REG); | ||
1553 | lcdc_write(reg_context.raster_ctrl, LCD_RASTER_CTRL_REG); | ||
1554 | return; | ||
1555 | } | ||
1556 | |||
1494 | static int fb_suspend(struct platform_device *dev, pm_message_t state) | 1557 | static int fb_suspend(struct platform_device *dev, pm_message_t state) |
1495 | { | 1558 | { |
1496 | struct fb_info *info = platform_get_drvdata(dev); | 1559 | struct fb_info *info = platform_get_drvdata(dev); |
@@ -1502,6 +1565,7 @@ static int fb_suspend(struct platform_device *dev, pm_message_t state) | |||
1502 | 1565 | ||
1503 | fb_set_suspend(info, 1); | 1566 | fb_set_suspend(info, 1); |
1504 | lcd_disable_raster(true); | 1567 | lcd_disable_raster(true); |
1568 | lcd_context_save(); | ||
1505 | pm_runtime_put_sync(&dev->dev); | 1569 | pm_runtime_put_sync(&dev->dev); |
1506 | console_unlock(); | 1570 | console_unlock(); |
1507 | 1571 | ||
@@ -1514,6 +1578,7 @@ static int fb_resume(struct platform_device *dev) | |||
1514 | 1578 | ||
1515 | console_lock(); | 1579 | console_lock(); |
1516 | pm_runtime_get_sync(&dev->dev); | 1580 | pm_runtime_get_sync(&dev->dev); |
1581 | lcd_context_restore(); | ||
1517 | if (par->blank == FB_BLANK_UNBLANK) { | 1582 | if (par->blank == FB_BLANK_UNBLANK) { |
1518 | lcd_enable_raster(); | 1583 | lcd_enable_raster(); |
1519 | 1584 | ||