aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/video/omap2/dss/dispc.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index bbeb8dd7f108..1659aa912d2b 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -100,8 +100,6 @@ static struct {
100 struct platform_device *pdev; 100 struct platform_device *pdev;
101 void __iomem *base; 101 void __iomem *base;
102 102
103 int ctx_loss_cnt;
104
105 int irq; 103 int irq;
106 104
107 unsigned long core_clk_rate; 105 unsigned long core_clk_rate;
@@ -357,29 +355,20 @@ static void dispc_save_context(void)
357 if (dss_has_feature(FEAT_CORE_CLK_DIV)) 355 if (dss_has_feature(FEAT_CORE_CLK_DIV))
358 SR(DIVISOR); 356 SR(DIVISOR);
359 357
360 dispc.ctx_loss_cnt = dss_get_ctx_loss_count();
361 dispc.ctx_valid = true; 358 dispc.ctx_valid = true;
362 359
363 DSSDBG("context saved, ctx_loss_count %d\n", dispc.ctx_loss_cnt); 360 DSSDBG("context saved\n");
364} 361}
365 362
366static void dispc_restore_context(void) 363static void dispc_restore_context(void)
367{ 364{
368 int i, j, ctx; 365 int i, j;
369 366
370 DSSDBG("dispc_restore_context\n"); 367 DSSDBG("dispc_restore_context\n");
371 368
372 if (!dispc.ctx_valid) 369 if (!dispc.ctx_valid)
373 return; 370 return;
374 371
375 ctx = dss_get_ctx_loss_count();
376
377 if (ctx >= 0 && ctx == dispc.ctx_loss_cnt)
378 return;
379
380 DSSDBG("ctx_loss_count: saved %d, current %d\n",
381 dispc.ctx_loss_cnt, ctx);
382
383 /*RR(IRQENABLE);*/ 372 /*RR(IRQENABLE);*/
384 /*RR(CONTROL);*/ 373 /*RR(CONTROL);*/
385 RR(CONFIG); 374 RR(CONFIG);
@@ -3768,6 +3757,15 @@ static int dispc_runtime_suspend(struct device *dev)
3768 3757
3769static int dispc_runtime_resume(struct device *dev) 3758static int dispc_runtime_resume(struct device *dev)
3770{ 3759{
3760 /*
3761 * The reset value for load mode is 0 (OMAP_DSS_LOAD_CLUT_AND_FRAME)
3762 * but we always initialize it to 2 (OMAP_DSS_LOAD_FRAME_ONLY) in
3763 * _omap_dispc_initial_config(). We can thus use it to detect if
3764 * we have lost register context.
3765 */
3766 if (REG_GET(DISPC_CONFIG, 2, 1) == OMAP_DSS_LOAD_FRAME_ONLY)
3767 return 0;
3768
3771 _omap_dispc_initial_config(); 3769 _omap_dispc_initial_config();
3772 3770
3773 dispc_restore_context(); 3771 dispc_restore_context();