🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #21412

Re: [PATCH net-next v16 12/13] dpll: sit9531x: add support to get phase offset on the connected input

#21412
From: netdev-bot+sashiko
Date: Tue, 24 Nov 2026 00:40
166 lines
13926 bytes
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 2

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] sit9531x_phase_offset_read() (drivers/dpll/sit9531x/core.c)
  turns the TDC code into picoseconds by dividing by the Fvco that…
- [Low] The commit message says "The offset is sampled when asked for,
  not by the poll: a sample is several dozen transfers per PLL." That is…
- [Low] The patch adds `sitdev->chan[pll_idx].key_pending = !!lock_rc;`
  to the existing helper sit9531x_chan_routed_ref_read()…

--

dpll: sit9531x: add support to get phase offset on the connected input

This adds a phase_offset_get callback to the sit9531x input pins. It reads
the PLL's on-chip TDC through the debug window and converts the code to
picoseconds using the PLL's Fvco. The debug taps are saved and restored
around each sample, and a failed restore or relock is retried by the
poll, at removal and on the probe failure path.

> The offset is sampled when asked for, not by the poll: a sample is
> several dozen transfers per PLL.

[Severity: Low]
Is this accurate for notifications?

The poll worker calls sit9531x_dpll_changes_check(). That function calls
dpll_pin_change_ntf() for every selection pin whose state, operstate or
prio changed. The core then builds the full pin message for that
notification:

sit9531x_dpll_changes_check()
  dpll_pin_change_ntf()
    dpll_pin_event_send()
      dpll_cmd_pin_get_one()
        dpll_msg_add_phase_offset()
          sit9531x_dpll_input_pin_phase_offset_get()

So when the poll notifies the active input of a PLL (for example, the new
reference after a switch), the poll worker does two input monitor
fetches, two routed reference reads and a full TDC sample. A failure there
can also set tap_pending or key_pending from the poll.

This only happens on change notifications, not on every poll tick. The
callback also maps errors to -ENODATA, so the notification still goes
out. Could the commit message be reworded to say this?

> diff --git a/drivers/dpll/sit9531x/core.c b/drivers/dpll/sit9531x/core.c
> index fd8f0df9116d6..5ec9d2a48fcbf 100644
> --- a/drivers/dpll/sit9531x/core.c
> +++ b/drivers/dpll/sit9531x/core.c

[ ... ]

> @@ -2594,6 +2620,176 @@ static int sit9531x_clear_notifications(struct sit9531x_dev *sitdev)
>  	return 0;
>  }
>  
> +/**
> + * sit9531x_phase_offset_read - read phase difference via TDC

[ ... ]

> +int sit9531x_phase_offset_read(struct sit9531x_dev *sitdev, u8 pll_idx,
> +			       s64 *phase_offset)
> +{

[ ... ]

> +	/*
> +	 * Read Fvco first; without it there is no reason to open the debug
> +	 * window.
> +	 */
> +	rc = sit9531x_get_fvco(sitdev, pll_idx, &fvco);
> +	if (rc) {
> +		if (rc == -ENODATA)
> +			dev_dbg(sitdev->dev,
> +				"PLL%c: Fvco unknown, skip TDC\n",
> +				'A' + pll_idx);
> +		return rc;
> +	}

[Severity: Medium]
Is an out-of-band Fvco safe to use here?

sit9531x_get_fvco() returns 0 even when Fref * DIVN falls outside the
PLL's VCO band. It only warns once:

