mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
clk: axg: fine-tune pll set_rate op [1/1]
PD#146411: if set_rate target rate equal to old rate, just skip. Change-Id: I945fdf6f72c5fccc6e0e701fe8f50fba8458d99f Signed-off-by: Qiufang Dai <qiufang.dai@amlogic.com>
This commit is contained in:
@@ -188,6 +188,18 @@ static int meson_axg_pll_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
if (pll->lock)
|
||||
spin_lock_irqsave(pll->lock, flags);
|
||||
|
||||
if (readl(pll->base + p->reg_off) & MESON_PLL_ENABLE) {
|
||||
old_rate = meson_axg_pll_recalc_rate(hw,
|
||||
clk_get_rate(clk_get_parent(hw->clk)));
|
||||
old_rate = meson_axg_pll_round_rate(hw, old_rate, NULL);
|
||||
|
||||
if (old_rate == rate) {
|
||||
if (pll->lock)
|
||||
spin_unlock_irqrestore(pll->lock, flags);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
if (!strcmp(clk_hw_get_name(hw), "gp0_pll")
|
||||
|| !strcmp(clk_hw_get_name(hw), "hifi_pll")
|
||||
|| !strcmp(clk_hw_get_name(hw), "pcie_pll")) {
|
||||
@@ -266,9 +278,9 @@ static int meson_axg_pll_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
spin_unlock_irqrestore(pll->lock, flags);
|
||||
|
||||
if (ret) {
|
||||
pr_warn("%s: pll did not lock, trying to restore old rate %lu\n",
|
||||
__func__, old_rate);
|
||||
meson_axg_pll_set_rate(hw, old_rate, parent_rate);
|
||||
pr_warn("%s: pll did not lock, trying to lock rate %lu again\n",
|
||||
__func__, rate);
|
||||
meson_axg_pll_set_rate(hw, rate, parent_rate);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user