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/2026…%40sitime.com