drm/omap: venc: List both PAL and NTSC modes
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Wed, 12 Sep 2018 21:39:01 +0000 (00:39 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 18 Mar 2019 09:42:12 +0000 (11:42 +0200)
The TV encoder supports both PAL and NTSC modes, but when queried for
the list of modes it supports, only the currently selected mode is
reported. Fix it and report the two modes unconditionally.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Tested-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/gpu/drm/omapdrm/dss/venc.c

index f1abb4195a76aa7d066b986c55780b249c124128..638cfd69ccf6f2b3d5490a7aa5e2c2f9eabdf422 100644 (file)
@@ -551,14 +551,27 @@ static void venc_display_disable(struct omap_dss_device *dssdev)
 static int venc_get_modes(struct omap_dss_device *dssdev,
                          struct drm_connector *connector)
 {
-       struct venc_device *venc = dssdev_to_venc(dssdev);
-       int r;
+       static const struct videomode *modes[] = {
+               &omap_dss_pal_vm,
+               &omap_dss_ntsc_vm,
+       };
+       unsigned int i;
 
-       mutex_lock(&venc->venc_lock);
-       r = omapdss_display_get_modes(connector, &venc->vm);
-       mutex_unlock(&venc->venc_lock);
+       for (i = 0; i < ARRAY_SIZE(modes); ++i) {
+               struct drm_display_mode *mode;
 
-       return r;
+               mode = drm_mode_create(connector->dev);
+               if (!mode)
+                       return i;
+
+               drm_display_mode_from_videomode(modes[i], mode);
+
+               mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
+               drm_mode_set_name(mode);
+               drm_mode_probed_add(connector, mode);
+       }
+
+       return ARRAY_SIZE(modes);
 }
 
 static void venc_set_timings(struct omap_dss_device *dssdev,