On Tue, 24 Nov 2026 00:40:48 +0000, netd…@kernel.org wrote:
> > + if (rc) > > + sit9531x_write_close(sitdev, SIT9531X_REG_OUTSYS_DEBUG, > > + SIT9531X_DEBUG_LOCK_VAL); > > + > > + return rc; > > +}
> > [Severity: Low] > When the unlock write fails here, the result of sit9531x_write_close() is > dropped and outsys_key_pending is never set. Is that intended? > > The only place that updates the flag is sit9531x_outsys_debug_close(): > > sitdev->outsys_key_pending = !!rc; > > sit9531x_dev_chan_states_update() and sit9531x_dev_stop() retry the close > only when that flag is set. > > A failed I2C write can still latch the unlock byte, for example when the > error comes after the data phase. If all SIT9531X_CLOSE_TRIES lock attempts > then fail as well, could the Page 3 debug window stay unlocked with nothing > ever retrying the close? > > sit9531x_output_disable(), sit9531x_output_enable() and > sit9531x_prg_enter() all reach this path. Would it work to call > sit9531x_outsys_debug_close() in the failure branch, or to set > outsys_key_pending from the sit9531x_write_close() result?
v17 records the result of the lock write on that path, and the poll and removal close the key again if it failed.
> > + msleep(100); > > + > > + sit9531x_outsys_debug_close(sitdev); > > + > > + return rc; > > }
> > [Severity: Medium] > sit9531x_prg_relock() always closes the debug key, even when every > LOOP_LOCK attempt failed and loops_open was set. The later retries call > sit9531x_prg_relock() directly. In sit9531x_dev_chan_states_update() and > sit9531x_dev_stop(): > > if (sitdev->loops_open) > sit9531x_prg_relock(sitdev); > > These retries write LOOP_LOCK to SIT9531X_REG_PRG_DIR_GEN while the key at > 0x03:0xBD is locked, and nothing reopens it first. > > Everywhere else, the driver opens the debug key before it writes > PRG_DIR_GEN. Suppose the device ignores PRG_DIR_GEN writes while the key is > locked. The retry would still be ACKed, loops_open would be cleared, and > the output loops would stay in PRG_CMD. Can that happen? > > loops_open = !!rc reflects only the I2C status, and nothing reads the loop > state back. Later in the series, the phase offset code also gates on > loops_open. > > This patch also adds a new way into this state. A failed PRG_CMD_STATE > write in sit9531x_prg_enter() now goes through sit9531x_prg_relock() and > can set loops_open. The removed sit9531x_prg_abort() never queued a retry. > > The out-of-window retry first appeared earlier in this series, in "dpll: > sit9531x: add support to get and set frequency on pins" (through > sit9531x_prg_commit()). This patch rewrites it into sit9531x_prg_relock(). > Whether the debug key gates 0x03:0x0F depends on the datasheet. > > Should the retry path reopen the debug window before it writes LOOP_LOCK?
In v17 the poll and removal retry the re-lock through sit9531x_prg_relock_retry(), which opens the output-system debug key before the loop lock, as the first attempt does. The change comes with patch 9.
> > SIT9531X_PRG_CMD_STATE); > > if (rc) { > > - sit9531x_prg_abort(sitdev); > > + sit9531x_prg_relock(sitdev); > > return rc; > > }
> > [Severity: Low] > This isn't a bug, but the commit message only describes the output mute > through the Hi-Z force registers. The patch also reworks the PRG_CMD > helpers that "dpll: sit9531x: add support to get and set frequency on > pins" added for the output divider write. > > sit9531x_prg_abort() is removed. A failed PRG_CMD_STATE write here now goes > through sit9531x_prg_relock(), which sets loops_open, sleeps for 100 ms and > records the result of the key close in outsys_key_pending. Before this > patch, a failed loop lock on this path was never retried. > > The poll retry in sit9531x_dev_chan_states_update() and the removal path in > sit9531x_dev_stop() now call sit9531x_prg_relock() instead of > sit9531x_prg_commit(). A retry therefore no longer re-issues > SIT9531X_UPDATE_NVM, and only a code comment explains that. > > There is also a new background retry that closes the output-system debug > key after a failed close: > > else if (sitdev->outsys_key_pending) > sit9531x_outsys_debug_close(sitdev); > > Together these change how sit9531x_output_freq_set() behaves on failure. > Could these changes go into the frequency-set patch, or at least be > described in this commit message?
Agreed. The v17 message describes the single exit of the programming state and its retries.
> > + if (keep & BIT(i)) > > + continue; > > + rc = sit9531x_hiz_set_bit(sitdev, p[i].mask, p[i].bit, > > + false); > > + if (rc) > > + return rc;
> > [Severity: Low] > If a read-modify-write fails partway through this loop, the pairs already > released stay released. Is that intended? > > Take a CMOS output where CMOS_P was released and the CMOS_N pair then > fails. OutP is left driving and OutN is still forced to Hi-Z. Neither the > user nor the loaded configuration asked for that state. > sit9531x_output_enable() then reads back part_muted = true and > enabled = true and returns the error. The pin reports CONNECTED while the > request fails. > > The mute branch below takes a snapshot of mask[] and state[] and rolls > back on failure. Should the unmute branch do the same?
v17 uses one write loop for mute and unmute; a failure in either restores both bits of every pair already written.
> > + } > > + return 0; > > }
> > [Severity: Medium] > The commit message says: > > An un-mute releases the force and the pads return to the loaded > configuration. > > Does this branch restore the loaded configuration? It only clears the MASK > bit of each pair not in keep, and STATE stays at the 0 the mute wrote. > > The mask[] and state[] snapshot in the mute branch is used only to roll > back a failed mute. sit9531x_out_state_fetch() fills hiz_keep only for > outputs found part-muted at probe, and only for pairs forced to Hi-Z (MASK > set, STATE clear). > > Consider a pair the profile had under a drive override (MASK=1, STATE=1), > or any override on a differential or fully driven output. After a > DISCONNECTED then CONNECTED cycle it comes back as MASK=0, STATE=0. Is > losing that override expected? > > sit9531x_dpll_output_pin_state_on_dpll_set() never skips a CONNECTED > request while part_muted is set. So on an output that was part-muted at > probe, every CONNECTED request clears MASK on non-keep pairs the driver > never touched. The readback only checks mask && !state, so nothing reports > the lost override. > > Whether MASK=0 behaves differently from MASK=1/STATE=1 depends on the > device's non-override output control. Could the unmute put back the saved > MASK/STATE values instead?
Agreed. In v17 probe records the force and state bits the loaded configuration sets on each pair, and an unmute writes that record back.
> > + if (rc) > > + return rc; > > + if (forced) > > + out->hiz_keep |= BIT(i); > > + } > > + }
> > [Severity: Medium] > Does hiz_keep survive an unbind/rebind or a module reload? > > It is rebuilt only for outputs found part-muted. The driver's own mute, > sit9531x_output_disable()->sit9531x_output_hiz_write(..., true, 0), forces > all three pairs. sit9531x_dev_stop() does not undo those forces, and the > force registers are outside the NVM, so they stay set while the part has > power. > > After a rebind without a power cycle, this function sees muted = true and > part = false, and sets hiz_keep = 0. A later CONNECTED request then calls > sit9531x_output_hiz_write(slot, false, 0). That clears MASK on all three > pairs, including the pad the loaded configuration had forced to Hi-Z. > > For example, a CMOS output whose profile drives only OutP would end up > with both OutP and OutN driving. Wouldn't that contradict "the pads return > to the loaded configuration"? > > Resume, added later in the series, re-reads the mute state but does not > recompute hiz_keep. The gap is still there at the end of the series.
No. After a rebind the driver has only the force registers and can't tell a pair an earlier binding forced from one the configuration forced; on an output found muted it takes the pair as the mute, and an unmute drives every pad. The v17 kernel-doc and message say so. Resume reads the record again unless the output was muted before and after suspend.
> > + if (!sit9531x_output_state_refresh(sitdev, dpin->id) && > > + sitdev->out[dpin->id].enabled == enable && > > + !sitdev->out[dpin->id].part_muted) { > > + mutex_unlock(&sitdev->multiop_lock); > > + return 0; > > + }
> > [Severity: Low] > This comment seems to disagree with the get side. The @part_muted > kernel-doc in core.h says such an output is "reported as driven", and > sit9531x_dpll_output_pin_state_on_dpll_get() reports it as CONNECTED. > > The skip test requires !part_muted, so a CONNECTED request on a pin that > already reports CONNECTED always runs sit9531x_output_enable(). On an > output part-muted at probe, the hiz_keep pads stay forced, the readback is > part-muted and enabled again, and the reported state does not change. > > Each such request still does a read-modify-write of every non-keep Hi-Z > MASK bit. That can clear profile-set mask bits the driver never changed, > such as the DIFF pair of a CMOS output. > > The exclusion also lets a retry finish an unmute that failed partway when > hiz_keep is 0. Could the skip treat the hiz_keep-only case as already > satisfied for CONNECTED, or could the comment match the @part_muted > documentation?
Agreed. In v17 a pad the configuration forces is not counted as a mute, so the getter and the setter agree, and an unmute writes only the bits that differ from the record.