From patchwork Thu Jan 22 07:05:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yao mark X-Patchwork-Id: 5682601 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4734C9F406 for ; Thu, 22 Jan 2015 07:07:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8770020328 for ; Thu, 22 Jan 2015 07:07:17 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B465420340 for ; Thu, 22 Jan 2015 07:07:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EA46B6E49D; Wed, 21 Jan 2015 23:07:15 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from regular1.263xmail.com (regular1.263xmail.com [211.150.99.134]) by gabe.freedesktop.org (Postfix) with ESMTP id 461C16E49D for ; Wed, 21 Jan 2015 23:07:14 -0800 (PST) Received: from mark.yao?rock-chips.com (unknown [192.168.167.224]) by regular1.263xmail.com (Postfix) with SMTP id 75C6B7105; Thu, 22 Jan 2015 15:07:10 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id C48341050; Thu, 22 Jan 2015 15:06:54 +0800 (CST) X-RL-SENDER: mark.yao@rock-chips.com X-SENDER-IP: 107.152.154.32 X-LOGIN-NAME: mark.yao@rock-chips.com X-UNIQUE-TAG: <95dd8dbb80410d57ba6bc630be780d65> X-ATTACHMENT-NUM: 0 X-SENDER: yzq@rock-chips.com X-DNS-TYPE: 0 Received: from unknown (unknown [107.152.154.32]) by smtp.263.net (Postfix) whith SMTP id 27237QYCFJU; Thu, 22 Jan 2015 15:07:07 +0800 (CST) From: Mark Yao To: David Airlie , Daniel Vetter , Rob Clark , Philipp Zabel , Daniel Kurtz , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org Subject: [PATCH 2/2] drm/rockchip: vop: set vop enabled after enable iommu Date: Thu, 22 Jan 2015 15:05:33 +0800 Message-Id: <1421910333-5576-3-git-send-email-mark.yao@rock-chips.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1421910333-5576-1-git-send-email-mark.yao@rock-chips.com> References: <1421910333-5576-1-git-send-email-mark.yao@rock-chips.com> Cc: Mark Yao X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 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.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 there is a Bug that: vop_enable()->drm_vblank_on, drm_vblank_on may call vop enable vblank. if it happen, vblank enable would failed, then cause irq status error. because is_enabled value is set after drm_vblank_on. after enable vop clocks and iommu regs, we can sure that R/W vop regs and do vop plane flip is safe, so place is_enabled = true after enable iommu is suitable. Signed-off-by: Mark Yao --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index f278c09..a009457 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -420,6 +420,11 @@ static void vop_enable(struct drm_crtc *crtc) goto err_disable_aclk; } + /* + * At here, vop clock & iommu is enable, R/W vop regs would be safe. + */ + vop->is_enabled = false; + spin_lock(&vop->reg_lock); VOP_CTRL_SET(vop, standby, 0); @@ -430,8 +435,6 @@ static void vop_enable(struct drm_crtc *crtc) drm_vblank_on(vop->drm_dev, vop->pipe); - vop->is_enabled = false; - return; err_disable_aclk: @@ -462,6 +465,8 @@ static void vop_disable(struct drm_crtc *crtc) VOP_CTRL_SET(vop, standby, 1); spin_unlock(&vop->reg_lock); + + vop->is_enabled = false; /* * disable dclk to stop frame scan, so we can safely detach iommu, */ @@ -471,8 +476,6 @@ static void vop_disable(struct drm_crtc *crtc) clk_disable(vop->aclk); clk_disable(vop->hclk); - - vop->is_enabled = false; } /*