The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: arouhi@sitime.com
Cc: jiri@resnulli.us, ivecera@redhat.com, vadim.fedorenko@linux.dev,
	arkadiusz.kubalewski@intel.com, kuba@kernel.org,
	pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, prabhakar.mahadev-lad.rj@bp.renesas.com,
	cjubran@nvidia.com, Oleg.Zadorozhnyi@devoxsoftware.com,
	netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v17 10/13] dpll: sit9531x: implement output pin state on a DPLL
Date: Thu, 03 Dec 2026 00:39:11 +0000	[thread overview]
Message-ID: <179625835133.3146.1308915527518454647@kernel.org> (raw)
In-Reply-To: <20261201235202.97645-11-arouhi@sitime.com>

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

Critical: 0 · High: 0 · Medium: 2 · 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 mute state is decided without looking at which CMOS
  pads ODRn_MISC0 actually enables.
- [Medium] sit9531x_resume() keeps or re-takes an output's pre-mute Hi-Z
  record based on the cached out->enabled (`if (rc || (!enabled &&…
- [Low] sit9531x_dpll_output_pin_state_on_dpll_set() returns a bare
  -EINVAL for any state other than CONNECTED or DISCONNECTED, with no…

--

dpll: sit9531x: implement output pin state on a DPLL

This patch adds state_on_dpll_get/set for sit9531x output pins and starts
registering output pins. An output is muted by forcing its slot's Hi-Z
pairs. The configuration's Hi-Z overrides are recorded at probe and put
back on unmute. The patch also folds the Page 3 debug key open/close into
common helpers that the poll and removal paths retry.

> diff --git a/drivers/dpll/sit9531x/core.c b/drivers/dpll/sit9531x/core.c
> index bce58b3371130..3316e3761e16d 100644
> --- a/drivers/dpll/sit9531x/core.c
> +++ b/drivers/dpll/sit9531x/core.c

[ ... ]

> @@ -439,14 +440,16 @@ static int sit9531x_hiz_pair_forced(struct sit9531x_dev *sitdev,
>  static int sit9531x_output_forced_hiz(struct sit9531x_dev *sitdev,
>  				      u8 out_idx, bool *muted, bool *part)
>  {
> +	const struct sit9531x_out *out = &sitdev->out[out_idx];
>  	struct sit9531x_hiz_pair p[SIT9531X_HIZ_PAIRS];
>  	bool pad_p, pad_n;
> +	u8 keep;
>  	int rc;

[ ... ]

> @@ -457,44 +460,91 @@ static int sit9531x_output_forced_hiz(struct sit9531x_dev *sitdev,
>  	if (rc)
>  		return rc;
>  
> +	/* A pad the loaded configuration forces is not a part mute */
> +	keep = out->hiz_mask & ~out->hiz_state;
>  	*muted = pad_p && pad_n;
> -	*part = pad_p != pad_n;
> +	*part = pad_p != pad_n &&
> +		!(keep & BIT(pad_p ? SIT9531X_HIZ_CMOS_P :
> +				     SIT9531X_HIZ_CMOS_N));

[Severity: Medium]
Can a CMOS output that uses only one pad be reported CONNECTED while that
pad is tri-stated?

sit9531x_output_mode_fetch() merges the two pad enables into one bool:

    sitdev->out[out_idx].cmos = !!(val & (SIT9531X_OUT_CMOS_ENP |
                                          SIT9531X_OUT_CMOS_ENN));

regs.h documents a single-pad CMOS mode ("Either set: single-ended (one
pad, or both as CMOS)"). Here, muted needs both pads forced. So an output
with ENP=1 and ENN=0 whose OutP pair is forced (MASK=1, STATE=0) gets
muted=false.

sit9531x_out_state_fetch() then sees the output as not muted and records
the OutP MASK bit in hiz_mask as a configuration force. keep then covers
OutP, so part is false too.

As a result, a CONNECTED request takes the early return in
sit9531x_dpll_output_pin_state_on_dpll_set():

    if (!sit9531x_output_state_refresh(sitdev, dpin->id) &&
        sitdev->out[dpin->id].enabled == enable &&
        !sitdev->out[dpin->id].part_muted) {

A DISCONNECTED->CONNECTED cycle does not help either. On unmute,
sit9531x_output_hiz_write() writes the recorded force back onto OutP. Is
there any way to make such an output drive through the DPLL API?

An external tool that tri-states only the used pad can leave the output in
this state. So can this driver's own mute: if the CMOS_N write fails, the
undo of CMOS_P also fails ("Hi-Z override left part applied"), and the
driver is then rebound.

Could ENP and ENN be tracked separately, so that muted is decided from the
pads that are actually enabled?

sit9531x_output_mode_fetch() and sit9531x_output_forced_hiz() look the same
at the end of the series, in "dpll: sit9531x: model the inter-PLL sync line
as a pair of pins".

[ ... ]

> @@ -3771,17 +3991,26 @@ static int sit9531x_resume(struct device *dev)
>  	sit9531x_ref_pll_mask_rebuild(sitdev);
>  	for (i = 0; i < sitdev->info->num_outputs; i++) {
>  		struct sit9531x_out *out = &sitdev->out[i];
> +		u8 hiz_mask = out->hiz_mask, hiz_state = out->hiz_state;
> +		bool enabled = out->enabled;
>  		bool routed = out->routed;
>  		u8 pll_idx = out->pll_idx;
>  
>  		rc = sit9531x_out_state_fetch(sitdev, i);
> -		if (rc)
> +		/* A muted output keeps the Hi-Z record taken before the mute */
> +		if (rc || (!enabled && !out->enabled)) {
> +			out->hiz_mask = hiz_mask;
> +			out->hiz_state = hiz_state;
> +		}

[Severity: Medium]
Should this condition also check out->state_stale? enabled is the value
cached before suspend, and it can be stale.

sit9531x_output_disable() can write the Hi-Z pairs and then fail the
readback. In that case it only sets state_stale, and enabled stays true:

    } else {
        sitdev->out[index].state_stale = true;

The error path's __dpll_pin_change_ntf() can fail as well, or the poll may
not have refreshed the cache yet. sit9531x_suspend() then cancels the poll
with kthread_cancel_delayed_work_sync(), so the cache is still stale at
suspend.

On resume, enabled is the stale true, so this condition is false.
sit9531x_out_state_fetch() has already cleared hiz_mask and hiz_state. It
finds the output muted and skips the MASK bit of every pair with STATE
clear:

    if (state_val & BIT(p[i].bit))
        out->hiz_state |= BIT(i);
    else if (muted)
        continue;

That drops the pre-mute record, including the bit for a pad the
configuration forced, such as one OutN pad of a two-pad CMOS output. Would
the next unmute through sit9531x_output_hiz_write() then release and drive
that pad?

If __dpll_pin_change_ntf() succeeds, the state_on_dpll_get callback
refreshes the stale state while the message is built. So the window is
limited to the failed or not yet retried notification path.

The final version of sit9531x_resume() in the series seems to keep this. It
computes outs_unread from state_stale but still uses
"!(outs_was & BIT(i)) && !out->enabled" as the restore condition.

[ ... ]

> diff --git a/drivers/dpll/sit9531x/dpll.c b/drivers/dpll/sit9531x/dpll.c
> index 25bee483bb5a7..b0403c0bc1320 100644
> --- a/drivers/dpll/sit9531x/dpll.c
> +++ b/drivers/dpll/sit9531x/dpll.c

[ ... ]

> @@ -676,8 +679,112 @@ sit9531x_dpll_output_pin_frequency_set(const struct dpll_pin *pin,

[ ... ]

> +static int
> +sit9531x_dpll_output_pin_state_on_dpll_set(const struct dpll_pin *pin,
> +					   void *pin_priv,
> +					   const struct dpll_device *dpll,
> +					   void *dpll_priv,
> +					   enum dpll_pin_state state,
> +					   struct netlink_ext_ack *extack)
> +{

[ ... ]

> +	/* An output is routed explicitly, not a selection candidate */
> +	if (!enable && state != DPLL_PIN_STATE_DISCONNECTED)
> +		return -EINVAL;

[Severity: Low]
This isn't a functional problem, but could this refusal set an extack
message? The DPLL netlink policy passes SELECTABLE through to the driver,
and userspace gets a bare -EINVAL here.

The INTSYNC source pin callback, added later in the series in "dpll:
sit9531x: model the inter-PLL sync line as a pair of pins", explains the
same refusal:

    NL_SET_ERR_MSG(extack,
                   "A PLL drives INTSYNC or not; use connected or disconnected");

The input pins also explain why they refuse CONNECTED ("Device selects its
reference by priority; use selectable").

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201235202.97645-1-arouhi%40sitime.com

  reply	other threads:[~2026-12-03  0:39 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 23:52 [PATCH net-next v17 00/13] dpll: add SiTime SiT9531x DPLL clock driver Ali Rouhi
2026-12-01 23:52 ` [PATCH net-next v17 01/13] dpll: omit pin phase attributes the driver has no value for Ali Rouhi
2026-12-01 23:52 ` [PATCH net-next v17 02/13] dt-bindings: vendor-prefixes: add SiTime Corporation Ali Rouhi
2026-12-01 23:52 ` [PATCH net-next v17 04/13] dpll: add basic SiTime SiT9531x support Ali Rouhi
2026-12-03  0:39   ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 03/13] dt-bindings: dpll: add SiTime SiT95316 clock generator Ali Rouhi
2026-12-03  0:39   ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 06/13] dpll: sit9531x: register DPLL devices and pins Ali Rouhi
2026-12-03  0:39   ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 05/13] dpll: sit9531x: read DPLL types and pin properties from system firmware Ali Rouhi
2026-12-03  0:39   ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 08/13] dpll: sit9531x: add support to get and set priority on input pins Ali Rouhi
2026-12-03  0:39   ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 07/13] dpll: sit9531x: implement input pin state on a DPLL Ali Rouhi
2026-12-03  0:39   ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 10/13] dpll: sit9531x: implement output " Ali Rouhi
2026-12-03  0:39   ` netdev-bot+sashiko [this message]
2026-12-01 23:52 ` [PATCH net-next v17 09/13] dpll: sit9531x: add support to get and set frequency on pins Ali Rouhi
2026-12-03  0:39   ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 11/13] dpll: sit9531x: add support to adjust output phase Ali Rouhi
2026-12-03  0:39   ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 12/13] dpll: sit9531x: add support to get phase offset on the connected input Ali Rouhi
2026-12-03  0:39   ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 13/13] dpll: sit9531x: model the inter-PLL sync line as a pair of pins Ali Rouhi
2026-12-03  0:39   ` netdev-bot+sashiko

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=179625835133.3146.1308915527518454647@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=Oleg.Zadorozhnyi@devoxsoftware.com \
    --cc=arkadiusz.kubalewski@intel.com \
    --cc=arouhi@sitime.com \
    --cc=cjubran@nvidia.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=ivecera@redhat.com \
    --cc=jiri@resnulli.us \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=robh@kernel.org \
    --cc=vadim.fedorenko@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