Skip to content

Commit 4cbf0cd

Browse files
xdarklightjbrun3t
authored andcommitted
clk: meson: pll: switch to determine_rate for the PLL ops
This increases the maxmium supported frequency on 32-bit systems from 2^31 (signed long as used by clk_ops.round_rate, maximum value: approx. 2.14GHz) to 2^32 (unsigned long as used by clk_ops.determine_rate, maximum value: approx. 4.29GHz). On Meson8/8b/8m2 the HDMI PLL and it's OD (post-dividers) are capable of running at up to 2.97GHz. So switch the divider implementation in clk-regmap to clk_ops.determine_rate to support these higher frequencies on 32-bit systems. Signed-off-by: Martin Blumenstingl <[email protected]> Signed-off-by: Jerome Brunet <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 6efb943 commit 4cbf0cd

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

drivers/clk/meson/clk-pll.c

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -242,31 +242,35 @@ static int meson_clk_get_pll_settings(unsigned long rate,
242242
return best ? 0 : -EINVAL;
243243
}
244244

245-
static long meson_clk_pll_round_rate(struct clk_hw *hw, unsigned long rate,
246-
unsigned long *parent_rate)
245+
static int meson_clk_pll_determine_rate(struct clk_hw *hw,
246+
struct clk_rate_request *req)
247247
{
248248
struct clk_regmap *clk = to_clk_regmap(hw);
249249
struct meson_clk_pll_data *pll = meson_clk_pll_data(clk);
250250
unsigned int m, n, frac;
251251
unsigned long round;
252252
int ret;
253253

254-
ret = meson_clk_get_pll_settings(rate, *parent_rate, &m, &n, pll);
254+
ret = meson_clk_get_pll_settings(req->rate, req->best_parent_rate,
255+
&m, &n, pll);
255256
if (ret)
256-
return meson_clk_pll_recalc_rate(hw, *parent_rate);
257+
return ret;
257258

258-
round = __pll_params_to_rate(*parent_rate, m, n, 0, pll);
259+
round = __pll_params_to_rate(req->best_parent_rate, m, n, 0, pll);
259260

260-
if (!MESON_PARM_APPLICABLE(&pll->frac) || rate == round)
261-
return round;
261+
if (!MESON_PARM_APPLICABLE(&pll->frac) || req->rate == round) {
262+
req->rate = round;
263+
return 0;
264+
}
262265

263266
/*
264267
* The rate provided by the setting is not an exact match, let's
265268
* try to improve the result using the fractional parameter
266269
*/
267-
frac = __pll_params_with_frac(rate, *parent_rate, m, n, pll);
270+
frac = __pll_params_with_frac(req->rate, req->best_parent_rate, m, n, pll);
271+
req->rate = __pll_params_to_rate(req->best_parent_rate, m, n, frac, pll);
268272

269-
return __pll_params_to_rate(*parent_rate, m, n, frac, pll);
273+
return 0;
270274
}
271275

272276
static int meson_clk_pll_wait_lock(struct clk_hw *hw)
@@ -419,7 +423,7 @@ static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate,
419423
*/
420424
const struct clk_ops meson_clk_pcie_pll_ops = {
421425
.recalc_rate = meson_clk_pll_recalc_rate,
422-
.round_rate = meson_clk_pll_round_rate,
426+
.determine_rate = meson_clk_pll_determine_rate,
423427
.is_enabled = meson_clk_pll_is_enabled,
424428
.enable = meson_clk_pcie_pll_enable,
425429
.disable = meson_clk_pll_disable
@@ -429,7 +433,7 @@ EXPORT_SYMBOL_GPL(meson_clk_pcie_pll_ops);
429433
const struct clk_ops meson_clk_pll_ops = {
430434
.init = meson_clk_pll_init,
431435
.recalc_rate = meson_clk_pll_recalc_rate,
432-
.round_rate = meson_clk_pll_round_rate,
436+
.determine_rate = meson_clk_pll_determine_rate,
433437
.set_rate = meson_clk_pll_set_rate,
434438
.is_enabled = meson_clk_pll_is_enabled,
435439
.enable = meson_clk_pll_enable,

0 commit comments

Comments
 (0)