l30013671 / rpms / kernel

Forked from rpms/kernel 2 years ago
Clone
Pablo Greco 7b2c62
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
Pablo Greco 7b2c62
From: Icenowy Zheng <icenowy@aosc.io>
Pablo Greco 7b2c62
Date: Mon, 16 Mar 2020 21:35:02 +0800
Pablo Greco 7b2c62
Subject: [PATCH] drm/sun4i: sun6i_mipi_dsi: fix horizontal timing calculation
Pablo Greco 7b2c62
Pablo Greco 7b2c62
The max() function call in horizontal timing calculation shouldn't pad a
Pablo Greco 7b2c62
length already subtracted with overhead to overhead, instead it should
Pablo Greco 7b2c62
only prevent the set timing to underflow.
Pablo Greco 7b2c62
Pablo Greco 7b2c62
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Pablo Greco 7b2c62
---
Pablo Greco 7b2c62
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 10 +++++-----
Pablo Greco 7b2c62
 1 file changed, 5 insertions(+), 5 deletions(-)
Pablo Greco 7b2c62
Pablo Greco 7b2c62
diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
Pablo Greco 7b2c62
index aa67cb037e9d..52e009dc632b 100644
Pablo Greco 7b2c62
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
Pablo Greco 7b2c62
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
Pablo Greco 7b2c62
@@ -556,7 +556,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi,
Pablo Greco 7b2c62
 		 */
Pablo Greco 7b2c62
 #define HSA_PACKET_OVERHEAD	10
Pablo Greco 7b2c62
 		hsa = max((unsigned int)HSA_PACKET_OVERHEAD,
Pablo Greco 7b2c62
-			  (mode->hsync_end - mode->hsync_start) * Bpp - HSA_PACKET_OVERHEAD);
Pablo Greco 7b2c62
+			  (mode->hsync_end - mode->hsync_start) * Bpp) - HSA_PACKET_OVERHEAD;
Pablo Greco 7b2c62
Pablo Greco 7b2c62
 		/*
Pablo Greco 7b2c62
 		 * The backporch is set using a blanking packet (4
Pablo Greco 7b2c62
@@ -565,7 +565,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi,
Pablo Greco 7b2c62
 		 */
Pablo Greco 7b2c62
 #define HBP_PACKET_OVERHEAD	6
Pablo Greco 7b2c62
 		hbp = max((unsigned int)HBP_PACKET_OVERHEAD,
Pablo Greco 7b2c62
-			  (mode->htotal - mode->hsync_end) * Bpp - HBP_PACKET_OVERHEAD);
Pablo Greco 7b2c62
+			  (mode->htotal - mode->hsync_end) * Bpp) - HBP_PACKET_OVERHEAD;
Pablo Greco 7b2c62
Pablo Greco 7b2c62
 		/*
Pablo Greco 7b2c62
 		 * The frontporch is set using a sync event (4 bytes)
Pablo Greco 7b2c62
@@ -575,7 +575,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi,
Pablo Greco 7b2c62
 		 */
Pablo Greco 7b2c62
 #define HFP_PACKET_OVERHEAD	16
Pablo Greco 7b2c62
 		hfp = max((unsigned int)HFP_PACKET_OVERHEAD,
Pablo Greco 7b2c62
-			  (mode->hsync_start - mode->hdisplay) * Bpp - HFP_PACKET_OVERHEAD);
Pablo Greco 7b2c62
+			  (mode->hsync_start - mode->hdisplay) * Bpp) - HFP_PACKET_OVERHEAD;
Pablo Greco 7b2c62
Pablo Greco 7b2c62
 		/*
Pablo Greco 7b2c62
 		 * The blanking is set using a sync event (4 bytes)
Pablo Greco 7b2c62
@@ -584,8 +584,8 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi,
Pablo Greco 7b2c62
 		 */
Pablo Greco 7b2c62
 #define HBLK_PACKET_OVERHEAD	10
Pablo Greco 7b2c62
 		hblk = max((unsigned int)HBLK_PACKET_OVERHEAD,
Pablo Greco 7b2c62
-			   (mode->htotal - (mode->hsync_end - mode->hsync_start)) * Bpp -
Pablo Greco 7b2c62
-			   HBLK_PACKET_OVERHEAD);
Pablo Greco 7b2c62
+			   (mode->htotal - (mode->hsync_end - mode->hsync_start)) * Bpp) -
Pablo Greco 7b2c62
+			   HBLK_PACKET_OVERHEAD;
Pablo Greco 7b2c62
Pablo Greco 7b2c62
 		/*
Pablo Greco 7b2c62
 		 * And I'm not entirely sure what vblk is about. The driver in
Pablo Greco 7b2c62
-- 
Pablo Greco 7b2c62
2.28.0
Pablo Greco 7b2c62