linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] da8xx-fb: save and restore LCDC context across suspend/resume cycle
@ 2012-09-25 14:23 Manjunathappa, Prakash
  0 siblings, 0 replies; 2+ messages in thread
From: Manjunathappa, Prakash @ 2012-09-25 14:23 UTC (permalink / raw)
  To: linux-fbdev

Save and restore register context of LCDC respectively
before suspend and after resume.

Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com>
---
Applies on top of below patch under review:
"da8xx-fb: add pm_runtime support"
 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 4280d23..65a11ef 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -1491,6 +1491,69 @@ err_request_mem:
 }
 
 #ifdef CONFIG_PM
+struct lcdc_context {
+	u32 clk_enable;
+	u32 ctrl;
+	u32 dma_ctrl;
+	u32 raster_timing_0;
+	u32 raster_timing_1;
+	u32 raster_timing_2;
+	u32 int_enable_set;
+	u32 dma_frm_buf_base_addr_0;
+	u32 dma_frm_buf_ceiling_addr_0;
+	u32 dma_frm_buf_base_addr_1;
+	u32 dma_frm_buf_ceiling_addr_1;
+	u32 raster_ctrl;
+} reg_context;
+
+static void lcd_context_save(void)
+{
+	if (lcd_revision = LCD_VERSION_2) {
+		reg_context.clk_enable = lcdc_read(LCD_CLK_ENABLE_REG);
+		reg_context.int_enable_set = lcdc_read(LCD_INT_ENABLE_SET_REG);
+	}
+
+	reg_context.ctrl = lcdc_read(LCD_CTRL_REG);
+	reg_context.dma_ctrl = lcdc_read(LCD_DMA_CTRL_REG);
+	reg_context.raster_timing_0 = lcdc_read(LCD_RASTER_TIMING_0_REG);
+	reg_context.raster_timing_1 = lcdc_read(LCD_RASTER_TIMING_1_REG);
+	reg_context.raster_timing_2 = lcdc_read(LCD_RASTER_TIMING_2_REG);
+	reg_context.dma_frm_buf_base_addr_0 +		lcdc_read(LCD_DMA_FRM_BUF_BASE_ADDR_0_REG);
+	reg_context.dma_frm_buf_ceiling_addr_0 +		lcdc_read(LCD_DMA_FRM_BUF_CEILING_ADDR_0_REG);
+	reg_context.dma_frm_buf_base_addr_1 +		lcdc_read(LCD_DMA_FRM_BUF_BASE_ADDR_1_REG);
+	reg_context.dma_frm_buf_ceiling_addr_1 +		lcdc_read(LCD_DMA_FRM_BUF_CEILING_ADDR_1_REG);
+	reg_context.raster_ctrl = lcdc_read(LCD_RASTER_CTRL_REG);
+	return;
+}
+
+static void lcd_context_restore(void)
+{
+	if (lcd_revision = LCD_VERSION_2) {
+		lcdc_write(reg_context.clk_enable, LCD_CLK_ENABLE_REG);
+		lcdc_write(reg_context.int_enable_set, LCD_INT_ENABLE_SET_REG);
+	}
+
+	lcdc_write(reg_context.ctrl, LCD_CTRL_REG);
+	lcdc_write(reg_context.dma_ctrl, LCD_DMA_CTRL_REG);
+	lcdc_write(reg_context.raster_timing_0, LCD_RASTER_TIMING_0_REG);
+	lcdc_write(reg_context.raster_timing_1, LCD_RASTER_TIMING_1_REG);
+	lcdc_write(reg_context.raster_timing_2, LCD_RASTER_TIMING_2_REG);
+	lcdc_write(reg_context.dma_frm_buf_base_addr_0,
+			LCD_DMA_FRM_BUF_BASE_ADDR_0_REG);
+	lcdc_write(reg_context.dma_frm_buf_ceiling_addr_0,
+			LCD_DMA_FRM_BUF_CEILING_ADDR_0_REG);
+	lcdc_write(reg_context.dma_frm_buf_base_addr_1,
+			LCD_DMA_FRM_BUF_BASE_ADDR_1_REG);
+	lcdc_write(reg_context.dma_frm_buf_ceiling_addr_1,
+			LCD_DMA_FRM_BUF_CEILING_ADDR_1_REG);
+	lcdc_write(reg_context.raster_ctrl, LCD_RASTER_CTRL_REG);
+	return;
+}
+
 static int fb_suspend(struct platform_device *dev, pm_message_t state)
 {
 	struct fb_info *info = platform_get_drvdata(dev);
@@ -1502,6 +1565,7 @@ static int fb_suspend(struct platform_device *dev, pm_message_t state)
 
 	fb_set_suspend(info, 1);
 	lcd_disable_raster(true);
+	lcd_context_save();
 	pm_runtime_put_sync(&dev->dev);
 	console_unlock();
 
@@ -1514,6 +1578,7 @@ static int fb_resume(struct platform_device *dev)
 
 	console_lock();
 	pm_runtime_get_sync(&dev->dev);
+	lcd_context_restore();
 	if (par->blank = FB_BLANK_UNBLANK) {
 		lcd_enable_raster();
 
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] da8xx-fb: save and restore LCDC context across suspend/resume cycle
@ 2012-10-10 12:33 Florian Tobias Schandinat
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Tobias Schandinat @ 2012-10-10 12:33 UTC (permalink / raw)
  To: linux-fbdev

On 09/25/2012 02:11 PM, Manjunathappa, Prakash wrote:
> Save and restore register context of LCDC respectively
> before suspend and after resume.
> 
> Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com>

Applied.


Thanks,

Florian Tobias Schandinat


> ---
> Applies on top of below patch under review:
> "da8xx-fb: add pm_runtime support"
>  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 4280d23..65a11ef 100644
> --- a/drivers/video/da8xx-fb.c
> +++ b/drivers/video/da8xx-fb.c
> @@ -1491,6 +1491,69 @@ err_request_mem:
>  }
>  
>  #ifdef CONFIG_PM
> +struct lcdc_context {
> +	u32 clk_enable;
> +	u32 ctrl;
> +	u32 dma_ctrl;
> +	u32 raster_timing_0;
> +	u32 raster_timing_1;
> +	u32 raster_timing_2;
> +	u32 int_enable_set;
> +	u32 dma_frm_buf_base_addr_0;
> +	u32 dma_frm_buf_ceiling_addr_0;
> +	u32 dma_frm_buf_base_addr_1;
> +	u32 dma_frm_buf_ceiling_addr_1;
> +	u32 raster_ctrl;
> +} reg_context;
> +
> +static void lcd_context_save(void)
> +{
> +	if (lcd_revision = LCD_VERSION_2) {
> +		reg_context.clk_enable = lcdc_read(LCD_CLK_ENABLE_REG);
> +		reg_context.int_enable_set = lcdc_read(LCD_INT_ENABLE_SET_REG);
> +	}
> +
> +	reg_context.ctrl = lcdc_read(LCD_CTRL_REG);
> +	reg_context.dma_ctrl = lcdc_read(LCD_DMA_CTRL_REG);
> +	reg_context.raster_timing_0 = lcdc_read(LCD_RASTER_TIMING_0_REG);
> +	reg_context.raster_timing_1 = lcdc_read(LCD_RASTER_TIMING_1_REG);
> +	reg_context.raster_timing_2 = lcdc_read(LCD_RASTER_TIMING_2_REG);
> +	reg_context.dma_frm_buf_base_addr_0 > +		lcdc_read(LCD_DMA_FRM_BUF_BASE_ADDR_0_REG);
> +	reg_context.dma_frm_buf_ceiling_addr_0 > +		lcdc_read(LCD_DMA_FRM_BUF_CEILING_ADDR_0_REG);
> +	reg_context.dma_frm_buf_base_addr_1 > +		lcdc_read(LCD_DMA_FRM_BUF_BASE_ADDR_1_REG);
> +	reg_context.dma_frm_buf_ceiling_addr_1 > +		lcdc_read(LCD_DMA_FRM_BUF_CEILING_ADDR_1_REG);
> +	reg_context.raster_ctrl = lcdc_read(LCD_RASTER_CTRL_REG);
> +	return;
> +}
> +
> +static void lcd_context_restore(void)
> +{
> +	if (lcd_revision = LCD_VERSION_2) {
> +		lcdc_write(reg_context.clk_enable, LCD_CLK_ENABLE_REG);
> +		lcdc_write(reg_context.int_enable_set, LCD_INT_ENABLE_SET_REG);
> +	}
> +
> +	lcdc_write(reg_context.ctrl, LCD_CTRL_REG);
> +	lcdc_write(reg_context.dma_ctrl, LCD_DMA_CTRL_REG);
> +	lcdc_write(reg_context.raster_timing_0, LCD_RASTER_TIMING_0_REG);
> +	lcdc_write(reg_context.raster_timing_1, LCD_RASTER_TIMING_1_REG);
> +	lcdc_write(reg_context.raster_timing_2, LCD_RASTER_TIMING_2_REG);
> +	lcdc_write(reg_context.dma_frm_buf_base_addr_0,
> +			LCD_DMA_FRM_BUF_BASE_ADDR_0_REG);
> +	lcdc_write(reg_context.dma_frm_buf_ceiling_addr_0,
> +			LCD_DMA_FRM_BUF_CEILING_ADDR_0_REG);
> +	lcdc_write(reg_context.dma_frm_buf_base_addr_1,
> +			LCD_DMA_FRM_BUF_BASE_ADDR_1_REG);
> +	lcdc_write(reg_context.dma_frm_buf_ceiling_addr_1,
> +			LCD_DMA_FRM_BUF_CEILING_ADDR_1_REG);
> +	lcdc_write(reg_context.raster_ctrl, LCD_RASTER_CTRL_REG);
> +	return;
> +}
> +
>  static int fb_suspend(struct platform_device *dev, pm_message_t state)
>  {
>  	struct fb_info *info = platform_get_drvdata(dev);
> @@ -1502,6 +1565,7 @@ static int fb_suspend(struct platform_device *dev, pm_message_t state)
>  
>  	fb_set_suspend(info, 1);
>  	lcd_disable_raster(true);
> +	lcd_context_save();
>  	pm_runtime_put_sync(&dev->dev);
>  	console_unlock();
>  
> @@ -1514,6 +1578,7 @@ static int fb_resume(struct platform_device *dev)
>  
>  	console_lock();
>  	pm_runtime_get_sync(&dev->dev);
> +	lcd_context_restore();
>  	if (par->blank = FB_BLANK_UNBLANK) {
>  		lcd_enable_raster();
>  


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-10-10 12:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-25 14:23 [PATCH] da8xx-fb: save and restore LCDC context across suspend/resume cycle Manjunathappa, Prakash
  -- strict thread matches above, loose matches on Subject: below --
2012-10-10 12:33 Florian Tobias Schandinat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).