Commit 9229b516 authored by Tomi Valkeinen's avatar Tomi Valkeinen

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: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: default avatarArchit Taneja <archit@ti.com>
parent 622f7c9b
...@@ -100,8 +100,6 @@ static struct { ...@@ -100,8 +100,6 @@ static struct {
struct platform_device *pdev; struct platform_device *pdev;
void __iomem *base; void __iomem *base;
int ctx_loss_cnt;
int irq; int irq;
unsigned long core_clk_rate; unsigned long core_clk_rate;
...@@ -357,29 +355,20 @@ static void dispc_save_context(void) ...@@ -357,29 +355,20 @@ static void dispc_save_context(void)
if (dss_has_feature(FEAT_CORE_CLK_DIV)) if (dss_has_feature(FEAT_CORE_CLK_DIV))
SR(DIVISOR); SR(DIVISOR);
dispc.ctx_loss_cnt = dss_get_ctx_loss_count();
dispc.ctx_valid = true; dispc.ctx_valid = true;
DSSDBG("context saved, ctx_loss_count %d\n", dispc.ctx_loss_cnt); DSSDBG("context saved\n");
} }
static void dispc_restore_context(void) static void dispc_restore_context(void)
{ {
int i, j, ctx; int i, j;
DSSDBG("dispc_restore_context\n"); DSSDBG("dispc_restore_context\n");
if (!dispc.ctx_valid) if (!dispc.ctx_valid)
return; return;
ctx = dss_get_ctx_loss_count();
if (ctx >= 0 && ctx == dispc.ctx_loss_cnt)
return;
DSSDBG("ctx_loss_count: saved %d, current %d\n",
dispc.ctx_loss_cnt, ctx);
/*RR(IRQENABLE);*/ /*RR(IRQENABLE);*/
/*RR(CONTROL);*/ /*RR(CONTROL);*/
RR(CONFIG); RR(CONFIG);
...@@ -3768,6 +3757,15 @@ static int dispc_runtime_suspend(struct device *dev) ...@@ -3768,6 +3757,15 @@ static int dispc_runtime_suspend(struct device *dev)
static int dispc_runtime_resume(struct device *dev) static int dispc_runtime_resume(struct device *dev)
{ {
/*
* The reset value for load mode is 0 (OMAP_DSS_LOAD_CLUT_AND_FRAME)
* but we always initialize it to 2 (OMAP_DSS_LOAD_FRAME_ONLY) in
* _omap_dispc_initial_config(). We can thus use it to detect if
* we have lost register context.
*/
if (REG_GET(DISPC_CONFIG, 2, 1) == OMAP_DSS_LOAD_FRAME_ONLY)
return 0;
_omap_dispc_initial_config(); _omap_dispc_initial_config();
dispc_restore_context(); dispc_restore_context();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment