All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Taniya Das" <taniya.das@oss.qualcomm.com>
Cc: conor+dt@kernel.org, linux-clk@vger.kernel.org,
	devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH 1/3] clk: qcom: clk-alpha-pll: support a 28-bit ALPHA_VAL width
Date: Mon, 07 Sep 2026 08:38:08 +0000	[thread overview]
Message-ID: <20260907083809.1BE931F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260907-nords_dprx-v1-1-d472af3f01b1@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The function `zonda_pll_adjust_l_val` incorrectly adds the unscaled target frequency `rate` instead of the divided `quotient` to the L-value multiplier.
--

commit 661ff85b8608f1b3893f18020783320b39a04c99
Author: Taniya Das <taniya.das@oss.qualcomm.com>

clk: qcom: clk-alpha-pll: support a 28-bit ALPHA_VAL width
    
This commit introduces support for an optional 28-bit ALPHA_VAL width in the
clk-alpha-pll driver by adding an alpha_width field. This allows correct
scaling and calculation for PLLs like the Zonda instances that use a wider
register for finer fractional resolution.

> diff --git a/drivers/clk/qcom/clk-alpha-pll.c b/drivers/clk/qcom/clk-alpha-pll.c
> index 60173b076cc5f..981f973da02f3 100644
> --- a/drivers/clk/qcom/clk-alpha-pll.c
> +++ b/drivers/clk/qcom/clk-alpha-pll.c

[ ... ]

> @@ -2290,7 +2291,7 @@ static int clk_zonda_pll_set_rate(struct clk_hw *hw, unsigned long rate,
>  	if (ret < 0)
>  		return ret;
>  
> -	if (a & PLL_ALPHA_MSB)
> +	if (a & BIT(alpha_width - 1))
>  		zonda_pll_adjust_l_val(rate, prate, &l);

[Severity: High]
This isn't a bug introduced by this patch, but while reviewing this L-adjust
MSB check, does zonda_pll_adjust_l_val() incorrectly add the unscaled target
frequency to the L-value multiplier?

When this condition is met and zonda_pll_adjust_l_val() is invoked, it appears
to overwrite the previously calculated integer divider with the raw rate
instead of the local quotient:

drivers/clk/qcom/clk-alpha-pll.c:zonda_pll_adjust_l_val() {
	u64 remainder, quotient;

	quotient = rate;
	remainder = do_div(quotient, prate);

	*l = rate + (u32)(remainder * 2 >= prate);
}

Should this final assignment use the `quotient` variable instead of `rate`?
Writing an astronomically unscaled value (like the target rate in Hz) to the
L-value register would severely corrupt the PLL hardware configuration and
cause it to fail to lock.

>  
>  	regmap_write(pll->clkr.regmap, PLL_ALPHA_VAL(pll), a);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260907-nords_dprx-v1-0-d472af3f01b1@oss.qualcomm.com?part=1

  reply	other threads:[~2026-09-07  8:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07  8:26 [PATCH 0/3] clk: qcom: Add Nord DPRX clock controller support Taniya Das
2026-09-07  8:26 ` [PATCH 1/3] clk: qcom: clk-alpha-pll: support a 28-bit ALPHA_VAL width Taniya Das
2026-09-07  8:38   ` sashiko-bot [this message]
2026-09-07 10:30   ` Abel Vesa
2026-09-09  8:41   ` Shawn Guo
2026-09-10  8:10     ` Taniya Das
2026-09-07  8:26 ` [PATCH 2/3] dt-bindings: clock: qcom: document the Nord DPRX Clock Controller Taniya Das
2026-09-07  8:35   ` sashiko-bot
2026-09-07 10:38   ` Abel Vesa
2026-09-09  8:31   ` Shawn Guo
2026-09-10  8:55     ` Taniya Das
2026-09-07  8:26 ` [PATCH 3/3] clk: qcom: dprxcc: Add Nord DPRX clock controller support Taniya Das
2026-09-07  8:55   ` sashiko-bot
2026-09-07 10:43   ` Abel Vesa
2026-09-09  9:06   ` Shawn Guo
2026-09-10  9:08     ` Taniya Das
2026-09-09  8:34 ` [PATCH 0/3] clk: qcom: " Shawn Guo
2026-09-10  8:14   ` Taniya Das

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=20260907083809.1BE931F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=taniya.das@oss.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.