aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2014-02-14 02:37:09 -0500
committerTomi Valkeinen <tomi.valkeinen@ti.com>2014-02-28 05:35:42 -0500
commit9229b5165bf0c49a7576dababa116f1634988e77 (patch)
tree114e9a66fbf08890a11c49790e5f319d3c1054ea
parent622f7c9b9a27acce6cd9ec33f80c682e1a84b86e (diff)
OMAPDSS: use DISPC register to detect context loss
Instead of relying on the OMAP specific omap_pm_get_dev_context_loss_count() to detect register context loss, we can achieve the same in a much simpler way by just observing the DISPC registers. We always set DISPC's load mode to LOAD_FRAME_ONLY, which is not the reset value. Thus we can just observe the load mode to see if we have lost register context. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Reviewed-by: Archit Taneja <archit@ti.com>
-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();