diff mbox series

[v2,2/3] drm/exynos/fimd: create local helper for disabling hardware window

Message ID 20181210111834.17916-3-a.hajda@samsung.com (mailing list archive)
State Not Applicable
Headers show
Series drm/exynos: add support for dynamic zpos in DECON and FIMD | expand

Commit Message

Andrzej Hajda Dec. 10, 2018, 11:18 a.m. UTC
Hardware window disabling is performed in multiple places. Creating
helper for it simplifies the code and prepares it for further improvements.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 786a8ee6f10f..a7993f5d8371 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -345,6 +345,14 @@  static void fimd_enable_shadow_channel_path(struct fimd_context *ctx,
 	writel(val, ctx->regs + SHADOWCON);
 }
 
+static void fimd_disable_win(struct fimd_context *ctx, int win)
+{
+	fimd_enable_video_output(ctx, win, false);
+
+	if (ctx->driver_data->has_shadowcon)
+		fimd_enable_shadow_channel_path(ctx, win, false);
+}
+
 static void fimd_clear_channels(struct exynos_drm_crtc *crtc)
 {
 	struct fimd_context *ctx = crtc->ctx;
@@ -363,12 +371,7 @@  static void fimd_clear_channels(struct exynos_drm_crtc *crtc)
 		u32 val = readl(ctx->regs + WINCON(win));
 
 		if (val & WINCONx_ENWIN) {
-			fimd_enable_video_output(ctx, win, false);
-
-			if (ctx->driver_data->has_shadowcon)
-				fimd_enable_shadow_channel_path(ctx, win,
-								false);
-
+			fimd_disable_win(ctx, win);
 			ch_enabled = 1;
 		}
 	}
@@ -880,15 +883,11 @@  static void fimd_disable_plane(struct exynos_drm_crtc *crtc,
 			       struct exynos_drm_plane *plane)
 {
 	struct fimd_context *ctx = crtc->ctx;
-	unsigned int win = plane->index;
 
 	if (ctx->suspended)
 		return;
 
-	fimd_enable_video_output(ctx, win, false);
-
-	if (ctx->driver_data->has_shadowcon)
-		fimd_enable_shadow_channel_path(ctx, win, false);
+	fimd_disable_win(ctx, plane->index);
 }
 
 static void fimd_enable(struct exynos_drm_crtc *crtc)
@@ -923,7 +922,7 @@  static void fimd_disable(struct exynos_drm_crtc *crtc)
 	 * a destroyed buffer later.
 	 */
 	for (i = 0; i < WINDOWS_NR; i++)
-		fimd_disable_plane(crtc, &ctx->planes[i]);
+		fimd_disable_win(ctx, i);
 
 	fimd_enable_vblank(crtc);
 	fimd_wait_for_vblank(crtc);