diff mbox series

[07/11] video: omap: add loop exit conditions to the dpll setup

Message ID 20200209184745.20473-8-dariobin@libero.it
State Superseded
Headers show
Series Add DM/DTS support for omap video driver | expand

Commit Message

Dario Binacchi Feb. 9, 2020, 6:47 p.m. UTC
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 at libero.it>
---

 drivers/video/am335x-fb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Lokesh Vutla Feb. 10, 2020, 4:10 a.m. UTC | #1
On 10/02/20 12:17 AM, Dario Binacchi wrote:
> 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 at libero.it>

Reviewed-by: Lokesh Vutla <lokeshvutla at ti.com>

Thanks and regards,
Lokesh
diff mbox series

Patch

diff --git a/drivers/video/am335x-fb.c b/drivers/video/am335x-fb.c
index 779032396e..bb89cb515d 100644
--- a/drivers/video/am335x-fb.c
+++ b/drivers/video/am335x-fb.c
@@ -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;
 			}
 		}
 	}