From 04576d415e01aa08752bf3884db9862cfbba9115 Mon Sep 17 00:00:00 2001
From: Tomi Valkeinen <tomi.valkeinen@ti.com>
Date: Sat, 26 Nov 2011 14:39:16 +0200
Subject: [PATCH] OMAPDSS: APPLY: write fifo thresholds only if changed

Current code will always write fifo threshold values to the register,
even if they are the same as previously. Separate the setting of fifo
fields into a separate function, and only set new values if they are
different than the old ones.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/apply.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 5f5812b528de..a3c75f582e1f 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -953,6 +953,19 @@ static void dss_apply_ovl_enable(struct omap_overlay *ovl, bool enable)
 	op->extra_info_dirty = true;
 }
 
+static void dss_apply_ovl_fifo_thresholds(struct omap_overlay *ovl,
+		u32 fifo_low, u32 fifo_high)
+{
+	struct ovl_priv_data *op = get_ovl_priv(ovl);
+
+	if (op->fifo_low == fifo_low && op->fifo_high == fifo_high)
+		return;
+
+	op->fifo_low = fifo_low;
+	op->fifo_high = fifo_high;
+	op->extra_info_dirty = true;
+}
+
 static void dss_ovl_setup_fifo(struct omap_overlay *ovl)
 {
 	struct ovl_priv_data *op = get_ovl_priv(ovl);
@@ -988,9 +1001,7 @@ static void dss_ovl_setup_fifo(struct omap_overlay *ovl)
 		BUG();
 	}
 
-	op->fifo_low = fifo_low;
-	op->fifo_high = fifo_high;
-	op->extra_info_dirty = true;
+	dss_apply_ovl_fifo_thresholds(ovl, fifo_low, fifo_high);
 }
 
 static void dss_mgr_setup_fifos(struct omap_overlay_manager *mgr)
-- 
2.20.1