public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: Joey Lu <a0987203069@gmail•com>
To: mturquette@baylibre•com, sboyd@kernel•org
Cc: ychuang3@nuvoton•com, schung@nuvoton•com, yclu4@nuvoton•com,
	linux-arm-kernel@lists•infradead.org, linux-clk@vger•kernel.org,
	linux-kernel@vger•kernel.org, Joey Lu <a0987203069@gmail•com>
Subject: [PATCH v3 0/3] clk: nuvoton: ma35d1: fix PLL frequency calculation
Date: Thu, 21 May 2026 09:42:17 +0800	[thread overview]
Message-ID: <20260521014220.77955-1-a0987203069@gmail.com> (raw)

Fix four bugs in the MA35D1 PLL clock driver that cause incorrect
frequency values returned from recalc_rate() and determine_rate().

v1 combined all fixes into a single commit.  At reviewer request,
split into one patch per logical fix:

  1/3 - fix div_u64 return value being discarded (affects both
        ma35d1_calc_smic_pll_freq and ma35d1_calc_pll_freq INT mode)

  2/3 - fix PLL_CTL1_FRAC mask width (8-bit -> 24-bit) and update
        the fractional-mode arithmetic accordingly

  3/3 - fix ma35d1_clk_pll_determine_rate: move find_closest() into
        the configurable-PLL branch; unify read-only PLL handling

Changes in v3 (vs v2):
  - 2/3: replace the manual round-to-nearest expression
    "(u32)(((u64)x * 1000 + 500) >> 24)" with the kernel helper
    DIV_ROUND_CLOSEST_ULL((u64)x * 1000, 1ULL << 24); the result
    is mathematically identical but more readable and idiomatic

Joey Lu (3):
  clk: nuvoton: ma35d1: fix ignored div_u64 return values in PLL freq
    calculation
  clk: nuvoton: ma35d1: fix PLL_CTL1_FRAC bit field width and fractional
    calc
  clk: nuvoton: ma35d1: fix ma35d1_clk_pll_determine_rate logic

 drivers/clk/nuvoton/clk-ma35d1-pll.c | 38 ++++++++++++++--------------
 1 file changed, 19 insertions(+), 19 deletions(-)

-- 
2.43.0



             reply	other threads:[~2026-05-21  1:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-21  1:42 Joey Lu [this message]
2026-05-21  1:42 ` [PATCH v3 1/3] clk: nuvoton: ma35d1: fix ignored div_u64 return values in PLL freq calculation Joey Lu
2026-05-21  1:42 ` [PATCH v3 2/3] clk: nuvoton: ma35d1: fix PLL_CTL1_FRAC bit field width and fractional calc Joey Lu
2026-05-26 18:06   ` Brian Masney
2026-05-21  1:42 ` [PATCH v3 3/3] clk: nuvoton: ma35d1: fix ma35d1_clk_pll_determine_rate logic Joey Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260521014220.77955-1-a0987203069@gmail.com \
    --to=a0987203069@gmail$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-clk@vger$(echo .)kernel.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=mturquette@baylibre$(echo .)com \
    --cc=sboyd@kernel$(echo .)org \
    --cc=schung@nuvoton$(echo .)com \
    --cc=ychuang3@nuvoton$(echo .)com \
    --cc=yclu4@nuvoton$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox