Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: qcom: Add .is_enabled ops for clk-alpha-pll

This would be useful in subsequent patches when the .set_rate operation
would need to identify if the PLL is actually enabled

Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
[sboyd@codeaurora.org: Simplify return statement of is_enabled op]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>

authored by

Rajendra Nayak and committed by
Stephen Boyd
86c390dc 400d9fda

+26
+26
drivers/clk/qcom/clk-alpha-pll.c
··· 199 199 wait_for_pll_disable(pll); 200 200 } 201 201 202 + static int pll_is_enabled(struct clk_hw *hw, u32 mask) 203 + { 204 + int ret; 205 + u32 val, off; 206 + struct clk_alpha_pll *pll = to_clk_alpha_pll(hw); 207 + 208 + off = pll->offset; 209 + ret = regmap_read(pll->clkr.regmap, off + PLL_MODE, &val); 210 + if (ret) 211 + return ret; 212 + 213 + return !!(val & mask); 214 + } 215 + 216 + static int clk_alpha_pll_hwfsm_is_enabled(struct clk_hw *hw) 217 + { 218 + return pll_is_enabled(hw, PLL_ACTIVE_FLAG); 219 + } 220 + 221 + static int clk_alpha_pll_is_enabled(struct clk_hw *hw) 222 + { 223 + return pll_is_enabled(hw, PLL_LOCK_DET); 224 + } 225 + 202 226 static int clk_alpha_pll_enable(struct clk_hw *hw) 203 227 { 204 228 int ret; ··· 432 408 const struct clk_ops clk_alpha_pll_ops = { 433 409 .enable = clk_alpha_pll_enable, 434 410 .disable = clk_alpha_pll_disable, 411 + .is_enabled = clk_alpha_pll_is_enabled, 435 412 .recalc_rate = clk_alpha_pll_recalc_rate, 436 413 .round_rate = clk_alpha_pll_round_rate, 437 414 .set_rate = clk_alpha_pll_set_rate, ··· 442 417 const struct clk_ops clk_alpha_pll_hwfsm_ops = { 443 418 .enable = clk_alpha_pll_hwfsm_enable, 444 419 .disable = clk_alpha_pll_hwfsm_disable, 420 + .is_enabled = clk_alpha_pll_hwfsm_is_enabled, 445 421 .recalc_rate = clk_alpha_pll_recalc_rate, 446 422 .round_rate = clk_alpha_pll_round_rate, 447 423 .set_rate = clk_alpha_pll_set_rate,