diff mbox

[U-Boot,2/2] video: ipu_disp: remove pixclk fixup

Message ID 1413311835-22715-2-git-send-email-jeroen@myspectrum.nl
State Accepted
Delegated to: Anatolij Gustschin
Headers show

Commit Message

Jeroen Hofstee Oct. 14, 2014, 6:37 p.m. UTC
The ipu display insists on having a lower_margin smaller
then 2. If this is not the case it will attempt to force
it and adjust the pixclk accordingly. This multiplies pixclk
in Hz with the width and height, since this is typically
a * 10^7 * b * 10^2 * c * 10^2 this will overflow the
uint_32 and make things even worse. Since this is a
bootloader and the adjustment is neglectible, just force
it to two and warn about it.

Cc: Stefano Babic <sbabic@denx.de>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
---
 drivers/video/ipu_disp.c | 31 ++++++-------------------------
 1 file changed, 6 insertions(+), 25 deletions(-)

Comments

Jeroen Hofstee Oct. 15, 2014, 7:42 a.m. UTC | #1
Hello Stefano,

On 14-10-14 20:37, Jeroen Hofstee wrote:
> The ipu display insists on having a lower_margin smaller
> then 2. If this is not the case it will attempt to force
> it and adjust the pixclk accordingly. This multiplies pixclk
> in Hz with the width and height, since this is typically
> a * 10^7 * b * 10^2 * c * 10^2 this will overflow the
> uint_32 and make things even worse. Since this is a
> bootloader and the adjustment is neglectible, just force
> it to two and warn about it.
>
> Cc: Stefano Babic <sbabic@denx.de>
> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl

The lower_margin should be larger then 1 / _not_
smalller then 2 actually.

Regards,
Jeroen
Anatolij Gustschin Oct. 16, 2014, 9:14 a.m. UTC | #2
On Tue, 14 Oct 2014 20:37:15 +0200
Jeroen Hofstee <jeroen@myspectrum.nl> wrote:

> The ipu display insists on having a lower_margin smaller
> then 2. If this is not the case it will attempt to force
> it and adjust the pixclk accordingly. This multiplies pixclk
> in Hz with the width and height, since this is typically
> a * 10^7 * b * 10^2 * c * 10^2 this will overflow the
> uint_32 and make things even worse. Since this is a
> bootloader and the adjustment is neglectible, just force
> it to two and warn about it.
> 
> Cc: Stefano Babic <sbabic@denx.de>
> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
> ---
>  drivers/video/ipu_disp.c | 31 ++++++-------------------------
>  1 file changed, 6 insertions(+), 25 deletions(-)

Applied to u-boot-video/master.

Thanks,

Anatolij
diff mbox

Patch

diff --git a/drivers/video/ipu_disp.c b/drivers/video/ipu_disp.c
index e97a204..48fee99 100644
--- a/drivers/video/ipu_disp.c
+++ b/drivers/video/ipu_disp.c
@@ -802,28 +802,6 @@  int ipu_pixfmt_to_map(uint32_t fmt)
 }
 
 /*
- * This function is called to adapt synchronous LCD panel to IPU restriction.
- */
-void adapt_panel_to_ipu_restricitions(uint32_t *pixel_clk,
-				      uint16_t width, uint16_t height,
-				      uint16_t h_start_width,
-				      uint16_t h_end_width,
-				      uint16_t v_start_width,
-				      uint16_t *v_end_width)
-{
-	if (*v_end_width < 2) {
-		uint16_t total_width = width + h_start_width + h_end_width;
-		uint16_t total_height_old = height + v_start_width +
-			(*v_end_width);
-		uint16_t total_height_new = height + v_start_width + 2;
-		*v_end_width = 2;
-		*pixel_clk = (*pixel_clk) * total_width * total_height_new /
-			(total_width * total_height_old);
-		printf("WARNING: adapt panel end blank lines\n");
-	}
-}
-
-/*
  * This function is called to initialize a synchronous LCD panel.
  *
  * @param       disp            The DI the panel is attached to.
@@ -880,9 +858,12 @@  int32_t ipu_init_sync_panel(int disp, uint32_t pixel_clk,
 	if ((v_sync_width == 0) || (h_sync_width == 0))
 		return -EINVAL;
 
-	adapt_panel_to_ipu_restricitions(&pixel_clk, width, height,
-					 h_start_width, h_end_width,
-					 v_start_width, &v_end_width);
+	/* adapt panel to ipu restricitions */
+	if (v_end_width < 2) {
+		v_end_width = 2;
+		puts("WARNING: v_end_width (lower_margin) must be >= 2, adjusted\n");
+	}
+
 	h_total = width + h_sync_width + h_start_width + h_end_width;
 	v_total = height + v_sync_width + v_start_width + v_end_width;