From patchwork Thu Jul 13 14:41:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 9838787 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AB1C3603F3 for ; Thu, 13 Jul 2017 14:42:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A76628630 for ; Thu, 13 Jul 2017 14:42:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8DD4A28738; Thu, 13 Jul 2017 14:42:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4EF0E28630 for ; Thu, 13 Jul 2017 14:42:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=+zc26WOa4tkx140hHZjM6i/2Q72Lujhmf3mdYh2U0cs=; b=W2KiAHRv+kZrBHVv1EDTwS9aEh 2bsyV3TM4mP8CwYmsYHZtBzpf9XOPu1epxn+h6y8tx59HuuuLNgr4qerrpFfgJe6jRO/hT97lFwgK hULWcAnND2l1+Ibs0Tg+q2iF6qOZW7brRcanBH4qlwj1iISewSukqjbQAQAs29Mmw1iY+3u3mnRg0 g8HveyQ/8wIMxF5/m7y6tySV6ab9KutNsnS1nAz7kqTUkATn1oSECyTOgUvfOX33hCJq1jfX7ks6U ua7W57yDMlqVqUtx3FRyOBGzreqQxAYey6fXyg0X+0yfZz3eik7dT2a5T1pKGFMeF8vvMvkfj8gn4 JV2ZqAyA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dVfKS-0005rs-CY; Thu, 13 Jul 2017 14:42:56 +0000 Received: from mail.free-electrons.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dVfJE-0004eH-A2; Thu, 13 Jul 2017 14:41:44 +0000 Received: by mail.free-electrons.com (Postfix, from userid 110) id C6AB821FC2; Thu, 13 Jul 2017 16:41:18 +0200 (CEST) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 9ED26207CD; Thu, 13 Jul 2017 16:41:18 +0200 (CEST) From: Maxime Ripard To: Daniel Vetter , David Airlie , Jani Nikula , Sean Paul , Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Kukjin Kim , Krzysztof Kozlowski , Laurent Pinchart , Mark Yao , Heiko Stuebner , Chen-Yu Tsai , Maxime Ripard Subject: [PATCH 3/4] drm/sun4i: engine: Add commit_poll function Date: Thu, 13 Jul 2017 16:41:15 +0200 Message-Id: X-Mailer: git-send-email 2.13.0 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170713_074140_735675_5E1077D5 X-CRM114-Status: GOOD ( 12.48 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On the earlier Allwinner chips, with the first iteration of the display engine, the backend commit bit needs to be polled before making any register access to the backend. Add an operation for that, that will be called in atomic_begin in order to be sure to have that bit cleared before we do any modifications. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_crtc.c | 2 ++ drivers/gpu/drm/sun4i/sunxi_engine.h | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c b/drivers/gpu/drm/sun4i/sun4i_crtc.c index f8c70439d1e2..2eba1d8639d8 100644 --- a/drivers/gpu/drm/sun4i/sun4i_crtc.c +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c @@ -45,6 +45,8 @@ static void sun4i_crtc_atomic_begin(struct drm_crtc *crtc, spin_unlock_irqrestore(&dev->event_lock, flags); crtc->state->event = NULL; } + + WARN_ON(sunxi_engine_commit_poll(engine)); } static void sun4i_crtc_atomic_flush(struct drm_crtc *crtc, diff --git a/drivers/gpu/drm/sun4i/sunxi_engine.h b/drivers/gpu/drm/sun4i/sunxi_engine.h index 4cb70ae65c79..6618e182613c 100644 --- a/drivers/gpu/drm/sun4i/sunxi_engine.h +++ b/drivers/gpu/drm/sun4i/sunxi_engine.h @@ -17,6 +17,7 @@ struct sunxi_engine; struct sunxi_engine_ops { void (*commit)(struct sunxi_engine *engine); + int (*commit_poll)(struct sunxi_engine *engine); struct drm_plane **(*layers_init)(struct drm_device *drm, struct sunxi_engine *engine); @@ -55,6 +56,19 @@ sunxi_engine_commit(struct sunxi_engine *engine) } /** + * sunxi_engine_commit_poll() - wait for all changes to be committed + * @engine: pointer to the engine + */ +static inline int +sunxi_engine_commit_poll(struct sunxi_engine *engine) +{ + if (engine->ops && engine->ops->commit_poll) + return engine->ops->commit_poll(engine); + + return 0; +} + +/** * sunxi_engine_layers_init() - Create planes (layers) for the engine * @drm: pointer to the drm_device for which planes will be created * @engine: pointer to the engine