summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxime Ripard <maxime.ripard@bootlin.com>2019-02-11 15:41:27 +0100
committerMaxime Ripard <maxime.ripard@bootlin.com>2019-02-19 11:08:32 +0100
commit62e7511a4f4dcf07f753893d3424decd9466c98b (patch)
tree05d7799415d5b2bb25f71f5589c0786c0952c7fc
parentdrm/sun4i: dsi: Fix front vs back porch calculation (diff)
downloadlinux-62e7511a4f4dcf07f753893d3424decd9466c98b.tar.xz
linux-62e7511a4f4dcf07f753893d3424decd9466c98b.zip
drm/sun4i: dsi: Rework a bit the hblk calculation
It turns out that the hblk calculation actually follows a similar pattern than the other packets. Rework a bit the calculation and add a comment. Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com> Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> Link: https://patchwork.freedesktop.org/patch/msgid/d79a21b09847579ce907212a59737af21a729dd0.1549896081.git-series.maxime.ripard@bootlin.com
-rw-r--r--drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 935726696131..d7c14758d30c 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -489,9 +489,13 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi,
(mode->hsync_start - mode->hdisplay) * Bpp - HFP_PACKET_OVERHEAD);
/*
- * hblk seems to be the line + porches length.
+ * The blanking is set using a sync event (4 bytes) and a
+ * blanking packet (4 bytes + payload + 2 bytes). Its minimal
+ * size is therefore 10 bytes.
*/
- hblk = mode->htotal * Bpp - hsa;
+#define HBLK_PACKET_OVERHEAD 10
+ hblk = max((unsigned int)HBLK_PACKET_OVERHEAD,
+ (mode->htotal - (mode->hsync_end - mode->hsync_start)) * Bpp - HBLK_PACKET_OVERHEAD);
/*
* And I'm not entirely sure what vblk is about. The driver in