All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] clk: rockchip: pll: fixes and simplification of maths in RK3588 frac PLL
@ 2026-07-13 18:35 Alexey Charkov
  2026-07-13 18:35 ` [PATCH 1/6] clk: rockchip: pll: drop misleading fout in rockchip_rk3588_pll_k_get() Alexey Charkov
                   ` (5 more replies)
  0 siblings, 6 replies; 26+ messages in thread
From: Alexey Charkov @ 2026-07-13 18:35 UTC (permalink / raw)
  To: u-boot, Elaine Zhang, Jagan Teki
  Cc: Lukasz Majewski, Simon Glass, Quentin Schulz, Kever Yang,
	Tom Rini, Ilias Apalodimas, Finley Xiao, Jonas Karlman,
	Alexey Charkov

Current fractional PLL code for RK3588 (also applies to RK3576) has two
issues causing it to overshoot the requested frequency for some negative
values of the fractional coefficient: one due to rounding, the other due
to treating -32768 as an invalid value where it is actually valid. It
also overflows the calculation of the fractional PLL rate when reading
it back, causing the function to return wrong PLL frequencies for non-
trivial values of the fractional coefficient.

Fix all three, and also use native signed integer arithmetics to avoid
manual bitwise operations on the unsigned representation of the fractional
coefficient, which simplifies the code and makes it easier to read.

The commits are deliberately split into excruciating granularity to
ensure each step is explained and easy to review. The final diff is not
too large though, so I'd be happy to squash as required.

Signed-off-by: Alexey Charkov <alchark@flipper.net>
---
Alexey Charkov (6):
      clk: rockchip: pll: drop misleading fout in rockchip_rk3588_pll_k_get()
      clk: rockchip: pll: fix rounding of negative k in RK3588 frac PLL
      clk: rockchip: pll: fix RK3588 frac PLL result for k=-32768
      clk: rockchip: pll: let rockchip_rk3588_pll_k_get update m directly
      clk: rockchip: pll: fractional PLL coefficient is two's complement
      clk: rockchip: pll: fix overflow and drop manual two's complement in rk3588_pll_get_rate

 arch/arm/include/asm/arch-rockchip/clock.h |  2 +-
 drivers/clk/rockchip/clk_pll.c             | 70 ++++++++++++------------------
 2 files changed, 29 insertions(+), 43 deletions(-)
---
base-commit: 6741b0dfb41dc82a284ab1cff4c58af6ef2f3f9c
change-id: 20260713-rk3588-fracpll-7b3e1f817c7d

Best regards,
--  
Alexey Charkov <alchark@flipper.net>


^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2026-07-23 12:33 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-13 18:35 [PATCH 0/6] clk: rockchip: pll: fixes and simplification of maths in RK3588 frac PLL Alexey Charkov
2026-07-13 18:35 ` [PATCH 1/6] clk: rockchip: pll: drop misleading fout in rockchip_rk3588_pll_k_get() Alexey Charkov
2026-07-21 10:09   ` Quentin Schulz via U-Boot
2026-07-13 18:35 ` [PATCH 2/6] clk: rockchip: pll: fix rounding of negative k in RK3588 frac PLL Alexey Charkov
2026-07-21 12:57   ` Quentin Schulz via U-Boot
2026-07-13 18:35 ` [PATCH 3/6] clk: rockchip: pll: fix RK3588 frac PLL result for k=-32768 Alexey Charkov
2026-07-21 12:16   ` Quentin Schulz via U-Boot
2026-07-21 12:51     ` Alexey Charkov via U-Boot
2026-07-13 18:35 ` [PATCH 4/6] clk: rockchip: pll: let rockchip_rk3588_pll_k_get update m directly Alexey Charkov
2026-07-21 12:19   ` Quentin Schulz via U-Boot
2026-07-21 12:47     ` Alexey Charkov via U-Boot
2026-07-13 18:35 ` [PATCH 5/6] clk: rockchip: pll: fractional PLL coefficient is two's complement Alexey Charkov
2026-07-21 12:20   ` Quentin Schulz via U-Boot
2026-07-21 12:46     ` Alexey Charkov via U-Boot
2026-07-21 14:34       ` Quentin Schulz via U-Boot
2026-07-21 15:21         ` Alexey Charkov via U-Boot
2026-07-21 16:34           ` Quentin Schulz via U-Boot
2026-07-21 17:27             ` Alexey Charkov via U-Boot
2026-07-13 18:35 ` [PATCH 6/6] clk: rockchip: pll: fix overflow and drop manual two's complement in rk3588_pll_get_rate Alexey Charkov
2026-07-21 12:56   ` Quentin Schulz via U-Boot
2026-07-21 13:34     ` Alexey Charkov via U-Boot
2026-07-21 14:05       ` Quentin Schulz via U-Boot
2026-07-21 16:02         ` Alexey Charkov via U-Boot
2026-07-23  9:23   ` Quentin Schulz
2026-07-23 12:25     ` Alexey Charkov
2026-07-23 12:33       ` Quentin Schulz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.