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

clk: rockchip: Ignore frac divisor for PLL equivalence when it's unused

Rockchip RK3399 PLLs can be used in two separate modes: integral and
fractional. We can select between these two modes with the unambiguously
named DSMPD bit.

During boot, we check all PLL settings to confirm that they match our
PLL table for that frequency, and reinitialize the PLLs where they
don't. The settings checked for this include the fractional divider
field that is only used in fractional mode, even if we're in integral
mode (DSMPD = 1) and that field has no effect.

This patch changes the check to only compare the fractional divider if
we're actually in fractional mode. This way, we won't reinitialize the
PLL in cases where there's absolutely no reason for that, which may
avoid glitching child clocks that should better not be glitched (e.g.
PWM regulators).

Signed-off-by: Julius Werner <jwerner@chromium.org>

[cloned the fix to the pretty similar rk3036 pll]
Signed-off-by: Heiko Stuebner <heiko@sntech.de>

authored by

Julius Werner and committed by
Heiko Stuebner
bf92384b 161baaea

+4 -2
+4 -2
drivers/clk/rockchip/clk-pll.c
··· 319 319 320 320 if (rate->fbdiv != cur.fbdiv || rate->postdiv1 != cur.postdiv1 || 321 321 rate->refdiv != cur.refdiv || rate->postdiv2 != cur.postdiv2 || 322 - rate->dsmpd != cur.dsmpd || rate->frac != cur.frac) { 322 + rate->dsmpd != cur.dsmpd || 323 + (!cur.dsmpd && (rate->frac != cur.frac))) { 323 324 struct clk *parent = clk_get_parent(hw->clk); 324 325 325 326 if (!parent) { ··· 796 795 797 796 if (rate->fbdiv != cur.fbdiv || rate->postdiv1 != cur.postdiv1 || 798 797 rate->refdiv != cur.refdiv || rate->postdiv2 != cur.postdiv2 || 799 - rate->dsmpd != cur.dsmpd || rate->frac != cur.frac) { 798 + rate->dsmpd != cur.dsmpd || 799 + (!cur.dsmpd && (rate->frac != cur.frac))) { 800 800 struct clk *parent = clk_get_parent(hw->clk); 801 801 802 802 if (!parent) {