]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/sun4i: Pass pointer for underlying backend into layer init
authorChen-Yu Tsai <wens@csie.org>
Thu, 9 Mar 2017 10:05:29 +0000 (18:05 +0800)
committerMaxime Ripard <maxime.ripard@free-electrons.com>
Thu, 9 Mar 2017 10:22:22 +0000 (11:22 +0100)
sun4i_layer only controls the backend hardware block of the display
pipeline.

Pass pointers to the underlying backend in the layer init function,
instead of trying to fetch it from the drm_device structure. This
avoids the headache of trying to figure out which device the layers
actually belong to.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
drivers/gpu/drm/sun4i/sun4i_crtc.c
drivers/gpu/drm/sun4i/sun4i_layer.c
drivers/gpu/drm/sun4i/sun4i_layer.h

index 221e6d5ee9705a8e021504ff8b296400b47dbe3a..3c876c3a356a635aeef947e99f3d9f89aad6cbea 100644 (file)
@@ -149,7 +149,7 @@ struct sun4i_crtc *sun4i_crtc_init(struct drm_device *drm,
        scrtc->tcon = tcon;
 
        /* Create our layers */
-       scrtc->layers = sun4i_layers_init(drm);
+       scrtc->layers = sun4i_layers_init(drm, scrtc->backend);
        if (IS_ERR(scrtc->layers)) {
                dev_err(drm->dev, "Couldn't create the planes\n");
                return NULL;
index 6feaf85a5942ff9ee6624fec881763a8eeb329d7..f26bde5b9117cabaa6d0cf08af9471cee80f45e8 100644 (file)
@@ -16,7 +16,6 @@
 #include <drm/drmP.h>
 
 #include "sun4i_backend.h"
-#include "sun4i_drv.h"
 #include "sun4i_layer.h"
 
 struct sun4i_plane_desc {
@@ -102,9 +101,9 @@ static const struct sun4i_plane_desc sun4i_backend_planes[] = {
 };
 
 static struct sun4i_layer *sun4i_layer_init_one(struct drm_device *drm,
+                                               struct sun4i_backend *backend,
                                                const struct sun4i_plane_desc *plane)
 {
-       struct sun4i_drv *drv = drm->dev_private;
        struct sun4i_layer *layer;
        int ret;
 
@@ -124,14 +123,14 @@ static struct sun4i_layer *sun4i_layer_init_one(struct drm_device *drm,
 
        drm_plane_helper_add(&layer->plane,
                             &sun4i_backend_layer_helper_funcs);
-       layer->backend = drv->backend;
+       layer->backend = backend;
 
        return layer;
 }
 
-struct sun4i_layer **sun4i_layers_init(struct drm_device *drm)
+struct sun4i_layer **sun4i_layers_init(struct drm_device *drm,
+                                      struct sun4i_backend *backend)
 {
-       struct sun4i_drv *drv = drm->dev_private;
        struct sun4i_layer **layers;
        int i;
 
@@ -165,7 +164,7 @@ struct sun4i_layer **sun4i_layers_init(struct drm_device *drm)
                const struct sun4i_plane_desc *plane = &sun4i_backend_planes[i];
                struct sun4i_layer *layer;
 
-               layer = sun4i_layer_init_one(drm, plane);
+               layer = sun4i_layer_init_one(drm, backend, plane);
                if (IS_ERR(layer)) {
                        dev_err(drm->dev, "Couldn't initialize %s plane\n",
                                i ? "overlay" : "primary");
@@ -174,7 +173,7 @@ struct sun4i_layer **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(drv->backend->regs, SUN4I_BACKEND_ATTCTL_REG0(i),
+               regmap_update_bits(backend->regs, SUN4I_BACKEND_ATTCTL_REG0(i),
                                   SUN4I_BACKEND_ATTCTL_REG0_LAY_PIPESEL_MASK,
                                   SUN4I_BACKEND_ATTCTL_REG0_LAY_PIPESEL(plane->pipe));
 
index a97e376bae17206a7c177ac43ed6419adb1f3cae..4be1f0919df22cd5b6478f2f2f24ef1324ba3048 100644 (file)
@@ -26,6 +26,7 @@ plane_to_sun4i_layer(struct drm_plane *plane)
        return container_of(plane, struct sun4i_layer, plane);
 }
 
-struct sun4i_layer **sun4i_layers_init(struct drm_device *drm);
+struct sun4i_layer **sun4i_layers_init(struct drm_device *drm,
+                                      struct sun4i_backend *backend);
 
 #endif /* _SUN4I_LAYER_H_ */