drm/sun4i: engine: Add a VBLANK quirk callback
authorMaxime Ripard <maxime.ripard@free-electrons.com>
Mon, 22 Jan 2018 09:25:20 +0000 (10:25 +0100)
committerMaxime Ripard <maxime.ripard@free-electrons.com>
Mon, 22 Jan 2018 14:15:11 +0000 (15:15 +0100)
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 <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/7c298d43aa1500196aa5d15d7a7c0f228c7a6f3c.1516613040.git-series.maxime.ripard@free-electrons.com
drivers/gpu/drm/sun4i/sun4i_tcon.c
drivers/gpu/drm/sun4i/sunxi_engine.h

index b78fed809992cac3a94e4db43c5f7bf7afa166e4..a65155dbdcbf1c06fd5d4925cc8de8d88c855884 100644 (file)
@@ -540,6 +540,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);
@@ -557,6 +558,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;
 }
 
index b819d4f9f02f55351d6974474b715a9bb0b96870..54c0298775313bd6d73e04d0359df48b9aed03f1 100644 (file)
@@ -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);
 };
 
 /**