All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime.ripard@bootlin.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Sean Paul <seanpaul@chromium.org>,
	Maxime Ripard <maxime.ripard@bootlin.com>
Cc: bbrezillon@kernel.org, dri-devel@lists.freedesktop.org,
	Paul Kocialkowski <paul.kocialkowski@bootlin.com>,
	Chen-Yu Tsai <wens@csie.org>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Jagan Teki <jagan@openedev.com>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 7/9] drm/sun4i: dsi: Rework a bit the hblk calculation
Date: Fri,  8 Feb 2019 10:53:20 +0100	[thread overview]
Message-ID: <d79a21b09847579ce907212a59737af21a729dd0.1549619502.git-series.maxime.ripard@bootlin.com> (raw)
In-Reply-To: <cover.23dbbc9b943ff8f36253ac7c617e2eda142b1b69.1549619502.git-series.maxime.ripard@bootlin.com>

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>
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 8 ++++++--
 1 file 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 8e6392831e9d..e0288e7dc64e 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -488,9 +488,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
-- 
git-series 0.9.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Maxime Ripard <maxime.ripard@bootlin.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Sean Paul <seanpaul@chromium.org>,
	Maxime Ripard <maxime.ripard@bootlin.com>
Cc: bbrezillon@kernel.org, dri-devel@lists.freedesktop.org,
	Paul Kocialkowski <paul.kocialkowski@bootlin.com>,
	Chen-Yu Tsai <wens@csie.org>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Jagan Teki <jagan@openedev.com>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 7/9] drm/sun4i: dsi: Rework a bit the hblk calculation
Date: Fri,  8 Feb 2019 10:53:20 +0100	[thread overview]
Message-ID: <d79a21b09847579ce907212a59737af21a729dd0.1549619502.git-series.maxime.ripard@bootlin.com> (raw)
In-Reply-To: <cover.23dbbc9b943ff8f36253ac7c617e2eda142b1b69.1549619502.git-series.maxime.ripard@bootlin.com>

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>
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 8 ++++++--
 1 file 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 8e6392831e9d..e0288e7dc64e 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -488,9 +488,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
-- 
git-series 0.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2019-02-08  9:54 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-08  9:53 [PATCH v2 0/9] drm/sun4i: dsi: Add burst mode support Maxime Ripard
2019-02-08  9:53 ` Maxime Ripard
2019-02-08  9:53 ` [PATCH v2 1/9] fixup! ARM: dts: sun8i-a33: bridgemate: Enable display support Maxime Ripard
2019-02-08  9:53   ` Maxime Ripard
2019-02-08  9:57   ` Maxime Ripard
2019-02-08  9:57     ` Maxime Ripard
2019-02-08  9:53 ` [PATCH v2 2/9] drm/sun4i: dsi: Restrict DSI tcon clock divider Maxime Ripard
2019-02-08  9:53   ` Maxime Ripard
2019-02-08  9:53 ` [PATCH v2 3/9] drm/sun4i: dsi: Change the start delay calculation Maxime Ripard
2019-02-08  9:53   ` Maxime Ripard
2019-03-07 17:54   ` Jagan Teki
2019-03-07 17:54     ` Jagan Teki
2019-03-11 14:12     ` Maxime Ripard
2019-03-11 14:12       ` Maxime Ripard
2019-03-11 14:37       ` Jagan Teki
2019-03-11 14:37         ` Jagan Teki
2019-03-19 10:18         ` Maxime Ripard
2019-03-19 10:18           ` Maxime Ripard
2019-02-08  9:53 ` [PATCH v2 4/9] drm/sun4i: dsi: Enforce boundaries on the start delay Maxime Ripard
2019-02-08  9:53   ` Maxime Ripard
2019-02-08  9:53 ` [PATCH v2 5/9] drm/sun4i: dsi: Fix front vs back porch calculation Maxime Ripard
2019-02-08  9:53   ` Maxime Ripard
2019-02-08  9:53 ` [PATCH v2 6/9] drm/sun4i: dsi: Fix DRQ calculation Maxime Ripard
2019-02-08  9:53   ` Maxime Ripard
2019-02-08  9:53 ` Maxime Ripard [this message]
2019-02-08  9:53   ` [PATCH v2 7/9] drm/sun4i: dsi: Rework a bit the hblk calculation Maxime Ripard
2019-02-08  9:53 ` [PATCH v2 8/9] drm/sun4i: dsi: Add burst support Maxime Ripard
2019-02-08  9:53   ` Maxime Ripard
2019-02-08  9:53 ` [PATCH v2 9/9] drm/panel: Add Ronbo RB070D30 panel Maxime Ripard
2019-02-08  9:53   ` Maxime Ripard
2019-02-08 12:24   ` Konstantin Sudakov
2019-02-08 12:24     ` Konstantin Sudakov
2019-02-11 14:40     ` Maxime Ripard
2019-02-11 14:40       ` Maxime Ripard
2019-02-08 18:21   ` Sam Ravnborg
2019-02-08 18:21     ` Sam Ravnborg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d79a21b09847579ce907212a59737af21a729dd0.1549619502.git-series.maxime.ripard@bootlin.com \
    --to=maxime.ripard@bootlin.com \
    --cc=bbrezillon@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jagan@openedev.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=paul.kocialkowski@bootlin.com \
    --cc=seanpaul@chromium.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.