Linux clock framework development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yu-Chun Lin" <eleanor.lin@realtek.com>
Cc: robh@kernel.org, linux-clk@vger.kernel.org,
	devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v13 05/11] clk: realtek: Add support for phase locked loops (PLLs)
Date: Wed, 12 Aug 2026 02:11:15 +0000	[thread overview]
Message-ID: <20260812021115.7DCFC1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260812020009.3480538-6-eleanor.lin@realtek.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Asymmetry in power sequence execution for PLLs without a power status register will lead to permanently disabled clocks.
--

--- Patch [5]: [PATCH v13 05/11] clk: realtek: Add support for phase locked loops (PLLs) ---
commit e50b49e7f53401294ef59626cc76a96ba5a0781e
Author: Cheng-Yu Lee <cylee12@realtek.com>

clk: realtek: Add support for phase locked loops (PLLs)

This commit provides a full set of PLL operations for programmable PLLs and a
read-only variant for fixed or hardware-managed PLLs.

> diff --git a/drivers/clk/realtek/clk-pll.c b/drivers/clk/realtek/clk-pll.c
> new file mode 100644
> index 0000000000000..31670b8316cd5
> --- /dev/null
> +++ b/drivers/clk/realtek/clk-pll.c

[ ... ]

> +static bool is_power_on(struct rtk_clk_regmap_pll *clkp)
> +{
> +	u32 val;
> +
> +	/* reg == 0 means not configured (assume always on).
> +	 * Register offset 0 is never a valid address on Realtek SoCs.
> +	 */
> +	if (!clkp->power_reg)
> +		return true;

[Severity: High]
Could this result in a permanently disabled clock for write-only PLLs?

If a PLL is configured with power-on and power-off sequences but lacks a power
status register (power_reg == 0), is_power_on() will always return true.

[ ... ]

> +static void rtk_clk_regmap_pll_disable(struct clk_hw *hw)
> +{
> +	struct rtk_clk_regmap_pll *clkp = to_rtk_clk_regmap_pll(hw);
> +	unsigned long flags;
> +
> +	if (!clkp->seq_power_off)
> +		return;
> +
> +	spin_lock_irqsave(&clkp->lock, flags);
> +
> +	regmap_multi_reg_write(clkp->clkr.regmap, clkp->seq_power_off,
> +			       clkp->num_seq_power_off);

If such a clock is disabled (e.g., by clk_disable_unused during init), this
power-off sequence will execute successfully.

[ ... ]

> +static int rtk_clk_regmap_pll_enable(struct clk_hw *hw)
> +{
> +	struct rtk_clk_regmap_pll *clkp = to_rtk_clk_regmap_pll(hw);
> +	unsigned long flags;
> +	int ret = 0;
> +
> +	if (!clkp->seq_power_on)
> +		return ret;
> +
> +	spin_lock_irqsave(&clkp->lock, flags);
> +
> +	if (is_power_on(clkp))
> +		goto unlock;
> +
> +	ret = regmap_multi_reg_write(clkp->clkr.regmap, clkp->seq_power_on,
> +				     clkp->num_seq_power_on);

However, a subsequent call to rtk_clk_regmap_pll_enable() will hit the
is_power_on() check above, returning true and jumping to unlock before the
power-on sequence can be written.

Does this cause the clock to remain silently disabled in hardware, while the
clock framework considers it enabled?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260812020009.3480538-1-eleanor.lin@realtek.com?part=5

  reply	other threads:[~2026-08-12  2:11 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-12  1:59 [PATCH v13 00/11] clk / reset: realtek: Add RTD1625 clock and reset support Yu-Chun Lin
2026-08-12  1:59 ` [PATCH v13 01/11] dt-bindings: clock: Add Realtek RTD1625 Clock & Reset Controller Yu-Chun Lin
2026-08-12  2:00 ` [PATCH v13 02/11] reset: Add Realtek basic reset support Yu-Chun Lin
2026-08-12  2:00 ` [PATCH v13 03/11] reset: realtek: Add RTD1625 reset controller driver Yu-Chun Lin
2026-08-12  2:10   ` sashiko-bot
2026-08-12  2:00 ` [PATCH v13 04/11] clk: realtek: Introduce common probe() and remove() Yu-Chun Lin
2026-08-12  2:08   ` sashiko-bot
2026-08-12  2:00 ` [PATCH v13 05/11] clk: realtek: Add support for phase locked loops (PLLs) Yu-Chun Lin
2026-08-12  2:11   ` sashiko-bot [this message]
2026-08-12  2:00 ` [PATCH v13 06/11] clk: realtek: Add support for gate clock Yu-Chun Lin
2026-08-12  2:00 ` [PATCH v13 07/11] clk: realtek: Add support for mux clock Yu-Chun Lin
2026-08-12  2:00 ` [PATCH v13 08/11] clk: realtek: Add support for MMC-tuned PLL clocks Yu-Chun Lin
2026-08-12  2:00 ` [PATCH v13 09/11] clk: realtek: Add RTD1625-CRT clock controller driver Yu-Chun Lin
2026-08-12  2:16   ` sashiko-bot
2026-08-12  2:00 ` [PATCH v13 10/11] clk: realtek: Add RTD1625-ISO " Yu-Chun Lin
2026-08-12  2:18   ` sashiko-bot
2026-08-12  2:00 ` [PATCH v13 11/11] arm64: dts: realtek: Add clock support for RTD1625 Yu-Chun Lin

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=20260812021115.7DCFC1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=eleanor.lin@realtek.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox