Article View: linux.kernel.netdev
Article #21408Re: [PATCH net-next v16 09/13] dpll: sit9531x: add support to get and set frequency on pins
From: netdev-bot+sashiko
Date: Tue, 24 Nov 2026 00:40
Date: Tue, 24 Nov 2026 00:40
267 lines
17865 bytes
17865 bytes
Thank you for your contribution! Sashiko AI review found 6 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 5 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The output frequency getter reports Fvco/DIVO even when the
driver itself says that Fvco is not the PLL's real rate.
- [Medium] The loops_open retry sends the loop-lock command with the Page
3 debug key locked.
- [Medium] The reported output frequency can fall outside the frequency
range the pin advertises.
- [Medium] In sit9531x_output_phase_flush(), the register-triggered phase
flush is documented in regs.h as 'DIVO_PHASE_SEL_REG selects the…
- [Medium] dpll: sit9531x: unretried NVM update in sit9531x_prg_commit()
on error
- [Low] The patch deletes the inline comments on struct sit9531x_dev's
two mutexes ('/* Serializes multi-step register sequences */' above…
--
dpll: sit9531x: add support to get and set frequency on pins
This patch reports an input pin's frequency from the firmware description
and an output pin's frequency as Fvco / DIVO. It sets an output's
frequency by writing a new DIVO inside the programming state. The write
is followed by a loop lock, a settling delay and a per-PLL phase flush.
> diff --git a/drivers/dpll/sit9531x/core.c b/drivers/dpll/sit9531x/core.c
> index bbc17a514c5ce..d3f6955b3bbd0 100644
> --- a/drivers/dpll/sit9531x/core.c
> +++ b/drivers/dpll/sit9531x/core.c
[ ... ]
> @@ -1139,6 +1239,504 @@ int sit9531x_input_prio_add(struct sit9531x_dev *sitdev, u8 pll_idx,
>
> #define SIT9531X_DIVO_MAX GENMASK_ULL(33, 0)
>
[ ... ]
> + /*
> + * Outside the PLL's VCO band, Fref * DIVN is usually not the rate the
> + * PLL runs at, as for a PLL fed from another PLL.
> + */
> + if (!sit9531x_fvco_in_band(pll_idx, *fvco) &&
> + !(sitdev->fvco_band_warned & BIT(pll_idx))) {
> + sitdev->fvco_band_warned |= BIT(pll_idx);
> + dev_warn(sitdev->dev,
> + "PLL%c: Fref * DIVN = %llu Hz is outside its VCO band\n",
> + 'A' + pll_idx, *fvco);
> + }
> +
> + return 0;
> +}
[Severity: Medium]
If Fref * DIVN is above the low-band minimum but outside this PLL's own
band, sit9531x_get_fvco() warns once and still returns 0. The comment
above says such a value is usually not the rate the PLL runs at.
For that PLL, sit9531x_output_freq_get() then reports and caches
div64_u64(fvco, divo). sit9531x_output_divo_calc() rejects the same
Fvco:
if (!sit9531x_fvco_in_band(pll_idx, fvco)) {
dev_dbg(sitdev->dev,
"out%u: PLL%c Fvco %llu Hz is outside its VCO band, rate not settable\n",
...
return -EINVAL;
}
So would a cascaded PLL report a nonzero DPLL_A_PIN_FREQUENCY that the
driver itself treats as wrong?
The commit message says "An output whose divider chain does not resolve
reports 0 Hz". Should sit9531x_output_freq_get() apply the same band
check and return -ENODATA?
The later patch "dpll: sit9531x: add support to adjust output phase"
adds the comment "Fref * DIVN outside the VCO band is not the rate the
PLL runs at" in sit9531x_output_phase_adjust_set(). Even so,
sit9531x_output_freq_get() still has no band check at the end of the
series.
[ ... ]
> + orig = ctrl & ~SIT9531X_DIVO_PHASE_TRIG;
> + ctrl = orig | SIT9531X_DIVO_PHASE_SEL_REG;
> + rc = sit9531x_write_u8(sitdev, SIT9531X_REG_GPIO_FUNC_CTRL1, ctrl);
> + if (rc)
> + goto restore;
> +
> + /*
> + * No delay between set and clear; one I2C transfer is longer than the
> + * minimum pulse width.
> + */
> + rc = sit9531x_write_u8(sitdev, SIT9531X_REG_GPIO_FUNC_CTRL1,
> + ctrl | SIT9531X_DIVO_PHASE_TRIG);
> +
> +restore:
> + ret = sit9531x_write_u8(sitdev, SIT9531X_REG_GPIO_FUNC_CTRL1, orig);
> + if (ret && !rc)
> + rc = ret;
[Severity: Medium]
regs.h describes the flush as "DIVO_PHASE_SEL_REG selects the register
trigger; pulsing DIVO_PHASE_TRIG high then low flushes".
Here, the final write of orig clears DIVO_PHASE_TRIG and restores
DIVO_PHASE_SEL_REG in the same transfer. Suppose the profile had the pin
trigger selected, so SEL_REG is clear in orig. Then the register
trigger's high-to-low transition happens at the same moment the mux
switches back to the external pin.
If the flush acts on the falling edge, can the flush be missed while
sit9531x_output_freq_set() still reports success? Would it help to write
ctrl (SEL_REG set, TRIG clear) before restoring orig?
The same ordering is still there at the end of the series in
sit9531x_phase_flush_undo(), which writes the original ctrl straight
after the TRIG-high write.
[ ... ]
> + rc = sit9531x_get_fvco(sitdev, pll_idx, &fvco);
> + if (!rc)
> + rc = sit9531x_output_divo_read(sitdev, out_idx, &divo);
> + if (rc) {
> + if (rc == -ENODATA)
> + sitdev->out[out_idx].freq = 0;
> + return rc;
> + }
> +
> + *frequency = div64_u64(fvco, divo);
> + sitdev->out[out_idx].freq = *frequency;
[Severity: Medium]
Suppose the UPDATE_NVM write fails here but one of the LOOP_LOCK
attempts that follow succeeds. sitdev->loops_open then ends up false,
and nothing records that the bank update was never issued. Neither the
retry in sit9531x_dev_chan_states_update() nor the one in
sit9531x_dev_stop() will run, since both key on loops_open.
sit9531x_output_freq_set() returns the error, but the five DIVO bytes
from sit9531x_output_divo_write() stay in the registers. The back flag
that sit9531x_output_divo_write() fills in is never checked.
On that error, sit9531x_dpll_output_pin_frequency_set() calls
sit9531x_output_freq_get(). That reads the new DIVO bytes back through
sit9531x_output_divo_read() and caches Fvco / DIVO in
sitdev->out[].freq. If the result differs from the old value, the
setter then sends __dpll_pin_change_ntf().
If the divider only takes effect once UPDATE_NVM is written, user space
gets an error together with a notification for a rate the part is not
running. The cached freq follows the uncommitted register contents
rather than the hardware.
Should a failed UPDATE_NVM be tracked as pending and retried by the
poll worker? Or should sit9531x_output_freq_set() restore the old DIVO
bytes before it closes the programming state?
At the end of the series the retry path is sit9531x_prg_relock(), which
does not repeat the bank update either.
[Severity: Medium]
Can this value fall outside the range the pin advertises? For an output
without supported-frequencies-hz, sit9531x_pin_props_get() advertises:
ranges[j].min = 1;
ranges[j].max = 1000000000ULL; /* 1 GHz */
Fvco is at least SIT9531X_FVCO_LOWBAND_MIN (4.9152 GHz). A profile with
DIVO of 4 or less therefore gives a reported frequency above 1 GHz. When
there is a DT list, the truncated Fvco / DIVO also need not match any
listed value.
dpll_pin_freq_set() in the core calls dpll_pin_is_freq_supported() before
its freq == old_freq shortcut. Writing back the value just read would
then fail with "frequency is not supported by the device". Is that
intended?
The 1 GHz cap is unchanged at the end of the series.
[ ... ]
> @@ -1845,6 +2443,10 @@ sit9531x_dev_chan_states_update(struct sit9531x_dev *sitdev)
> bool answered = false;
> int i, rc;
>
> + /* Retry pending writes first so the reads below see their result */
> + if (sitdev->loops_open)
> + sit9531x_prg_commit(sitdev);
> +
> sit9531x_input_off_retry(sitdev);
[Severity: Medium]
Does this retry run with the Page 3 debug key locked?
When every LOOP_LOCK attempt fails, sit9531x_prg_commit() sets
loops_open but still relocks the key at the end:
sitdev->loops_open = !!rc2;
msleep(100);
...
rc3 = sit9531x_write_close(sitdev, SIT9531X_REG_OUTSYS_DEBUG,
SIT9531X_DEBUG_LOCK_VAL);
This retry calls sit9531x_prg_commit() directly, and so does the one in
sit9531x_dev_stop(). Neither does the unlock that sit9531x_prg_enter()
performs before every other PRG_DIR_GEN write:
rc = sit9531x_write_u8(sitdev, SIT9531X_REG_OUTSYS_DEBUG,
SIT9531X_DEBUG_UNLOCK_VAL);
If PRG_DIR_GEN commands only take effect while the key is unlocked, the
LOOP_LOCK write would be ACKed but have no effect, and loops_open would
be cleared anyway. sit9531x_dev_stop() would then skip its "output loops
left unlocked at removal" warning, and later readers of loops_open would
treat the loops as closed.
This retry also sends UPDATE_NVM again, outside the PRG_CMD sequence.
The later patch "dpll: sit9531x: implement output pin state on a DPLL"
changes the retry to sit9531x_prg_relock(), which drops the UPDATE_NVM.
It still writes LOOP_LOCK without opening the debug window, though.
[ ... ]
> diff --git a/drivers/dpll/sit9531x/core.h b/drivers/dpll/sit9531x/core.h
> index 57ba682b07a93..669f9f9b960c3 100644
> --- a/drivers/dpll/sit9531x/core.h
> +++ b/drivers/dpll/sit9531x/core.h
[ ... ]
> struct sit9531x_dev {
> struct device *dev;
> struct i2c_client *client;
> struct regmap *regmap;
> const struct sit9531x_chip_info *info;
> - /* Serializes multi-step register sequences */
> struct mutex multiop_lock;
> - /* Serializes a page select and the transfer it is for */
> struct mutex page_lock;
[Severity: Low]
This isn't a bug, but removing these two comments looks unrelated to
frequency get/set, and the commit message doesn't mention it.
The block comment above the struct is not kernel-doc, so checkpatch
--strict will report "struct mutex definition without comment" for both
locks. The comments are still missing at the end of the series.
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261119225752.41846-1-arouhi%40sitime.com
Technical Details
Message-ID:
<179548085020.3135.4311909833990050378@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369884-linux-kernel-netdev=dewy.ruReferences:
<20261119225752.41846-10-arouhi@sitime.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369884-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v16 09/13] dpll: sit9531x: add support to get and set frequency on pins Date: Tue, 24 Nov 2026 00:40:50 +0000 Organization: Usenet Network Message-ID: <179548085020.3135.4311909833990050378@kernel.org> References: <20261119225752.41846-10-arouhi@sitime.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="4017778"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:cdhcoCuHjDoWRc2tkwKAu8pthIY= sha256:wsUoHkwuaXJt7k83ssQyPM+8hb2SQs3QDUdTN92ZcyY= sha1:I6JYe76+qdm1hsWtO3ZBj/L4zSg= sha256:QcvjurCCDqKF9XWO5wQc/F8ka6j1oVStCkLAwrTaV2k= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 109C2125DCB; Tue, 24 Nov 2026 03:41:21 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.5 X-Spam-Status: No, score=-3.5 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id q8LJjZuhcSxD; Tue, 24 Nov 2026 03:41:17 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-369884-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 37503125DCA; Tue, 24 Nov 2026 03:41:07 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 82E3A6048EE; Tue, 24 Nov 2026 00:41:06 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795480852; b=SjK7MyyA7VYtR1O+HTY6Q2S56eGhd0GyPCfeHgCfXhl61cX3ql0iVDtuMeTke6M4kDbV 15XOYjUdHTgyOJfoD+L8K7PoWvMkoUBFLUmaYGQEGzuRUwM6QbSE81B434DHrml5tQC+a jDN0bDDyExqozoAgoAW6y3bOajMXPb+MGJbKSapBX3eaP0R4vbpw065kGMeq7ic4GrfKg WojYHkE8uUCK081lk9FjJFyUBvJhesNAdgol6QHbZ6io6kUsNa30ryxfRL6WXFxoSWN6P x7Y42aYq1dQkfsqkxE1QoqrLU8Gsk2e0C6q3A5WVzYmXPeL3zB6kafT9gpe06mU+gyA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795480852; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=Yhc3pZ2t7HV873THc33t0f85CY4X5Kt+iC5hAmBxKKM=; b=ctAFI8saFc4LStya6kbVHSaHZWsFZ9DE1gN1uFo5Cv21ZHZw81VqBe+Ylm+xJCWj6ViQ 1CepoGDHWwBG+2Z4G7jbKO2K6fvc3skwvdfjPOmxWwLaaEdb7zjqRsTPFVFebSeRrMMng 4WFstY3AbPXjpBVf15awj4mmqsQh6+hG+VyZa4a4OjU1xoR5S8UWyj00dZnMioIljRt+i TQ3u+/Bi+HS4hB+mbi0AUIDPuAvrDvMZCAYxyZ6cDNZGWDbM6jh12bRr0gt0CWwfcm47g A47IKK+m7S8N2BFq2yR4KrNbbrK0pZ2fa59iIO7yVArgF4acmfJrYxhO/CioUrcd6gQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=JVGRbwAw; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BBFE960A2605; Tue, 24 Nov 2026 00:40:52 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=JVGRbwAw X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795480851; b=vOYBfKGCgnPuy5VsLYJqk4kB8h/3MPNxkwl4r7NzfqTgv6FVNO4eeNEOH6UPJmF0xxER SZUTOrc/D7t8K7wqN+GaSzGz6BNuoYWcv0IvJav/A1plPCbg/xqHgEzz9jiKC0G2RsI5w LiOeoZxHYR4h5IIteLciz5H/OW6FpgyfFHswj9jHdXr+YZ7s5x4U4FW6+smFhPQWv9So2 EZ7/6zuBTEunmYkOSbFP18TWyhWdYeL+bX+wfN0efsrJCCH8VuG1qeklBV5/FNxSa4VgM bWF0gU/JPER0Fwoql6prilC7FK7q2Dvt3cYxuxZ/xK5iGc1JKHsTcb/Jch4E+zofzcQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795480851; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=Yhc3pZ2t7HV873THc33t0f85CY4X5Kt+iC5hAmBxKKM=; b=JS/10DnIFYmw9KgQk+L9V8uC+MJYdQcEtQxkUL4ezGrQJzsqTQV4AQMz1ibY7qJ+DdsF W82VWVzcWdIM88oxOT2urk6+s81PRPMI5NzR2tajhJZaRQ0qDo7utmOGHB9UsyPefLst0 Hb8XtLRFGx/N6pqlLjlzmO+Ji6dQ4iK/Ezb1ybkmqSA2dh5qhK/lWCEQTvu44nRj2/ZYw MZpfUhwfzBbIEJnlIkP5OE/cGhCACigOqmmuCJxNEm5hp1ot3Mffzra/copC9XjsucETj i+rUV6+n7HZ/9uN1QArRrbXIA/D5Vnyh4pcmFe7go4Y3YdyUFbzshC1bWpFnfwz9tSA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=JVGRbwAw; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD69E606A6BC; Tue, 24 Nov 2026 00:40:51 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id A107B1F000E6; Tue, 24 Nov 2026 00:40:50 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795480851; bh=Yhc3pZ2t7HV873THc33t0f85CY4X5Kt+iC5hAmBxKKM=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=JVGRbwAwm8uGAD12Z3TWzPudOxIlPI/dBTvuO/XRr1sbLRt6+p9RlwcjqmKBDM7kU 7pYHaNu9XOMOBuT2PP3meUg0gq8eDp1rjmwhPfeOkusMhmIAN0Iu2a2465kgZ9dq2A t2yV8Rz/Oa+QRguD56TeXwbym8ZgCLQLpaXI6rceRqvrVOYq0Ibublfz1rmxGo9OJm PJOT5yepxkT/fO05Kobwp+qcgdzulq39fT6HyuqOFKEUPOrdWFE1JE1rhFoqZLGIiQ Pin+ATZRh3NtgfFkig5DTp5sN8pcXViL3RcY6P0ViAxK9SfyGI5jwb63BUQtbHfkma +QQRQjeL5jb5w== X-Cc: jiri@resnulli.us, vadim.fedorenko@linux.dev, arkadiusz.kubalewski@intel.com, ivecera@redhat.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, cjubran@nvidia.com, Oleg.Zadorozhnyi@devoxsoftware.com, prabhakar.mahadev-lad.rj@bp.renesas.com, devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org X-In-Reply-To: <20261119225752.41846-10-arouhi@sitime.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list