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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index b7f56935a46b..226127f35052 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -331,6 +331,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;
@@ -349,12 +357,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;
 		}
 	}
@@ -805,15 +808,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)
@@ -848,7 +847,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);
-- 
2.17.1




[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux for Synopsys ARC Processors]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  Powered by Linux