drm/omap: venc: Fixup video mode in .check_timings() operation
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Fri, 8 Jun 2018 12:59:31 +0000 (15:59 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 3 Sep 2018 13:13:30 +0000 (16:13 +0300)
The VENC encoder modifies the requested video mode to match the NTSC or
PAL timings (or reject the video mode completely) in the .set_timings()
operation. This should be performed in the .check_timings() operation
instead. Move the fixup.

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

index 09ec8b0..126efbf 100644 (file)
@@ -452,7 +452,7 @@ static void venc_runtime_put(struct venc_device *venc)
        WARN_ON(r < 0 && r != -ENOSYS);
 }
 
-static const struct venc_config *venc_timings_to_config(struct videomode *vm)
+static const struct venc_config *venc_timings_to_config(const struct videomode *vm)
 {
        switch (venc_get_videomode(vm)) {
        default:
@@ -582,28 +582,16 @@ static void venc_set_timings(struct omap_dss_device *dssdev,
                             const struct videomode *vm)
 {
        struct venc_device *venc = dssdev_to_venc(dssdev);
-       struct videomode actual_vm;
 
        DSSDBG("venc_set_timings\n");
 
        mutex_lock(&venc->venc_lock);
 
-       switch (venc_get_videomode(vm)) {
-       default:
-               WARN_ON_ONCE(1);
-       case VENC_MODE_PAL:
-               actual_vm = omap_dss_pal_vm;
-               break;
-       case VENC_MODE_NTSC:
-               actual_vm = omap_dss_ntsc_vm;
-               break;
-       }
-
        /* Reset WSS data when the TV standard changes. */
-       if (memcmp(&venc->vm, &actual_vm, sizeof(actual_vm)))
+       if (memcmp(&venc->vm, vm, sizeof(*vm)))
                venc->wss_data = 0;
 
-       venc->vm = actual_vm;
+       venc->vm = *vm;
 
        dispc_set_tv_pclk(venc->dss->dispc, 13500000);
 
@@ -617,8 +605,13 @@ static int venc_check_timings(struct omap_dss_device *dssdev,
 
        switch (venc_get_videomode(vm)) {
        case VENC_MODE_PAL:
+               *vm = omap_dss_pal_vm;
+               return 0;
+
        case VENC_MODE_NTSC:
+               *vm = omap_dss_ntsc_vm;
                return 0;
+
        default:
                return -EINVAL;
        }