Re: [PATCH net-next v15 10/13] dpll: sit9531x: implement output pin state on a DPLL
From: Ali Rouhi
Date: Thu Nov 19 2026 - 16:21:42 EST
On Mon, 16 Nov 2026 18:18:21 -0800, Jakub Kicinski wrote:
> > + rc = sit9531x_write_u8(sitdev, SIT9531X_REG_PRG_DIR_GEN,
> > + SIT9531X_PRG_CMD_STATE);
> > + if (rc) {
> > + sit9531x_prg_commit(sitdev);
> > + return rc;
> > + }
>
> [Severity: Medium]
> If the SIT9531X_PRG_CMD_STATE write fails, should this path really run the
> full sit9531x_prg_commit()?
>
> Before this patch, the failure path called sit9531x_prg_abort(). Its comment
> was "Close the loops and lock the debug block without committing".
> sit9531x_prg_commit() starts by writing to the same register that just
> failed:
>
> rc = sit9531x_write_u8(sitdev, SIT9531X_REG_PRG_DIR_GEN,
> SIT9531X_UPDATE_NVM);
>
> After that it retries LOOP_LOCK, rewrites sitdev->loops_open, sleeps 100 ms
> under multiop_lock and closes the debug key. Its return value is ignored
> here.
>
> So an entry that may never have reached PRG_CMD now sends an NVM shadow
> update. The comment above sit9531x_prg_commit() ("re-lock the loops after
> sit9531x_prg_enter()") does not seem to describe this case.
>
> This also changes how the existing caller sit9531x_output_freq_set() from
> the previous patch behaves on failure. The new sit9531x_output_enable() and
> sit9531x_output_disable() paths get the same behaviour. The commit message
> does not mention the change.
>
> Was this meant to be part of this patch, or should a commit-free abort stay
> on this path? The same call is still there at the end of the series.
Agreed, and already changed: a failed entry now only re-locks the loops
and closes the key, without the bank update. The bank update is written
once, by a frequency change whose divider was written.
> > + false);
> > + if (rc)
> > + return rc;
> > + }
> > + return 0;
> > + }
>
> [Severity: Medium]
> Does un-mute lose a Hi-Z force set by the loaded profile?
>
> This branch clears the MASK bit of all three pairs and restores nothing. The
> mute path saves mask[] and state[], but uses them only to roll back on
> error.
>
> The commit message says "an un-mute releases the force and the pads return
> to the loaded configuration". Take a CMOS output whose profile forces one
> pad and leaves the other driving (part_muted). Here the force on that pad
> is cleared too.
>
> sit9531x_dpll_output_pin_state_on_dpll_get() reports such an output as
> CONNECTED, which matches the core.h kernel-doc ("reported as driven").
> However, sit9531x_dpll_output_pin_state_on_dpll_set() skips a request only
> when part_muted is clear:
>
> if (!sit9531x_output_state_refresh(sitdev, dpin->id) &&
> sitdev->out[dpin->id].enabled == enable &&
> !sitdev->out[dpin->id].part_muted) {
>
> dpll_pin_state_set() in the DPLL core does not compare against the current
> state. So a request for CONNECTED, which GET already reports, still reaches
> sit9531x_output_enable(). That runs the 100 ms programming sequence and
> releases the pad the profile kept in Hi-Z. A mute followed by an un-mute
> ends the same way.
>
> Should the un-mute put back the profile's original force bits instead of
> always clearing them? This code is unchanged at the end of the series.
Agreed. The next revision records, at probe, the pad the loaded
configuration forces on an output it leaves driving, and an un-mute
releases only what the driver forced, so both sequences above end with
the pads as the configuration set them.
> > + if (rc)
> > + return rc;
> > +
> > + rc = sit9531x_output_hiz_write(sitdev, slot, true);
> > +
> > + ret = sit9531x_prg_commit(sitdev);
>
> [Severity: Low]
> This isn't a bug, but every mute and un-mute runs the full output-system
> programming sequence. That is debug unlock, PRG_CMD, UPDATE_NVM, LOOP_LOCK
> and a 100 ms sleep under multiop_lock.
>
> The commit message says this happens "inside the programming state". The
> previous patch describes the settling time of that state, and the comment
> in sit9531x_dpll_output_pin_state_on_dpll_set() documents the 100 ms
> loop-unlock window. So this is mostly covered already.
>
> Would it still be worth stating the cost explicitly in this commit message?
That cost is gone in the next revision: the force bits act when written,
so a mute or un-mute writes them under the debug key and nothing else.
> > + int rc = 0;
> > +
> > + mutex_lock(&sitdev->multiop_lock);
> > + out = sit9531x_out_state_get(sitdev, dpin->id);
> > + if (out->state_stale)
> > + rc = sit9531x_output_state_refresh(sitdev, dpin->id);
>
> [Severity: Low]
> Can this report an old mute state if the Hi-Z force bits are changed outside
> the driver?
>
> The hardware is read again here only when state_stale is set. The poll
> re-reads an output in sit9531x_dpll_output_ntf_pending() only when the
> driver itself has set ntf_pending:
>
> if (!out->ntf_pending)
> return false;
>
> Suppose a profile is reloaded, or the registers are written with an I2C
> tool, while the driver is bound. GET then keeps returning the old
> CONNECTED/DISCONNECTED value, and no pin change notification is sent.
>
> The input priority tables are handled differently: the poll picks up
> external rewrites. The output frequency and phase getters read the
> registers live. Later in the series the cache is refreshed on resume, but
> runtime polling still never refreshes it.
>
> Is that difference intended?
Intended. The poll reads what the part changes by itself, and the
priority table because the re-selection depends on it. The force bits
change only when something writes them, and a write under a bound driver
is the I2C_SLAVE_FORCE override; polling twelve outputs would add about
fifty transfers to every tick for that case. Resume re-reads them since
a power loss reloads them.