Skip to content

Commit 3fc307d

Browse files
tombarobertfoss
authored andcommitted
drm/bridge: ti-sn65dsi86: Reject modes with too large blanking
The front and back porch registers are 8 bits, and pulse width registers are 15 bits, so reject any modes with larger periods. Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com> Reviewed-by: Robert Foss <robert.foss@linaro.org> Signed-off-by: Robert Foss <robert.foss@linaro.org> Link: https://patchwork.freedesktop.org/patch/msgid/20220831082653.20449-2-tomi.valkeinen@ideasonboard.com
1 parent e06a460 commit 3fc307d

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

drivers/gpu/drm/bridge/ti-sn65dsi86.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,29 @@ ti_sn_bridge_mode_valid(struct drm_bridge *bridge,
747747
if (mode->clock > 594000)
748748
return MODE_CLOCK_HIGH;
749749

750+
/*
751+
* The front and back porch registers are 8 bits, and pulse width
752+
* registers are 15 bits, so reject any modes with larger periods.
753+
*/
754+
755+
if ((mode->hsync_start - mode->hdisplay) > 0xff)
756+
return MODE_HBLANK_WIDE;
757+
758+
if ((mode->vsync_start - mode->vdisplay) > 0xff)
759+
return MODE_VBLANK_WIDE;
760+
761+
if ((mode->hsync_end - mode->hsync_start) > 0x7fff)
762+
return MODE_HSYNC_WIDE;
763+
764+
if ((mode->vsync_end - mode->vsync_start) > 0x7fff)
765+
return MODE_VSYNC_WIDE;
766+
767+
if ((mode->htotal - mode->hsync_end) > 0xff)
768+
return MODE_HBLANK_WIDE;
769+
770+
if ((mode->vtotal - mode->vsync_end) > 0xff)
771+
return MODE_VBLANK_WIDE;
772+
750773
return MODE_OK;
751774
}
752775

0 commit comments

Comments
 (0)