Skip to content

Commit 686f225

Browse files
committed
Merge tag 'clk-meson-v5.14-1' of https://github.com/BayLibre/clk-meson into clk-amlogic
Pull Amlogic clk driver updates from Jerome Brunet: - Use determine_rate() for the pll ops instead of round_rate() - Restrict gp0/1 and audio plls range on g12a/sm1 - Improve axg-audio controller error on deferral - Add NNA clocks on g12a * tag 'clk-meson-v5.14-1' of https://github.com/BayLibre/clk-meson: clk: meson: g12a: Add missing NNA source clocks for g12b clk: meson: axg-audio: improve deferral handling clk: meson: g12a: fix gp0 and hifi ranges clk: meson: pll: switch to determine_rate for the PLL ops
2 parents 6efb943 + 8271813 commit 686f225

File tree

3 files changed

+24
-15
lines changed

3 files changed

+24
-15
lines changed

drivers/clk/meson/axg-audio.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,8 +1665,7 @@ static int devm_clk_get_enable(struct device *dev, char *id)
16651665
clk = devm_clk_get(dev, id);
16661666
if (IS_ERR(clk)) {
16671667
ret = PTR_ERR(clk);
1668-
if (ret != -EPROBE_DEFER)
1669-
dev_err(dev, "failed to get %s", id);
1668+
dev_err_probe(dev, ret, "failed to get %s", id);
16701669
return ret;
16711670
}
16721671

@@ -1811,7 +1810,7 @@ static int axg_audio_clkc_probe(struct platform_device *pdev)
18111810

18121811
ret = device_reset(dev);
18131812
if (ret) {
1814-
dev_err(dev, "failed to reset device\n");
1813+
dev_err_probe(dev, ret, "failed to reset device\n");
18151814
return ret;
18161815
}
18171816

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,

drivers/clk/meson/g12a.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1603,7 +1603,7 @@ static struct clk_regmap g12b_cpub_clk_trace = {
16031603
};
16041604

16051605
static const struct pll_mult_range g12a_gp0_pll_mult_range = {
1606-
.min = 55,
1606+
.min = 125,
16071607
.max = 255,
16081608
};
16091609

@@ -4723,6 +4723,12 @@ static struct clk_hw_onecell_data g12b_hw_onecell_data = {
47234723
[CLKID_SPICC1_SCLK_SEL] = &g12a_spicc1_sclk_sel.hw,
47244724
[CLKID_SPICC1_SCLK_DIV] = &g12a_spicc1_sclk_div.hw,
47254725
[CLKID_SPICC1_SCLK] = &g12a_spicc1_sclk.hw,
4726+
[CLKID_NNA_AXI_CLK_SEL] = &sm1_nna_axi_clk_sel.hw,
4727+
[CLKID_NNA_AXI_CLK_DIV] = &sm1_nna_axi_clk_div.hw,
4728+
[CLKID_NNA_AXI_CLK] = &sm1_nna_axi_clk.hw,
4729+
[CLKID_NNA_CORE_CLK_SEL] = &sm1_nna_core_clk_sel.hw,
4730+
[CLKID_NNA_CORE_CLK_DIV] = &sm1_nna_core_clk_div.hw,
4731+
[CLKID_NNA_CORE_CLK] = &sm1_nna_core_clk.hw,
47264732
[CLKID_MIPI_DSI_PXCLK_SEL] = &g12a_mipi_dsi_pxclk_sel.hw,
47274733
[CLKID_MIPI_DSI_PXCLK_DIV] = &g12a_mipi_dsi_pxclk_div.hw,
47284734
[CLKID_MIPI_DSI_PXCLK] = &g12a_mipi_dsi_pxclk.hw,

0 commit comments

Comments
 (0)