summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/sun4i/sun4i_layer.c
diff options
context:
space:
mode:
authorIcenowy Zheng <icenowy@aosc.io>2017-05-17 17:47:17 +0300
committerMaxime Ripard <maxime.ripard@free-electrons.com>2017-06-01 10:47:23 +0300
commit87969338436710638076d8083dda8b0de703f4a5 (patch)
tree9157bb21d79e5a8297a3964f84d41c8b5a9bc82e /drivers/gpu/drm/sun4i/sun4i_layer.c
parent7921e1477a5327ff22cc38a0ec74ace5d26dbba9 (diff)
downloadlinux-87969338436710638076d8083dda8b0de703f4a5.tar.xz
drm/sun4i: abstract a engine type
As we are going to add support for the Allwinner DE2 engine in sun4i-drm driver, we will finally have two types of display engines -- the DE1 backend and the DE2 mixer. They both do some display blending and feed graphics data to TCON, and is part of the "Display Engine" called by Allwinner, so I choose to call them both "engine" here. Abstract the engine type to a new struct with an ops struct, which contains functions that should be called outside the engine-specified code (in TCON, CRTC or TV Encoder code). In order to preserve bisectability, we also switch the backend and layer code in its own module. Signed-off-by: Icenowy Zheng <icenowy@aosc.io> Reviewed-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Diffstat (limited to 'drivers/gpu/drm/sun4i/sun4i_layer.c')
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_layer.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.c b/drivers/gpu/drm/sun4i/sun4i_layer.c
index e1f03e1cc0ac..ead4f9d4c1ee 100644
--- a/drivers/gpu/drm/sun4i/sun4i_layer.c
+++ b/drivers/gpu/drm/sun4i/sun4i_layer.c
@@ -11,13 +11,12 @@
*/
#include <drm/drm_atomic_helper.h>
-#include <drm/drm_crtc.h>
#include <drm/drm_plane_helper.h>
#include <drm/drmP.h>
#include "sun4i_backend.h"
-#include "sun4i_crtc.h"
#include "sun4i_layer.h"
+#include "sunxi_engine.h"
struct sun4i_plane_desc {
enum drm_plane_type type;
@@ -130,10 +129,10 @@ static struct sun4i_layer *sun4i_layer_init_one(struct drm_device *drm,
}
struct drm_plane **sun4i_layers_init(struct drm_device *drm,
- struct sun4i_crtc *crtc)
+ struct sunxi_engine *engine)
{
struct drm_plane **planes;
- struct sun4i_backend *backend = crtc->backend;
+ struct sun4i_backend *backend = engine_to_sun4i_backend(engine);
int i;
planes = devm_kcalloc(drm->dev, ARRAY_SIZE(sun4i_backend_planes) + 1,
@@ -175,7 +174,7 @@ struct drm_plane **sun4i_layers_init(struct drm_device *drm,
DRM_DEBUG_DRIVER("Assigning %s plane to pipe %d\n",
i ? "overlay" : "primary", plane->pipe);
- regmap_update_bits(backend->regs, SUN4I_BACKEND_ATTCTL_REG0(i),
+ regmap_update_bits(engine->regs, SUN4I_BACKEND_ATTCTL_REG0(i),
SUN4I_BACKEND_ATTCTL_REG0_LAY_PIPESEL_MASK,
SUN4I_BACKEND_ATTCTL_REG0_LAY_PIPESEL(plane->pipe));