Skip to content

Commit e99168f

Browse files
Marek VasutPhilippe Cornu
authored andcommitted
drm/stm: Remove usage of drm_display_mode_to_videomode()
There is not much value in the extra conversion step, the calculations required for the LTDC IP are different than what is used in the drm_display_mode_to_videomode(), so just do the right ones in the LTDC driver right away. Signed-off-by: Marek Vasut <[email protected]> Cc: Alexandre Torgue <[email protected]> Cc: Antonio Borneo <[email protected]> Cc: Benjamin Gaignard <[email protected]> Cc: Maxime Coquelin <[email protected]> Cc: Philippe Cornu <[email protected]> Cc: Sam Ravnborg <[email protected]> Cc: Vincent Abriou <[email protected]> Cc: Yannick Fertre <[email protected]> Cc: [email protected] Cc: [email protected] To: [email protected] Tested-by: Yannick Fertré <[email protected]> Signed-off-by: Philippe Cornu <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 96b7182 commit e99168f

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

drivers/gpu/drm/stm/ltdc.c

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,6 @@ static void ltdc_crtc_mode_set_nofb(struct drm_crtc *crtc)
531531
struct drm_encoder *encoder = NULL;
532532
struct drm_bridge *bridge = NULL;
533533
struct drm_display_mode *mode = &crtc->state->adjusted_mode;
534-
struct videomode vm;
535534
u32 hsync, vsync, accum_hbp, accum_vbp, accum_act_w, accum_act_h;
536535
u32 total_width, total_height;
537536
u32 bus_flags = 0;
@@ -570,31 +569,33 @@ static void ltdc_crtc_mode_set_nofb(struct drm_crtc *crtc)
570569
}
571570
}
572571

573-
drm_display_mode_to_videomode(mode, &vm);
574-
575572
DRM_DEBUG_DRIVER("CRTC:%d mode:%s\n", crtc->base.id, mode->name);
576-
DRM_DEBUG_DRIVER("Video mode: %dx%d", vm.hactive, vm.vactive);
573+
DRM_DEBUG_DRIVER("Video mode: %dx%d", mode->hdisplay, mode->vdisplay);
577574
DRM_DEBUG_DRIVER(" hfp %d hbp %d hsl %d vfp %d vbp %d vsl %d\n",
578-
vm.hfront_porch, vm.hback_porch, vm.hsync_len,
579-
vm.vfront_porch, vm.vback_porch, vm.vsync_len);
575+
mode->hsync_start - mode->hdisplay,
576+
mode->htotal - mode->hsync_end,
577+
mode->hsync_end - mode->hsync_start,
578+
mode->vsync_start - mode->vdisplay,
579+
mode->vtotal - mode->vsync_end,
580+
mode->vsync_end - mode->vsync_start);
580581

581582
/* Convert video timings to ltdc timings */
582-
hsync = vm.hsync_len - 1;
583-
vsync = vm.vsync_len - 1;
584-
accum_hbp = hsync + vm.hback_porch;
585-
accum_vbp = vsync + vm.vback_porch;
586-
accum_act_w = accum_hbp + vm.hactive;
587-
accum_act_h = accum_vbp + vm.vactive;
588-
total_width = accum_act_w + vm.hfront_porch;
589-
total_height = accum_act_h + vm.vfront_porch;
583+
hsync = mode->hsync_end - mode->hsync_start - 1;
584+
vsync = mode->vsync_end - mode->vsync_start - 1;
585+
accum_hbp = mode->htotal - mode->hsync_start - 1;
586+
accum_vbp = mode->vtotal - mode->vsync_start - 1;
587+
accum_act_w = accum_hbp + mode->hdisplay;
588+
accum_act_h = accum_vbp + mode->vdisplay;
589+
total_width = mode->htotal - 1;
590+
total_height = mode->vtotal - 1;
590591

591592
/* Configures the HS, VS, DE and PC polarities. Default Active Low */
592593
val = 0;
593594

594-
if (vm.flags & DISPLAY_FLAGS_HSYNC_HIGH)
595+
if (mode->flags & DRM_MODE_FLAG_PHSYNC)
595596
val |= GCR_HSPOL;
596597

597-
if (vm.flags & DISPLAY_FLAGS_VSYNC_HIGH)
598+
if (mode->flags & DRM_MODE_FLAG_PVSYNC)
598599
val |= GCR_VSPOL;
599600

600601
if (bus_flags & DRM_BUS_FLAG_DE_LOW)

0 commit comments

Comments
 (0)