From patchwork Wed Jun 18 11:34:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Sharma X-Patchwork-Id: 4375551 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 7909FBEEAA for ; Wed, 18 Jun 2014 11:37:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 66F932034E for ; Wed, 18 Jun 2014 11:37:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 27DFF202AE for ; Wed, 18 Jun 2014 11:37:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933954AbaFRLhj (ORCPT ); Wed, 18 Jun 2014 07:37:39 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:25165 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933617AbaFRLhj (ORCPT ); Wed, 18 Jun 2014 07:37:39 -0400 Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N7D00FLE4APEG20@mailout3.samsung.com> for linux-samsung-soc@vger.kernel.org; Wed, 18 Jun 2014 20:37:37 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.125]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id E6.BE.13369.10A71A35; Wed, 18 Jun 2014 20:37:37 +0900 (KST) X-AuditID: cbfee690-b7fb56d000003439-13-53a17a012ff6 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id C9.11.08203.10A71A35; Wed, 18 Jun 2014 20:37:37 +0900 (KST) Received: from localhost.localdomain ([107.108.83.245]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N7D00KA047K8A70@mmp1.samsung.com>; Wed, 18 Jun 2014 20:37:37 +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] drm/exynos: stop mixer before gating clocks during poweroff Date: Wed, 18 Jun 2014 17:04:50 +0530 Message-id: <1403091293-15058-3-git-send-email-rahul.sharma@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1403091293-15058-1-git-send-email-rahul.sharma@samsung.com> References: <1403091293-15058-1-git-send-email-rahul.sharma@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrILMWRmVeSWpSXmKPExsWyRsSkVpexamGwwfsOMYsrX9+zWUy6P4HF 4vuuL+wWvQuuslnMOL+PyWLhi3iLKYsOszqwe+ycdZfd4373cSaPvi2rGD0+b5ILYInisklJ zcksSy3St0vgyvjdvJa94CNfxe0Z81gaGA/ydDFyckgImEjsfLOJBcIWk7hwbz1bFyMXh5DA UkaJ/TPOM8MUdUx7zAiRWMQocb73EzOE084kselAA1gVm4CuxOyDzxhBbBEBZYm/E1eBdTAL LGeUeLm5hQ0kISwQIHGycQVYEYuAqsSV1w/B4rwCHhL3/75g6mLkAFqnIDFnkg1ImFPAU2L2 k+tg84WASt7Pn8gCMlNCYDq7xIQnO9gg5ghIfJt8iAWiVxboIKirJSUOrrjBMoFReAEjwypG 0dSC5ILipPQiE73ixNzi0rx0veT83E2MwOA+/e/ZhB2M9w5YH2JMBho3kVlKNDkfGB15JfGG xmZGFqYmpsZG5pZmpAkrifOqPUoKEhJITyxJzU5NLUgt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pL1b0N/501lFiKMxINtZiLihMB4JnUuOECAAA= 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 */