diff mbox series

[v3,5/8] drm/sun4i: dsi: Fix DRQ calculation

Message ID e858ff6509e0d3f657fd9229b28f4ac177a04a76.1549896081.git-series.maxime.ripard@bootlin.com (mailing list archive)
State New, archived
Headers show
Series drm/sun4i: dsi: Add burst mode support | expand

Commit Message

Maxime Ripard Feb. 11, 2019, 2:41 p.m. UTC
The DRQ calculation code in the Allwinner BSP uses the vertical front
porch value as the condition, but we're using the video back porch.

Since I always confuse the two, and I'm the original author of that code, I
guess I deserved a brown paper bag.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Paul Kocialkowski Feb. 13, 2019, 2:33 p.m. UTC | #1
Hi,

On Mon, 2019-02-11 at 15:41 +0100, Maxime Ripard wrote:
> The DRQ calculation code in the Allwinner BSP uses the vertical front
> porch value as the condition, but we're using the video back porch.
> 
> Since I always confuse the two, and I'm the original author of that code, I
> guess I deserved a brown paper bag.
> 
> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>

Assuming that the BSP's hbp is referring to the back porch only, then
calculating ht - x - hbp does give us the front porch + hsync length.

Well, let's guess that this about the front porch only until we know
better. It's certainly better than using the back porch anyway :)

Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>

Cheers,

Paul

> ---
>  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> index 2518a0d7567c..8e6392831e9d 100644
> --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> @@ -372,9 +372,9 @@ static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi,
>  	struct mipi_dsi_device *device = dsi->device;
>  	u32 val = 0;
>  
> -	if ((mode->hsync_end - mode->hdisplay) > 20) {
> +	if ((mode->hsync_start - mode->hdisplay) > 20) {
>  		/* Maaaaaagic */
> -		u16 drq = (mode->hsync_end - mode->hdisplay) - 20;
> +		u16 drq = (mode->hsync_start - mode->hdisplay) - 20;
>  
>  		drq *= mipi_dsi_pixel_format_to_bpp(device->format);
>  		drq /= 32;
Maxime Ripard Feb. 14, 2019, 9:23 a.m. UTC | #2
On Wed, Feb 13, 2019 at 03:33:38PM +0100, Paul Kocialkowski wrote:
> Hi,
> 
> On Mon, 2019-02-11 at 15:41 +0100, Maxime Ripard wrote:
> > The DRQ calculation code in the Allwinner BSP uses the vertical front
> > porch value as the condition, but we're using the video back porch.
> > 
> > Since I always confuse the two, and I'm the original author of that code, I
> > guess I deserved a brown paper bag.
> > 
> > Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
> 
> Assuming that the BSP's hbp is referring to the back porch only, then
> calculating ht - x - hbp does give us the front porch + hsync length.
> 
> Well, let's guess that this about the front porch only until we know
> better. It's certainly better than using the back porch anyway :)

After discussing it with Paul, we decided to drop that patch since it
would make the backporch definition inconsistent in the driver.

Maxime
diff mbox series

Patch

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 2518a0d7567c..8e6392831e9d 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -372,9 +372,9 @@  static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi,
 	struct mipi_dsi_device *device = dsi->device;
 	u32 val = 0;
 
-	if ((mode->hsync_end - mode->hdisplay) > 20) {
+	if ((mode->hsync_start - mode->hdisplay) > 20) {
 		/* Maaaaaagic */
-		u16 drq = (mode->hsync_end - mode->hdisplay) - 20;
+		u16 drq = (mode->hsync_start - mode->hdisplay) - 20;
 
 		drq *= mipi_dsi_pixel_format_to_bpp(device->format);
 		drq /= 32;