summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/omapdrm/omap_plane.c
diff options
context:
space:
mode:
authorJyri Sarha <jsarha@ti.com>2017-03-24 17:47:55 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2017-04-03 12:36:40 +0300
commite8e13b1521678af0df7b07f30745d77e8de1820a (patch)
tree5b43e024c00391db18f83e6285b2b280953df39b /drivers/gpu/drm/omapdrm/omap_plane.c
parent694c99cf6f5a13774bbdbf5becdbf59451b955f0 (diff)
downloadlinux-e8e13b1521678af0df7b07f30745d77e8de1820a.tar.xz
drm/omap: Major omap_modeset_init() cleanup
Cleanup overly complex omap_modeset_init(). The function is trying to support many unusual configuration, that have never been tested and are not supported by other parts of the dirver. After cleanup the init function creates exactly one connector, encoder, crtc, and primary plane per each connected dss-device. Each connector->encoder->crtc chain is expected to be separate and each crtc is connect to a single dss-channel. If the configuration does not match the expectations or exceeds the available resources, the configuration is rejected. Signed-off-by: Jyri Sarha <jsarha@ti.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/gpu/drm/omapdrm/omap_plane.c')
-rw-r--r--drivers/gpu/drm/omapdrm/omap_plane.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
index 7abb49b7d606..9168154d749e 100644
--- a/drivers/gpu/drm/omapdrm/omap_plane.c
+++ b/drivers/gpu/drm/omapdrm/omap_plane.c
@@ -324,24 +324,37 @@ static const struct drm_plane_funcs omap_plane_funcs = {
.atomic_get_property = omap_plane_atomic_get_property,
};
-static const char *plane_names[] = {
+static const char *plane_id_to_name[] = {
[OMAP_DSS_GFX] = "gfx",
[OMAP_DSS_VIDEO1] = "vid1",
[OMAP_DSS_VIDEO2] = "vid2",
[OMAP_DSS_VIDEO3] = "vid3",
};
+static const enum omap_plane_id plane_idx_to_id[] = {
+ OMAP_DSS_GFX,
+ OMAP_DSS_VIDEO1,
+ OMAP_DSS_VIDEO2,
+ OMAP_DSS_VIDEO3,
+};
+
/* initialize plane */
struct drm_plane *omap_plane_init(struct drm_device *dev,
- int id, enum drm_plane_type type,
+ int idx, enum drm_plane_type type,
u32 possible_crtcs)
{
struct omap_drm_private *priv = dev->dev_private;
struct drm_plane *plane;
struct omap_plane *omap_plane;
+ enum omap_plane_id id;
int ret;
- DBG("%s: type=%d", plane_names[id], type);
+ if (WARN_ON(idx >= ARRAY_SIZE(plane_idx_to_id)))
+ return ERR_PTR(-EINVAL);
+
+ id = plane_idx_to_id[idx];
+
+ DBG("%s: type=%d", plane_id_to_name[id], type);
omap_plane = kzalloc(sizeof(*omap_plane), GFP_KERNEL);
if (!omap_plane)
@@ -351,7 +364,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
omap_plane->formats, ARRAY_SIZE(omap_plane->formats),
priv->dispc_ops->ovl_get_color_modes(id));
omap_plane->id = id;
- omap_plane->name = plane_names[id];
+ omap_plane->name = plane_id_to_name[id];
plane = &omap_plane->base;
@@ -368,6 +381,9 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
return plane;
error:
+ dev_err(dev->dev, "%s(): could not create plane: %s\n",
+ __func__, plane_id_to_name[id]);
+
kfree(omap_plane);
return NULL;
}