drm/omap: venc: Fixup video mode in .check_timings() operation

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>
This commit is contained in:
Laurent Pinchart 2018-06-08 15:59:31 +03:00 committed by Tomi Valkeinen
parent 96fc64c775
commit a730ce996c
1 changed files with 9 additions and 16 deletions

View 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:
case VENC_MODE_NTSC:
*vm = omap_dss_pal_vm;
return 0;
case VENC_MODE_NTSC:
*vm = omap_dss_ntsc_vm;
return 0;
default:
return -EINVAL;
}