Skip to content

Commit ec099fa

Browse files
committed
drm/ingenic: Properly compute timings when using a 3x8-bit panel
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
1 parent 91e4d63 commit ec099fa

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

drivers/gpu/drm/ingenic/ingenic-drm-drv.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,7 @@ static int ingenic_drm_encoder_atomic_check(struct drm_encoder *encoder,
678678
struct drm_connector_state *conn_state)
679679
{
680680
struct drm_display_info *info = &conn_state->connector->display_info;
681+
struct drm_display_mode *mode = &crtc_state->adjusted_mode;
681682

682683
if (info->num_bus_formats != 1)
683684
return -EINVAL;
@@ -686,10 +687,22 @@ static int ingenic_drm_encoder_atomic_check(struct drm_encoder *encoder,
686687
return 0;
687688

688689
switch (*info->bus_formats) {
690+
case MEDIA_BUS_FMT_RGB888_3X8:
691+
/*
692+
* The LCD controller expects timing values in dot-clock ticks,
693+
* which is 3x the timing values in pixels when using a 3x8-bit
694+
* display; but it will count the display area size in pixels
695+
* either way. Go figure.
696+
*/
697+
mode->crtc_clock = mode->clock * 3;
698+
mode->crtc_hsync_start = mode->hsync_start * 3 - mode->hdisplay * 2;
699+
mode->crtc_hsync_end = mode->hsync_end * 3 - mode->hdisplay * 2;
700+
mode->crtc_hdisplay = mode->hdisplay;
701+
mode->crtc_htotal = mode->htotal * 3 - mode->hdisplay * 2;
702+
return 0;
689703
case MEDIA_BUS_FMT_RGB565_1X16:
690704
case MEDIA_BUS_FMT_RGB666_1X18:
691705
case MEDIA_BUS_FMT_RGB888_1X24:
692-
case MEDIA_BUS_FMT_RGB888_3X8:
693706
return 0;
694707
default:
695708
return -EINVAL;

0 commit comments

Comments
 (0)