diff options
Diffstat (limited to 'drivers/gpu/drm/omapdrm/omap_plane.c')
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_plane.c | 24 |
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; } |