aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/omapdrm/omap_crtc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/omapdrm/omap_crtc.c')
-rw-r--r--drivers/gpu/drm/omapdrm/omap_crtc.c42
1 files changed, 31 insertions, 11 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index 6e7a777907f5..39693dfe54af 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -419,12 +419,9 @@ static enum drm_mode_status omap_crtc_mode_valid(struct drm_crtc *crtc,
419static void omap_crtc_mode_set_nofb(struct drm_crtc *crtc) 419static void omap_crtc_mode_set_nofb(struct drm_crtc *crtc)
420{ 420{
421 struct omap_crtc *omap_crtc = to_omap_crtc(crtc); 421 struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
422 struct omap_dss_device *display = omap_crtc->pipe->display;
423 struct drm_display_mode *mode = &crtc->state->adjusted_mode; 422 struct drm_display_mode *mode = &crtc->state->adjusted_mode;
424 const u32 flags_mask = DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_DE_LOW | 423 struct videomode *vm = &omap_crtc->vm;
425 DISPLAY_FLAGS_PIXDATA_POSEDGE | DISPLAY_FLAGS_PIXDATA_NEGEDGE | 424 struct omap_dss_device *dssdev;
426 DISPLAY_FLAGS_SYNC_POSEDGE | DISPLAY_FLAGS_SYNC_NEGEDGE;
427 struct videomode vm = {0};
428 425
429 DBG("%s: set mode: %d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x", 426 DBG("%s: set mode: %d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x",
430 omap_crtc->name, mode->base.id, mode->name, 427 omap_crtc->name, mode->base.id, mode->name,
@@ -433,7 +430,7 @@ static void omap_crtc_mode_set_nofb(struct drm_crtc *crtc)
433 mode->vdisplay, mode->vsync_start, mode->vsync_end, mode->vtotal, 430 mode->vdisplay, mode->vsync_start, mode->vsync_end, mode->vtotal,
434 mode->type, mode->flags); 431 mode->type, mode->flags);
435 432
436 drm_display_mode_to_videomode(mode, &omap_crtc->vm); 433 drm_display_mode_to_videomode(mode, vm);
437 434
438 /* 435 /*
439 * HACK: This fixes the vm flags. 436 * HACK: This fixes the vm flags.
@@ -442,13 +439,36 @@ static void omap_crtc_mode_set_nofb(struct drm_crtc *crtc)
442 * struct drm_display_mode and struct videomode. The hack below 439 * struct drm_display_mode and struct videomode. The hack below
443 * goes and fetches the missing flags from the panel drivers. 440 * goes and fetches the missing flags from the panel drivers.
444 * 441 *
445 * Correct solution would be to use DRM's bus-flags, but that's not 442 * A better solution is to use DRM's bus-flags through the whole driver.
446 * easily possible before the omapdrm's panel/encoder driver model
447 * has been changed to the DRM model.
448 */ 443 */
449 444
450 display->ops->get_timings(display, &vm); 445 for (dssdev = omap_crtc->pipe->output; dssdev; dssdev = dssdev->next) {
451 omap_crtc->vm.flags |= vm.flags & flags_mask; 446 unsigned long bus_flags = dssdev->bus_flags;
447
448 if (!(vm->flags & (DISPLAY_FLAGS_DE_LOW |
449 DISPLAY_FLAGS_DE_HIGH))) {
450 if (bus_flags & DRM_BUS_FLAG_DE_LOW)
451 vm->flags |= DISPLAY_FLAGS_DE_LOW;
452 else if (bus_flags & DRM_BUS_FLAG_DE_HIGH)
453 vm->flags |= DISPLAY_FLAGS_DE_HIGH;
454 }
455
456 if (!(vm->flags & (DISPLAY_FLAGS_PIXDATA_POSEDGE |
457 DISPLAY_FLAGS_PIXDATA_NEGEDGE))) {
458 if (bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
459 vm->flags |= DISPLAY_FLAGS_PIXDATA_POSEDGE;
460 else if (bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
461 vm->flags |= DISPLAY_FLAGS_PIXDATA_NEGEDGE;
462 }
463
464 if (!(vm->flags & (DISPLAY_FLAGS_SYNC_POSEDGE |
465 DISPLAY_FLAGS_SYNC_NEGEDGE))) {
466 if (bus_flags & DRM_BUS_FLAG_SYNC_POSEDGE)
467 vm->flags |= DISPLAY_FLAGS_SYNC_POSEDGE;
468 else if (bus_flags & DRM_BUS_FLAG_SYNC_NEGEDGE)
469 vm->flags |= DISPLAY_FLAGS_SYNC_NEGEDGE;
470 }
471 }
452} 472}
453 473
454static int omap_crtc_atomic_check(struct drm_crtc *crtc, 474static int omap_crtc_atomic_check(struct drm_crtc *crtc,