From patchwork Mon Jun 23 05:32:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Sharma X-Patchwork-Id: 4399351 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 C9A2BBEEAA for ; Mon, 23 Jun 2014 05:33:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 84D33202A7 for ; Mon, 23 Jun 2014 05:33:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 70E5E20295 for ; Mon, 23 Jun 2014 05:33:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751201AbaFWFd2 (ORCPT ); Mon, 23 Jun 2014 01:33:28 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:17858 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751122AbaFWFd1 (ORCPT ); Mon, 23 Jun 2014 01:33:27 -0400 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 <0N7L009F3WRQARE0@mailout3.samsung.com> for linux-samsung-soc@vger.kernel.org; Mon, 23 Jun 2014 14:33:26 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.123]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 55.AF.14704.52CB7A35; Mon, 23 Jun 2014 14:33:25 +0900 (KST) X-AuditID: cbfee68f-b7fef6d000003970-7b-53a7bc25eca6 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id A5.A8.05196.52CB7A35; Mon, 23 Jun 2014 14:33:25 +0900 (KST) Received: from localhost.localdomain ([107.108.83.245]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N7L00JJKWRH6C90@mmp2.samsung.com>; Mon, 23 Jun 2014 14:33:25 +0900 (KST) From: Rahul Sharma To: dri-devel@lists.freedesktop.org Cc: linux-samsung-soc@vger.kernel.org, inki.dae@samsung.com, kgene.kim@samsung.com, joshi@samsung.com, r.sh.open@gmail.com, Rahul Sharma Subject: [PATCH 2/5 v2] drm/exynos: stop mixer before gating clocks during poweroff Date: Mon, 23 Jun 2014 11:02:22 +0530 Message-id: <1403501545-16482-3-git-send-email-rahul.sharma@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1403501545-16482-1-git-send-email-rahul.sharma@samsung.com> References: <1403501545-16482-1-git-send-email-rahul.sharma@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrALMWRmVeSWpSXmKPExsWyRsSkWld1z/Jgg0UT9CyufH3PZjHp/gQW i++7vrBb9C64ymYx4/w+JouFL+Itpiw6zOrA7rFz1l12j/vdx5k8+rasYvT4vEkugCWKyyYl NSezLLVI3y6BK+N381r2go98FbdnzGNpYDzI08XIySEhYCLR9auHGcIWk7hwbz1bFyMXh5DA UkaJPQebmGCK7jfsZASxhQSmM0q0ThCCKGpnktj0fhobSIJNQFdi9sFnYEUiAsoSfyeuYgQp YhZYzijxcnMLWJGwQKjEqkvPwWwWAVWJhX0LWEFsXgEPiUtPVwHZHEDbFCTmTLIBCXMKeEp0 XfoOtdhD4uGjBewgMyUE+tkl5nxcyA4xR0Di2+RDLBC9shKbDkB9IylxcMUNlgmMwgsYGVYx iqYWJBcUJ6UXGesVJ+YWl+al6yXn525iBIb26X/P+ncw3j1gfYgxGWjcRGYp0eR8YGzklcQb GpsZWZiamBobmVuakSasJM57/2FSkJB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2PHzw+JAJZbijERDLeai4kQAKe9GaLICAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 Mixer should be power gated only after it is gracefully stopped. The recommended sequence is to Stop the mixer and wait till it enters to IDLE state before gating the clocks and power to the mixer. Signed-off-by: Rahul Sharma --- drivers/gpu/drm/exynos/exynos_mixer.c | 15 +++++++++++++++ drivers/gpu/drm/exynos/regs-mixer.h | 1 + 2 files changed, 16 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index c00abbe..d359501 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -377,6 +377,20 @@ static void mixer_run(struct mixer_context *ctx) mixer_regs_dump(ctx); } +static void mixer_stop(struct mixer_context *ctx) +{ + struct mixer_resources *res = &ctx->mixer_res; + int timeout = 20; + + mixer_reg_writemask(res, MXR_STATUS, 0, MXR_STATUS_REG_RUN); + + while (!(mixer_reg_read(res, MXR_STATUS) & MXR_STATUS_REG_IDLE) && + --timeout) + usleep_range(10000, 12000); + + mixer_regs_dump(ctx); +} + static void vp_video_buffer(struct mixer_context *ctx, int win) { struct mixer_resources *res = &ctx->mixer_res; @@ -1094,6 +1108,7 @@ static void mixer_poweroff(struct exynos_drm_manager *mgr) } mutex_unlock(&ctx->mixer_mutex); + mixer_stop(ctx); mixer_window_suspend(mgr); ctx->int_en = mixer_reg_read(res, MXR_INT_EN); diff --git a/drivers/gpu/drm/exynos/regs-mixer.h b/drivers/gpu/drm/exynos/regs-mixer.h index 4537026..5f32e1a 100644 --- a/drivers/gpu/drm/exynos/regs-mixer.h +++ b/drivers/gpu/drm/exynos/regs-mixer.h @@ -78,6 +78,7 @@ #define MXR_STATUS_BIG_ENDIAN (1 << 3) #define MXR_STATUS_ENDIAN_MASK (1 << 3) #define MXR_STATUS_SYNC_ENABLE (1 << 2) +#define MXR_STATUS_REG_IDLE (1 << 1) #define MXR_STATUS_REG_RUN (1 << 0) /* bits for MXR_CFG */