Commit c1ad36e9 authored by Maxime Ripard's avatar Maxime Ripard Committed by Greg Kroah-Hartman

drm/sun4i: dsi: Enforce boundaries on the start delay

[ Upstream commit efa31801 ]

The Allwinner BSP makes sure that we don't end up with a null start delay
or with a delay larger than vtotal.

The former condition is likely to happen now with the reworked start delay,
so make sure we enforce the same boundaries.
Signed-off-by: default avatarMaxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: default avatarPaul Kocialkowski <paul.kocialkowski@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/c9889cf5f7a3d101ef380905900b45a182596f56.1549896081.git-series.maxime.ripard@bootlin.comSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 2cfe5e42
...@@ -359,8 +359,12 @@ static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi, ...@@ -359,8 +359,12 @@ static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi,
struct drm_display_mode *mode) struct drm_display_mode *mode)
{ {
u16 start = clamp(mode->vtotal - mode->vdisplay - 10, 8, 100); u16 start = clamp(mode->vtotal - mode->vdisplay - 10, 8, 100);
u16 delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start;
return mode->vtotal - (mode->vsync_end - mode->vdisplay) + start; if (delay > mode->vtotal)
delay = delay % mode->vtotal;
return max_t(u16, delay, 1);
} }
static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi, static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment