]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
video: omap: add loop exit conditions to the dpll setup
authorDario Binacchi <dariobin@libero.it>
Sat, 22 Feb 2020 13:05:43 +0000 (14:05 +0100)
committerLokesh Vutla <lokeshvutla@ti.com>
Tue, 3 Mar 2020 07:38:14 +0000 (13:08 +0530)
In case of null error, round rate is equal to target rate, so it is
useless to continue to search the DPLL setup parameters to get the
desidered pixel clock rate.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
drivers/video/am335x-fb.c

index bbe965af841b8c4ff2a0023c4a9532ddfb856815..684223f275ac310cb10d6343a3f9d0a9ca3be7db 100644 (file)
@@ -160,7 +160,7 @@ int am335xfb_init(struct am335x_lcdpanel *panel)
        err = panel->pxl_clk;
        err_r = err;
 
-       for (d = 2; d < 255; d++) {
+       for (d = 2; err_r && d < 255; d++) {
                for (m = 2; m < 2047; m++) {
                        if ((V_OSCK * m) < (panel->pxl_clk * d))
                                continue;
@@ -176,6 +176,8 @@ int am335xfb_init(struct am335x_lcdpanel *panel)
                                dpll_disp.m = m;
                                dpll_disp.n = n;
                                best_d = d;
+                               if (err_r == 0)
+                                       break;
                        }
                }
        }