aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen-Yu Tsai <wens@csie.org>2017-03-09 05:05:29 -0500
committerMaxime Ripard <maxime.ripard@free-electrons.com>2017-03-09 05:22:22 -0500
commita0a68fb6872f545acd49035ea17c52a9f30d07dc (patch)
treeaf23b9693e15d186fc1c9608053c75d4987b0e29
parent18c3b300837b864e875d23f22eef5b7acefeccf1 (diff)
drm/sun4i: Pass pointer for underlying backend into layer init
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>
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_crtc.c2
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_layer.c13
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_layer.h3
3 files changed, 9 insertions, 9 deletions
diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c b/drivers/gpu/drm/sun4i/sun4i_crtc.c
index 221e6d5ee970..3c876c3a356a 100644
--- a/drivers/gpu/drm/sun4i/sun4i_crtc.c
+++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c
@@ -149,7 +149,7 @@ struct sun4i_crtc *sun4i_crtc_init(struct drm_device *drm,
149 scrtc->tcon = tcon; 149 scrtc->tcon = tcon;
150 150
151 /* Create our layers */ 151 /* Create our layers */
152 scrtc->layers = sun4i_layers_init(drm); 152 scrtc->layers = sun4i_layers_init(drm, scrtc->backend);
153 if (IS_ERR(scrtc->layers)) { 153 if (IS_ERR(scrtc->layers)) {
154 dev_err(drm->dev, "Couldn't create the planes\n"); 154 dev_err(drm->dev, "Couldn't create the planes\n");
155 return NULL; 155 return NULL;
diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.c b/drivers/gpu/drm/sun4i/sun4i_layer.c
index 6feaf85a5942..f26bde5b9117 100644
--- a/drivers/gpu/drm/sun4i/sun4i_layer.c
+++ b/drivers/gpu/drm/sun4i/sun4i_layer.c
@@ -16,7 +16,6 @@
16#include <drm/drmP.h> 16#include <drm/drmP.h>
17 17
18#include "sun4i_backend.h" 18#include "sun4i_backend.h"
19#include "sun4i_drv.h"
20#include "sun4i_layer.h" 19#include "sun4i_layer.h"
21 20
22struct sun4i_plane_desc { 21struct sun4i_plane_desc {
@@ -102,9 +101,9 @@ static const struct sun4i_plane_desc sun4i_backend_planes[] = {
102}; 101};
103 102
104static struct sun4i_layer *sun4i_layer_init_one(struct drm_device *drm, 103static struct sun4i_layer *sun4i_layer_init_one(struct drm_device *drm,
104 struct sun4i_backend *backend,
105 const struct sun4i_plane_desc *plane) 105 const struct sun4i_plane_desc *plane)
106{ 106{
107 struct sun4i_drv *drv = drm->dev_private;
108 struct sun4i_layer *layer; 107 struct sun4i_layer *layer;
109 int ret; 108 int ret;
110 109
@@ -124,14 +123,14 @@ static struct sun4i_layer *sun4i_layer_init_one(struct drm_device *drm,
124 123
125 drm_plane_helper_add(&layer->plane, 124 drm_plane_helper_add(&layer->plane,
126 &sun4i_backend_layer_helper_funcs); 125 &sun4i_backend_layer_helper_funcs);
127 layer->backend = drv->backend; 126 layer->backend = backend;
128 127
129 return layer; 128 return layer;
130} 129}
131 130
132struct sun4i_layer **sun4i_layers_init(struct drm_device *drm) 131struct sun4i_layer **sun4i_layers_init(struct drm_device *drm,
132 struct sun4i_backend *backend)
133{ 133{
134 struct sun4i_drv *drv = drm->dev_private;
135 struct sun4i_layer **layers; 134 struct sun4i_layer **layers;
136 int i; 135 int i;
137 136
@@ -165,7 +164,7 @@ struct sun4i_layer **sun4i_layers_init(struct drm_device *drm)
165 const struct sun4i_plane_desc *plane = &sun4i_backend_planes[i]; 164 const struct sun4i_plane_desc *plane = &sun4i_backend_planes[i];
166 struct sun4i_layer *layer; 165 struct sun4i_layer *layer;
167 166
168 layer = sun4i_layer_init_one(drm, plane); 167 layer = sun4i_layer_init_one(drm, backend, plane);
169 if (IS_ERR(layer)) { 168 if (IS_ERR(layer)) {
170 dev_err(drm->dev, "Couldn't initialize %s plane\n", 169 dev_err(drm->dev, "Couldn't initialize %s plane\n",
171 i ? "overlay" : "primary"); 170 i ? "overlay" : "primary");
@@ -174,7 +173,7 @@ struct sun4i_layer **sun4i_layers_init(struct drm_device *drm)
174 173
175 DRM_DEBUG_DRIVER("Assigning %s plane to pipe %d\n", 174 DRM_DEBUG_DRIVER("Assigning %s plane to pipe %d\n",
176 i ? "overlay" : "primary", plane->pipe); 175 i ? "overlay" : "primary", plane->pipe);
177 regmap_update_bits(drv->backend->regs, SUN4I_BACKEND_ATTCTL_REG0(i), 176 regmap_update_bits(backend->regs, SUN4I_BACKEND_ATTCTL_REG0(i),
178 SUN4I_BACKEND_ATTCTL_REG0_LAY_PIPESEL_MASK, 177 SUN4I_BACKEND_ATTCTL_REG0_LAY_PIPESEL_MASK,
179 SUN4I_BACKEND_ATTCTL_REG0_LAY_PIPESEL(plane->pipe)); 178 SUN4I_BACKEND_ATTCTL_REG0_LAY_PIPESEL(plane->pipe));
180 179
diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.h b/drivers/gpu/drm/sun4i/sun4i_layer.h
index a97e376bae17..4be1f0919df2 100644
--- a/drivers/gpu/drm/sun4i/sun4i_layer.h
+++ b/drivers/gpu/drm/sun4i/sun4i_layer.h
@@ -26,6 +26,7 @@ plane_to_sun4i_layer(struct drm_plane *plane)
26 return container_of(plane, struct sun4i_layer, plane); 26 return container_of(plane, struct sun4i_layer, plane);
27} 27}
28 28
29struct sun4i_layer **sun4i_layers_init(struct drm_device *drm); 29struct sun4i_layer **sun4i_layers_init(struct drm_device *drm,
30 struct sun4i_backend *backend);
30 31
31#endif /* _SUN4I_LAYER_H_ */ 32#endif /* _SUN4I_LAYER_H_ */