From patchwork Wed Oct 1 06:19:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: YoungJun Cho X-Patchwork-Id: 5009821 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5E3F7BEEA7 for ; Wed, 1 Oct 2014 06:19:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8D2F420259 for ; Wed, 1 Oct 2014 06:19:22 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9514F20260 for ; Wed, 1 Oct 2014 06:19:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 738816E2C1; Tue, 30 Sep 2014 23:19:20 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by gabe.freedesktop.org (Postfix) with ESMTP id 167066E2C0 for ; Tue, 30 Sep 2014 23:19:19 -0700 (PDT) Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NCR002IO5K6K870@mailout3.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 01 Oct 2014 15:19:18 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.46]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id AC.2B.18484.5EC9B245; Wed, 01 Oct 2014 15:19:17 +0900 (KST) X-AuditID: cbfee68f-f791c6d000004834-03-542b9ce57260 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id A6.C1.09430.5EC9B245; Wed, 01 Oct 2014 15:19:17 +0900 (KST) Received: from localhost.localdomain ([10.252.75.90]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NCR002UR5K1JBD0@mmp2.samsung.com>; Wed, 01 Oct 2014 15:19:17 +0900 (KST) From: YoungJun Cho To: airlied@linux.ie, dri-devel@lists.freedesktop.org Subject: [PATCH 2/7] drm/exynos: fimd: add fimd_channel_win() to clean up code Date: Wed, 01 Oct 2014 15:19:08 +0900 Message-id: <1412144353-13114-3-git-send-email-yj44.cho@samsung.com> X-Mailer: git-send-email 1.9.0 In-reply-to: <1412144353-13114-1-git-send-email-yj44.cho@samsung.com> References: <1412144353-13114-1-git-send-email-yj44.cho@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrILMWRmVeSWpSXmKPExsVy+t8zPd2nc7RDDBb0ilvcWneO1aL33Ekm iytf37NZTLo/gcXixb2LLBZnm96wW8yY/JLNgd1j+7cHrB73u48zefRtWcUYwBzFZZOSmpNZ llqkb5fAlXHs2k2Wgj/SFafPXGBpYLwj1sXIySEhYCLx+tIjRghbTOLCvfVsXYxcHEICyxgl bn5cygpTtLfzI1RiOqPElTmb2SGcViaJB1vPs4FUsQloSjz/uAOsQ0TAVKJj0lIWEJtZoFpi 8cS5TCC2sICfxJZjj9lBbBYBVYnX72YydzFycPAKuEg8X2oOsUxOYsrvBWAlnAKuElPPngIr EQIqmT5TEWSthEA3u8SuE/tZIMYISHybfIgFpEZCQFZi0wFmiDGSEgdX3GCZwCi8gJFhFaNo akFyQXFSepGxXnFibnFpXrpecn7uJkZISPfvYLx7wPoQowAHoxIPr0KCdogQa2JZcWXuIUZT oA0TmaVEk/OBkZNXEm9obGZkYWpiamxkbmmmJM67UOpnsJBAemJJanZqakFqUXxRaU5q8SFG Jg5Oq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Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Cc: a.hajda@samsung.com, kyungmin.park@samsung.com, sw0312.kim@samsung.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The ENWIN_F in WINCON# register and C#_EN_Fs in SHADOWCON register should be always matched together, so adds fimd_channel_win() to clean up code. And this fimd_channel_win() should be called before unprotecting window in fimd_win_commit(). Signed-off-by: YoungJun Cho Acked-by: Inki Dae Acked-by: Kyungmin Park --- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 62 ++++++++++++++++---------------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 8b31b7e..b2f6007 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -214,6 +214,33 @@ static void fimd_wait_for_vblank(struct exynos_drm_manager *mgr) DRM_DEBUG_KMS("vblank wait timed out.\n"); } +static void fimd_channel_win(struct fimd_context *ctx, int win, bool enable) +{ + u32 val; + + /* for DMA output */ + val = readl(ctx->regs + WINCON(win)); + + if (enable) + val |= WINCONx_ENWIN; + else + val &= ~WINCONx_ENWIN; + + writel(val, ctx->regs + WINCON(win)); + + /* for shadow channel */ + if (ctx->driver_data->has_shadowcon) { + val = readl(ctx->regs + SHADOWCON); + + if (enable) + val |= SHADOWCON_CHx_ENABLE(win); + else + val &= ~SHADOWCON_CHx_ENABLE(win); + + writel(val, ctx->regs + SHADOWCON); + } +} + static void fimd_clear_channel(struct exynos_drm_manager *mgr) { struct fimd_context *ctx = mgr->ctx; @@ -226,16 +253,7 @@ static void fimd_clear_channel(struct exynos_drm_manager *mgr) u32 val = readl(ctx->regs + WINCON(win)); if (val & WINCONx_ENWIN) { - /* wincon */ - val &= ~WINCONx_ENWIN; - writel(val, ctx->regs + WINCON(win)); - - /* unprotect windows */ - if (ctx->driver_data->has_shadowcon) { - val = readl(ctx->regs + SHADOWCON); - val &= ~SHADOWCON_CHx_ENABLE(win); - writel(val, ctx->regs + SHADOWCON); - } + fimd_channel_win(ctx, win, false); ch_enabled = 1; } } @@ -730,20 +748,11 @@ static void fimd_win_commit(struct exynos_drm_manager *mgr, int zpos) if (win != 0) fimd_win_set_colkey(ctx, win); - /* wincon */ - val = readl(ctx->regs + WINCON(win)); - val |= WINCONx_ENWIN; - writel(val, ctx->regs + WINCON(win)); + fimd_channel_win(ctx, win, true); /* Enable DMA channel and unprotect windows */ fimd_shadow_protect_win(ctx, win, false); - if (ctx->driver_data->has_shadowcon) { - val = readl(ctx->regs + SHADOWCON); - val |= SHADOWCON_CHx_ENABLE(win); - writel(val, ctx->regs + SHADOWCON); - } - win_data->enabled = true; if (ctx->i80_if) @@ -755,7 +764,6 @@ static void fimd_win_disable(struct exynos_drm_manager *mgr, int zpos) struct fimd_context *ctx = mgr->ctx; struct fimd_win_data *win_data; int win = zpos; - u32 val; if (win == DEFAULT_ZPOS) win = ctx->default_win; @@ -774,17 +782,7 @@ static void fimd_win_disable(struct exynos_drm_manager *mgr, int zpos) /* protect windows */ fimd_shadow_protect_win(ctx, win, true); - /* wincon */ - val = readl(ctx->regs + WINCON(win)); - val &= ~WINCONx_ENWIN; - writel(val, ctx->regs + WINCON(win)); - - /* unprotect windows */ - if (ctx->driver_data->has_shadowcon) { - val = readl(ctx->regs + SHADOWCON); - val &= ~SHADOWCON_CHx_ENABLE(win); - writel(val, ctx->regs + SHADOWCON); - } + fimd_channel_win(ctx, win, false); fimd_shadow_protect_win(ctx, win, false);