drivers/dpll/sit9531x/core.c:sit9531x_get_fvco() {
    ...
	/*
	 * 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))) {
    ...
	return 0;
}

This value has two other users, sit9531x_output_divo_calc() and
sit9531x_output_phase_adjust_set(). Both return -EINVAL when
sit9531x_fvco_in_band() fails ("rate not settable" and "delay not
settable").

This function only checks rc, and then divides the TDC code by that Fvco:

	mag = mul_u64_u64_div_u64(tdc_signed < 0 ? -tdc_signed : tdc_signed,
				  1000000000000ULL * DPLL_PHASE_OFFSET_DIVIDER,
				  fvco);

The "one code is 203.45 ps at 4.9152 GHz" comment suggests one TDC code is
one period of the real VCO. If so, wouldn't the reported phase offset be
off by the ratio of the computed VCO rate to the real one?
sit9531x_dpll_input_pin_phase_offset_get() would then return 0, and user
space would receive the wrong value as a valid attribute.

Should this return -ENODATA when sit9531x_fvco_in_band() fails, so the
attribute is left out?

[ ... ]

> @@ -2768,6 +2972,7 @@ static int sit9531x_chan_routed_ref_read(struct sit9531x_dev *sitdev,
>  	lock_rc = sit9531x_write_pll_close(sitdev, pll_idx,
>  					   SIT9531X_PLL_REG_DEBUG,
>  					   SIT9531X_PLL_DEBUG_LOCK);
> +	sitdev->chan[pll_idx].key_pending = !!lock_rc;
>  
>  	return rc ? rc : lock_rc;
>  }

[Severity: Low]
This line also changes the existing poll path.
sit9531x_chan_routed_ref_read() runs from sit9531x_chan_state_fetch() on
every poll and at probe, so a failed relock there now sets key_pending.

The next poll's sit9531x_tap_back_retry() then retries it. At removal,
sit9531x_tap_pending_retry() warns "left with its debug taps moved or
window open". Before this patch, that relock failure was never retried.

The retry itself looks reasonable, but the documentation only describes
the phase-offset path. The kernel-doc in core.h says:

 * @key_pending: debug key not locked again after a phase-offset read or tap
 *   retry

The comment above sit9531x_tap_back_retry() says "after a failed
phase-offset read", and the commit message only mentions the taps moved
for a sample.

Could the kernel-doc, the sit9531x_tap_back_retry() comment and the
commit message also mention the routed reference read?

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261119225752.41846-1-arouhi%40sitime.com
Technical Details
Message-ID: <179548085403.3135.8775847073019311030@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369886-linux-kernel-netdev=dewy.ru
References: <20261119225752.41846-13-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!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369886-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v16 12/13] dpll: sit9531x: add support to get
 phase offset on the connected input
Date: Tue, 24 Nov 2026 00:40:54 +0000
Organization: Usenet Network
Message-ID: <179548085403.3135.8775847073019311030@kernel.org>
References: <20261119225752.41846-13-arouhi@sitime.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="4017988"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:CJRZ8eXGwoHKLTQJh3CW9gugKtE= sha256:vihqUcj2q5kFn4iMB6FNpljGHUEfaWDWT2SnfRdZ664=
	sha1:2dTqGB5UONYZEKDXVWRef8H+iJk= sha256:rBx41ZzsTqJg48AMS+AN1Zwawb6w5cCngLTBEib8Vuc=
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 E8186125DC8; Tue, 24 Nov 2026 03:41:36 +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 SMWuUvxgSk7K;
	Tue, 24 Nov 2026 03:41:33 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-369886-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 45BDC125DCB; Tue, 24 Nov 2026 03:41:24 +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 63158605D19; Tue, 24 Nov 2026 00:41:24 +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=1795480861;
	b=SXvPs3Z+vHhu3bSipMgs8Y/f/7IGQg1WIEVvuWhxTGUcksRU9DSXYmdKPF98B+f/Zl1T
	 0xEuPo+bde65THueeR4YS3Mq+TqWKJDpyrsUv7EwYJ6UxtXiyyaYVU7okz4mZkMK5kVnc
	 2x2QKrABz9U/G227JCLirZOdXWwGRo+DzV47kShZzglQdBQuDVU1nWhIItVg0XxTT7q0g
	 eT78Hc8oKizljoHdAfthxuaxzjeJakGKYr/N8XFsS1Yggf/FAzxeQER5JPl0eMoqm3Coc
	 SnE0oFSn+bCxVa7GWb9UTXbijSJVale8kKintumR4WbyvS2YyA/xweNJm7UKa8dmZcg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795480861;
	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=Zsurr0ZpZlgGnVVv3AAABEZKR1DCTB8SdUlRsUevkb8=;
	b=0FImiWQwnVxttBzLs3LlWP/zUgmAc9sVC7g2XCQFMKMZAe2eXdAmyNEpyMRIteZD/aBn
	 t/MkJGHKhpfu0AeO2DI0ueMNaJ8v5oKCwKQffQampixg6aJexKQYXMg+Ao6ILydJK5jEU
	 F8Bgd6R38+0YsM/ogNlQyJ+ov/uTOt8eHApUFXWiIdnKnNs2yTkP3JrfD2/z1k+GhSlwe
	 BSlQ2Jaq4LnHIPhpik43kY4SX1+kthsxnIjqmpf9C2AgG6AUeZPEtkrScE1FWyUvmDnVk
	 RWh+VNF+rXAMiVhL+h5Js4Saj9L1V0kkoTQhkGqQFh2G4DLWaXfFemdp7PjPeTN+3GA==
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=jqKnDUWz;
	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 84D8060A383D;
	Tue, 24 Nov 2026 00:41:01 +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=jqKnDUWz
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=1795480855;
	b=Sv1OFaPV8PysJDFZ9DypmY9f7ckpWeo6kbVkYpZ/CBuNXcJLM3zWrX5N1J6YE2FI7JXS
	 hFX/l0Z6wAkHZJkKXtwX7OxiW1J4cIV8b5jDEGpOLXtZ9VyoylBz6XXkSIU/Ah1FPj8wQ
	 qKr7TplHQONIdZPWNutMAjswRfaCn8+8nZ/0bQ3qvgCc2I7MKGugKr5uh2fVRqJQMEYrD
	 7o2RtOQg8uGItQqnqiQcUTy281Pj4smqLkWjYWE4fHQhCzDjkGGIGVCKULT1xFq3/eRQ4
	 7e0zxXQk5hVmU19twraH+idhs6oX1nX6Fx8OZMQDExgj55L/Gq0c63lT3a7xR1hL9rQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795480855;
	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=Zsurr0ZpZlgGnVVv3AAABEZKR1DCTB8SdUlRsUevkb8=;
	b=ib4am5D/WS7LxFjLQ4Hpnu/SHK3NiSyT35muDg8eeVPAQrd/d/54TZy+5CfxTRGQJPGk
	 O7E24nFbTcDSUopBQjpd+VcVzp3sqnJ+HotAB1EzCt3+sS+WNLuH2T6GNy/O6KueEkdbU
	 G1uDIOb9sDqfFVMZego0V1i+xcib/5MWldjGi/kwm0gpByOAIHWW8LlKESAv/QdzUt+La
	 /WwJtLiplkByqMm5EaBdp6s7OCEqP8oGq6m92b3Z1ms8TS6CRSmlkDFzA4g+p/N96/Xq+
	 7yL4+C+lb+yIDcMqR8lob8Ya/q5XgblHWWsLKoKajY1Mdsu86b81+a+QnPxqHWAqUPA==
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=jqKnDUWz;
	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 A4CC0606A32A;
	Tue, 24 Nov 2026 00:40:55 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FCE91F000E6;
	Tue, 24 Nov 2026 00:40:54 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795480855;
	bh=Zsurr0ZpZlgGnVVv3AAABEZKR1DCTB8SdUlRsUevkb8=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=jqKnDUWz5KVsMxN66vWZ+pITXdTtOD50GM31Bv0qAkzO+/MzfaZc2xEptNmNPvb14
	 6sXqdF2jHQgSqEIAXz1BGWMfc3V/7eZkx8lC4h79MJzGcyUFcWQxojlLpUSzA56udq
	 9nayzBw3O+y8es15bjdtlgdjpYeaWkfT89R8yPiTV1YQmm0K/tKcD9s+bnMdDcHiRD
	 mlp70RDH22a83cd/tV1gTU3Nmg7DZtQORmDEiXZr+85c8rVd0hbeCmnqNv6Eg0LtDK
	 HZqMP/vc26D/hMIdS1oDlH8vClKaBoOsMqujpNuuZcsKW7PzFV3mbEOTLadSPFybmm
	 m697RGn8zv05g==
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-13-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