[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230918-imx8mp-dtsi-v1-8-1d008b3237c0@skidata.com>
Date: Mon, 18 Sep 2023 00:40:04 +0200
From: Benjamin Bara <bbara93@...il.com>
To: Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
NXP Linux Team <linux-imx@....com>,
Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>,
Russell King <linux@...linux.org.uk>,
Abel Vesa <abelvesa@...nel.org>, Peng Fan <peng.fan@....com>
Cc: Frank Oltmanns <frank@...manns.dev>,
Maxime Ripard <mripard@...nel.org>, devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-clk@...r.kernel.org,
Benjamin Bara <benjamin.bara@...data.com>
Subject: [PATCH 08/13] clk: divider: stop early if an optimal divider is
found
From: Benjamin Bara <benjamin.bara@...data.com>
During finding the best divider, the current implementation asks the
parent for the best rate for all its available dividers. If there are a
lot of supported divider values and the maximum divider is far from the
target rate, this can lead to many iterations. Depending on the parent,
the process of calculating the best fitting rate can be quite complex.
Therefore, return early if an optimal divider has been found.
Signed-off-by: Benjamin Bara <benjamin.bara@...data.com>
---
drivers/clk/clk-divider.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c
index a2c2b5203b0a..61b40dfb4e6f 100644
--- a/drivers/clk/clk-divider.c
+++ b/drivers/clk/clk-divider.c
@@ -332,6 +332,15 @@ static int clk_divider_bestdiv(struct clk_hw *hw, struct clk_hw *parent,
bestdiv = i;
best = now;
*best_parent_rate = parent_rate;
+ if (now == rate)
+ /*
+ * Calculating fitting PLL parameters, which
+ * might be done in parent's round_rate, can be
+ * time-consuming. Therefore, the lowest parent
+ * rate which gives us the exact required rate
+ * is already optimal.
+ */
+ return i;
}
}
--
2.34.1
Powered by blists - more mailing lists