drm/omap: Move bus flag hack to encoder implementation
The bus flags stored in omap_dss_device instances are used to fixup the video mode before setting it, to honour constraints that can't be expressed through drm_display_mode. The fixup occurs in the CRTC mode set operation and the resulting video mode is stored internally in the CRTC. It is then used next by omap_encoder_enable() to apply mode fixups for the omap_dss_device instances in omap_encoder_update(). Move the hack to the omap_encoder_update() function right before applying the omap_dss_device fixups, in order to group all fixups together. 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:
parent
31cd7afa30
commit
8e9c1c6676
|
@ -420,8 +420,6 @@ static void omap_crtc_mode_set_nofb(struct drm_crtc *crtc)
|
||||||
{
|
{
|
||||||
struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
|
struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
|
||||||
struct drm_display_mode *mode = &crtc->state->adjusted_mode;
|
struct drm_display_mode *mode = &crtc->state->adjusted_mode;
|
||||||
struct videomode *vm = &omap_crtc->vm;
|
|
||||||
struct omap_dss_device *dssdev;
|
|
||||||
|
|
||||||
DBG("%s: set mode: %d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x",
|
DBG("%s: set mode: %d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x",
|
||||||
omap_crtc->name, mode->base.id, mode->name,
|
omap_crtc->name, mode->base.id, mode->name,
|
||||||
|
@ -430,45 +428,7 @@ static void omap_crtc_mode_set_nofb(struct drm_crtc *crtc)
|
||||||
mode->vdisplay, mode->vsync_start, mode->vsync_end, mode->vtotal,
|
mode->vdisplay, mode->vsync_start, mode->vsync_end, mode->vtotal,
|
||||||
mode->type, mode->flags);
|
mode->type, mode->flags);
|
||||||
|
|
||||||
drm_display_mode_to_videomode(mode, vm);
|
drm_display_mode_to_videomode(mode, &omap_crtc->vm);
|
||||||
|
|
||||||
/*
|
|
||||||
* HACK: This fixes the vm flags.
|
|
||||||
* struct drm_display_mode does not contain the VSYNC/HSYNC/DE flags
|
|
||||||
* and they get lost when converting back and forth between
|
|
||||||
* struct drm_display_mode and struct videomode. The hack below
|
|
||||||
* goes and fetches the missing flags from the panel drivers.
|
|
||||||
*
|
|
||||||
* A better solution is to use DRM's bus-flags through the whole driver.
|
|
||||||
*/
|
|
||||||
|
|
||||||
for (dssdev = omap_crtc->pipe->output; dssdev; dssdev = dssdev->next) {
|
|
||||||
unsigned long bus_flags = dssdev->bus_flags;
|
|
||||||
|
|
||||||
if (!(vm->flags & (DISPLAY_FLAGS_DE_LOW |
|
|
||||||
DISPLAY_FLAGS_DE_HIGH))) {
|
|
||||||
if (bus_flags & DRM_BUS_FLAG_DE_LOW)
|
|
||||||
vm->flags |= DISPLAY_FLAGS_DE_LOW;
|
|
||||||
else if (bus_flags & DRM_BUS_FLAG_DE_HIGH)
|
|
||||||
vm->flags |= DISPLAY_FLAGS_DE_HIGH;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(vm->flags & (DISPLAY_FLAGS_PIXDATA_POSEDGE |
|
|
||||||
DISPLAY_FLAGS_PIXDATA_NEGEDGE))) {
|
|
||||||
if (bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
|
|
||||||
vm->flags |= DISPLAY_FLAGS_PIXDATA_POSEDGE;
|
|
||||||
else if (bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
|
|
||||||
vm->flags |= DISPLAY_FLAGS_PIXDATA_NEGEDGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(vm->flags & (DISPLAY_FLAGS_SYNC_POSEDGE |
|
|
||||||
DISPLAY_FLAGS_SYNC_NEGEDGE))) {
|
|
||||||
if (bus_flags & DRM_BUS_FLAG_SYNC_POSEDGE)
|
|
||||||
vm->flags |= DISPLAY_FLAGS_SYNC_POSEDGE;
|
|
||||||
else if (bus_flags & DRM_BUS_FLAG_SYNC_NEGEDGE)
|
|
||||||
vm->flags |= DISPLAY_FLAGS_SYNC_NEGEDGE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int omap_crtc_atomic_check(struct drm_crtc *crtc,
|
static int omap_crtc_atomic_check(struct drm_crtc *crtc,
|
||||||
|
|
|
@ -103,13 +103,49 @@ static int omap_encoder_update(struct drm_encoder *encoder,
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
for (dssdev = omap_encoder->output; dssdev; dssdev = dssdev->next) {
|
for (dssdev = omap_encoder->output; dssdev; dssdev = dssdev->next) {
|
||||||
if (!dssdev->ops->check_timings)
|
unsigned long bus_flags = dssdev->bus_flags;
|
||||||
continue;
|
|
||||||
|
|
||||||
ret = dssdev->ops->check_timings(dssdev, vm);
|
if (dssdev->ops->check_timings) {
|
||||||
if (ret) {
|
ret = dssdev->ops->check_timings(dssdev, vm);
|
||||||
dev_err(dev->dev, "invalid timings: %d\n", ret);
|
if (ret) {
|
||||||
return ret;
|
dev_err(dev->dev, "invalid timings: %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* HACK: This fixes the vm flags.
|
||||||
|
* struct drm_display_mode does not contain the VSYNC/HSYNC/DE
|
||||||
|
* flags and they get lost when converting back and forth
|
||||||
|
* between struct drm_display_mode and struct videomode. The
|
||||||
|
* hack below goes and fetches the missing flags.
|
||||||
|
*
|
||||||
|
* A better solution is to use DRM's bus-flags through the whole
|
||||||
|
* driver.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!(vm->flags & (DISPLAY_FLAGS_DE_LOW |
|
||||||
|
DISPLAY_FLAGS_DE_HIGH))) {
|
||||||
|
if (bus_flags & DRM_BUS_FLAG_DE_LOW)
|
||||||
|
vm->flags |= DISPLAY_FLAGS_DE_LOW;
|
||||||
|
else if (bus_flags & DRM_BUS_FLAG_DE_HIGH)
|
||||||
|
vm->flags |= DISPLAY_FLAGS_DE_HIGH;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(vm->flags & (DISPLAY_FLAGS_PIXDATA_POSEDGE |
|
||||||
|
DISPLAY_FLAGS_PIXDATA_NEGEDGE))) {
|
||||||
|
if (bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
|
||||||
|
vm->flags |= DISPLAY_FLAGS_PIXDATA_POSEDGE;
|
||||||
|
else if (bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
|
||||||
|
vm->flags |= DISPLAY_FLAGS_PIXDATA_NEGEDGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(vm->flags & (DISPLAY_FLAGS_SYNC_POSEDGE |
|
||||||
|
DISPLAY_FLAGS_SYNC_NEGEDGE))) {
|
||||||
|
if (bus_flags & DRM_BUS_FLAG_SYNC_POSEDGE)
|
||||||
|
vm->flags |= DISPLAY_FLAGS_SYNC_POSEDGE;
|
||||||
|
else if (bus_flags & DRM_BUS_FLAG_SYNC_NEGEDGE)
|
||||||
|
vm->flags |= DISPLAY_FLAGS_SYNC_NEGEDGE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue