Message ID | 20240328-alpha-pll-fix-stromer-set-rate-v3-1-1b79714c78bc@gmail.com (mailing list archive) |
---|---|
State | Awaiting Upstream, archived |
Headers | show |
Series | [v3] clk: qcom: clk-alpha-pll: fix rate setting for Stromer PLLs | expand |
On Thu, 28 Mar 2024 08:54:31 +0100, Gabor Juhos wrote: > The clk_alpha_pll_stromer_set_rate() function writes inproper > values into the ALPHA_VAL{,_U} registers which results in wrong > clock rates when the alpha value is used. > > The broken behaviour can be seen on IPQ5018 for example, when > dynamic scaling sets the CPU frequency to 800000 KHz. In this > case the CPU cores are running only at 792031 KHz: > > [...] Applied, thanks! [1/1] clk: qcom: clk-alpha-pll: fix rate setting for Stromer PLLs commit: f837535fcb32a0313e07dd8ac49c2cfa43b49260 Best regards,
diff --git a/drivers/clk/qcom/clk-alpha-pll.c b/drivers/clk/qcom/clk-alpha-pll.c index 8a412ef47e16..8a8abb429577 100644 --- a/drivers/clk/qcom/clk-alpha-pll.c +++ b/drivers/clk/qcom/clk-alpha-pll.c @@ -2490,6 +2490,8 @@ static int clk_alpha_pll_stromer_set_rate(struct clk_hw *hw, unsigned long rate, rate = alpha_pll_round_rate(rate, prate, &l, &a, ALPHA_REG_BITWIDTH); regmap_write(pll->clkr.regmap, PLL_L_VAL(pll), l); + + a <<= ALPHA_REG_BITWIDTH - ALPHA_BITWIDTH; regmap_write(pll->clkr.regmap, PLL_ALPHA_VAL(pll), a); regmap_write(pll->clkr.regmap, PLL_ALPHA_VAL_U(pll), a >> ALPHA_BITWIDTH);