Skip to content

Commit 89f1213

Browse files
6by9pelwell
authored andcommitted
drm/vc4: Fixup mode for 7inch panel on DSI0
The TC358762 bridge and panel decodes the mode differently on DSI0 to DSI1 for no obvious reason, and results in a shift off the screen. Whilst it would be possible to change the compatible used for the panel, that then messes up Pi5. As it appears to be restricted to vc4 DSI0, fix up the mode in vc4_dsi. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
1 parent d5377dd commit 89f1213

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

drivers/gpu/drm/vc4/vc4_dsi.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,7 @@ static bool vc4_dsi_bridge_mode_fixup(struct drm_bridge *bridge,
866866
unsigned long pixel_clock_hz = mode->clock * 1000;
867867
unsigned long pll_clock = pixel_clock_hz * dsi->divider;
868868
int divider;
869+
u16 htotal;
869870

870871
/* Find what divider gets us a faster clock than the requested
871872
* pixel clock.
@@ -882,12 +883,27 @@ static bool vc4_dsi_bridge_mode_fixup(struct drm_bridge *bridge,
882883
pixel_clock_hz = pll_clock / dsi->divider;
883884

884885
adjusted_mode->clock = pixel_clock_hz / 1000;
886+
htotal = mode->htotal;
887+
888+
if (dsi->variant->port == 0 && mode->clock == 30000 &&
889+
mode->hdisplay == 800 && mode->htotal == (800 + 59 + 2 + 45) &&
890+
mode->vdisplay == 480 && mode->vtotal == (480 + 7 + 2 + 22)) {
891+
/*
892+
* Raspberry Pi 7" panel via TC358762 seems to have an issue on
893+
* DSI0 that it doesn't actually follow the vertical timing that
894+
* is otherwise identical to that produced on DSI1.
895+
* Fixup the mode.
896+
*/
897+
htotal = 800 + 59 + 2 + 47;
898+
adjusted_mode->vtotal = 480 + 7 + 2 + 45;
899+
adjusted_mode->crtc_vtotal = 480 + 7 + 2 + 45;
900+
}
885901

886902
/* Given the new pixel clock, adjust HFP to keep vrefresh the same. */
887-
adjusted_mode->htotal = adjusted_mode->clock * mode->htotal /
903+
adjusted_mode->htotal = adjusted_mode->clock * htotal /
888904
mode->clock;
889-
adjusted_mode->hsync_end += adjusted_mode->htotal - mode->htotal;
890-
adjusted_mode->hsync_start += adjusted_mode->htotal - mode->htotal;
905+
adjusted_mode->hsync_end += adjusted_mode->htotal - htotal;
906+
adjusted_mode->hsync_start += adjusted_mode->htotal - htotal;
891907

892908
return true;
893909
}

0 commit comments

Comments
 (0)