Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754285AbeAIKM7 (ORCPT + 1 other); Tue, 9 Jan 2018 05:12:59 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:48451 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752727AbeAIKJu (ORCPT ); Tue, 9 Jan 2018 05:09:50 -0500 From: Maxime Ripard To: Daniel Vetter , David Airlie , Chen-Yu Tsai , Maxime Ripard Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Thomas Petazzoni , narmstrong@baylibre.com, thomas@vitsch.nl Subject: [PATCH v3 06/13] drm/sun4i: engine: Add a VBLANK quirk callback Date: Tue, 9 Jan 2018 11:09:19 +0100 Message-Id: <7c298d43aa1500196aa5d15d7a7c0f228c7a6f3c.1515492513.git-series.maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: In some cases, the display engine needs to apply some quirks during the VBLANK event. In the Display Engine 1.0 case for example, we can only disable the frontend once the backend has been, which is at VBLANK. Let's introduce a callback that can be implemented by the various engines. Reviewed-by: Chen-Yu Tsai Signed-off-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 4 ++++ drivers/gpu/drm/sun4i/sunxi_engine.h | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index e122f5b2a395..55f54b54293c 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -368,6 +368,7 @@ static irqreturn_t sun4i_tcon_handler(int irq, void *private) struct sun4i_tcon *tcon = private; struct drm_device *drm = tcon->drm; struct sun4i_crtc *scrtc = tcon->crtc; + struct sunxi_engine *engine = scrtc->engine; unsigned int status; regmap_read(tcon->regs, SUN4I_TCON_GINT0_REG, &status); @@ -385,6 +386,9 @@ static irqreturn_t sun4i_tcon_handler(int irq, void *private) SUN4I_TCON_GINT0_VBLANK_INT(1), 0); + if (engine->ops->vblank_quirk) + engine->ops->vblank_quirk(engine); + return IRQ_HANDLED; } diff --git a/drivers/gpu/drm/sun4i/sunxi_engine.h b/drivers/gpu/drm/sun4i/sunxi_engine.h index b819d4f9f02f..54c029877531 100644 --- a/drivers/gpu/drm/sun4i/sunxi_engine.h +++ b/drivers/gpu/drm/sun4i/sunxi_engine.h @@ -85,6 +85,19 @@ struct sunxi_engine_ops { * This function is optional. */ void (*disable_color_correction)(struct sunxi_engine *engine); + + /** + * @vblank_quirk: + * + * This callback is used to implement engine-specific + * behaviour part of the VBLANK event. It is run with all the + * constraints of an interrupt (can't sleep, all local + * interrupts disabled) and therefore should be as fast as + * possible. + * + * This function is optional. + */ + void (*vblank_quirk)(struct sunxi_engine *engine); }; /** -- git-series 0.9.1