Thank you for your contribution! Sashiko AI review found 13 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 6 · Low: 7 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_prio_table_commit() can lose track of a forced holdover that the profile set, and then clear it. - [Medium] sit9531x_reselect() keeps rewriting and re-latching the priority table of a PLL whose holdover is forced from outside the… - [Medium] A priority-table edit forces holdover only on the target PLL (HO_CTRL on pll_idx). - [Medium] sit9531x_prio_src_live() treats an input as live when it has no LOS (`return !sitdev->ref[index].los;`). - [Medium] sit9531x_input_disable() clears the lane's STATE bit and then sets FORCE. - [Medium] dpll: sit9531x: indirect manual input decoded in sit9531x_chan_select_fetch() - [Low] The commit message leaves out several user-visible and hardware- visible changes. - [Low] The commit message says when the autonomous re-select fires (after probe and resume, when a PLL that tracked a reference is found… - [Low] The commit message says 'On manual input select the selected input is CONNECTED'. - [Low] sit9531x_dpll_selection_operstate_get() returns DPLL_PIN_OPERSTATE_ACTIVE as soon as sit9531x_dpll_selection_active()… - [Low] struct sit9531x_ref documents @enabled as 'input receiver is on', but the field actually means 'not forced off by the driver'. - [Low] The comment on SIT9531X_RESELECT_STALL_POLLS / SIT9531X_RESELECT_STALL_SHIFT_MAX ('20, 10 s, doubled after each such… - [Low] sit9531x_chan_routed_ref_read() unlocks the PLL-page debug key and, if re-locking fails after the three tries in… -- dpll: sit9531x: implement input pin state on a DPLL This patch reports and sets whether an input takes part in a PLL's priority based reference selection. Table membership maps to SELECTABLE or DISCONNECTED, and a receiver is powered down while no PLL lists it. It also adds a poll-driven re-select of PLLs in holdover, operstate reporting, and a write-back of pending table, holdover and debug-key state at unbind.
> The poll re-selects a PLL in holdover while a listed source has signal: > after probe and resume, when it finds frozen a PLL that tracked a > reference, and after 10 s frozen.
[Severity: Low] This isn't a bug, but the commit message says when the re-select fires, not why it is needed. Why does the hardware need the driver to rewrite the table, force holdover and re-latch CLK_ACTIVESEL, instead of relying on the device's own priority arbitration? The doubling back-off is not mentioned either. It runs from SIT9531X_RESELECT_STALL_POLLS << stall_shift up to SIT9531X_RESELECT_STALL_SHIFT_MAX, about 640 s. sit9531x_reselect_arm() runs at probe and resume. So binding the driver can change the hardware selection of a PLL in holdover without any user request. Could the hardware rationale be added to the commit message?
> Probe warns of a pin > node naming no pin. The debug status register is marked precious: each > read advances its latch.
[Severity: Low] This isn't a bug, but the commit message leaves out several changes that userspace or the hardware can see: - operstate_on_dpll_get() is added to both input pin ops tables, and sit9531x_dpll_changes_check() now sends a notification when the operstate changes. - sit9531x_dpll_frozen_status() reports UNLOCKED instead of HOLDOVER for a frozen PLL with an empty table and invalid holdover memory. The locked branch now also requires sit9531x_chan_tracking(). - The CLK_ACTIVESEL read is replaced by sit9531x_chan_routed_ref_read(). On every poll tick, for each tracking PLL, the driver now unlocks the PLL debug key, writes the debug address, reads the data register three times and locks the key again. - sit9531x_dev_stop() now writes back tables, releases forced holdover, locks the debug keys again and gates off receivers at unbind. - Input pins lose DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE when every PLL is on manual select. Could these be described in the commit message? Given the size of the patch (about 1750 lines), could it also be split?
> diff --git a/drivers/dpll/sit9531x/core.c b/drivers/dpll/sit9531x/core.c > index 4ff9e251eb776..d0305cbf12d5a 100644 > --- a/drivers/dpll/sit9531x/core.c > +++ b/drivers/dpll/sit9531x/core.c
[ ... ]
> @@ -192,6 +263,75 @@ static void sit9531x_input_get_regs(const struct sit9531x_dev *sitdev, > } > } > > +/* Caller must hold sitdev->multiop_lock. */ > +int sit9531x_input_disable(struct sit9531x_dev *sitdev, u8 index) > +{
[ ... ]
> + rc = sit9531x_read_u8(sitdev, state_reg, &val); > + if (!rc) > + rc = sit9531x_write_u8(sitdev, state_reg, val & ~BIT(pair)); > + if (!rc) > + rc = sit9531x_read_u8(sitdev, force_reg, &val); > + if (!rc) > + rc = sit9531x_write_u8(sitdev, force_reg, val | BIT(pair)); > + > + ref->enabled = false; > + ref->off_pending = rc != 0; > + > + return rc; > +} > + > +/* > + * Release the force so the lane uses the loaded configuration, as the > + * input_enable() of input_dsable_control.py does; a receiver the configuration > + * keeps off stays off. Caller must hold sitdev->multiop_lock. > + */ > +int sit9531x_input_enable(struct sit9531x_dev *sitdev, u8 index) > +{
[ ... ]
> + rc = sit9531x_read_u8(sitdev, force_reg, &val); > + if (rc) > + return rc; > + rc = sit9531x_write_u8(sitdev, force_reg, val & ~BIT(pair)); > + if (rc) > + return rc; > + > + ref->enabled = true; > + ref->off_pending = false;
[Severity: Medium] What restores a receiver that the loaded configuration forces on (FORCE=1, STATE=1) after a DISCONNECTED then SELECTABLE cycle? sit9531x_ref_state_fetch() treats that combination as enabled. sit9531x_input_disable() clears STATE and sets FORCE without saving the original bits. sit9531x_input_enable() only clears FORCE. The lane therefore ends at FORCE=0/STATE=0 and follows the unforced default rather than the profile. Meanwhile ref->enabled is true and the input is listed in the table. That doesn't seem to match "SELECTABLE gives it back to the loaded configuration" in the commit message. Could the profile's FORCE/STATE bits be recorded, as a later patch in the series does for output Hi-Z with hiz_mask/hiz_state? [ ... ]
> @@ -340,39 +490,607 @@ static u8 sit9531x_prio_slot_get(u8 val, u8 slot)
[ ... ]
> +static int sit9531x_prio_prg_commit(struct sit9531x_dev *sitdev) > +{ > + int rc; > + > + rc = sit9531x_write_close(sitdev, SIT9531X_REG_GLOBAL_UPDATE, > + SIT9531X_SMALL_UPDATE_CMD);
[Severity: Medium] Does this page 0 small update latch only the target PLL's priority block? regs.h describes SIT9531X_REG_GLOBAL_UPDATE as PRG_Directives_GENERIC_0 and says every page has a copy at offset 0x0F. The driver also uses the per-PLL copy at PLL page 0x0F through sit9531x_pll_small_update(). sit9531x_prio_table_commit() forces holdover only on pll_idx. It also resets only chan[pll_idx].tracked and stall_polls. If the page 0 directive latches all four PLLs, could an edit on one PLL, or a periodic sit9531x_reselect() of one frozen PLL, re-latch the other PLLs' tables and CLK_ACTIVESEL nibbles without holdover? Their cached state would then no longer match the hardware. [ ... ]
> +static bool sit9531x_prio_src_live(const struct sit9531x_dev *sitdev, u8 src) > +{ > + u8 index = sit9531x_hw_src_input(src); > + > + if (index >= sitdev->info->num_inputs) > + return true; > + > + return !sitdev->ref[index].los; > +}
[Severity: Medium] Should this also look at ref->qual_fail? sit9531x_input_mon_fetch() decodes the FINE/COARSE drift flags into qual_fail, and the driver reports them to userspace as DPLL_PIN_OPERSTATE_QUAL_FAILED. sit9531x_prio_top_live() and sit9531x_prio_activesel_pick() use only this LOS-based test, though. sit9531x_reselect() calls the pick with idle == true. While the PLL stays frozen, can the poll latch CLK_ACTIVESEL onto a source the monitors flag as drifting, once every stall period? In this patch the pick also prefers the stale CLK_ACTIVESEL nibble (cur) over the routed source. The later patch "dpll: sit9531x: add support to get and set priority on input pins" adds the routed source to the pick and fixes that part. The drift part is still present at the end of the series. [ ... ]
> +static int sit9531x_prio_table_commit(struct sit9531x_dev *sitdev, u8 pll_idx, > + const u8 *srcs, bool reselect) > +{
[ ... ]
> + if (!(val & BIT(SIT9531X_PLL_HO_FORCE_BIT))) > + chan->ho_kept = false; > + ho_foreign = (val & BIT(SIT9531X_PLL_HO_FORCE_BIT)) && > + chan->prio_mask && !chan->ho_kept && > + !chan->ho_release_pending;
[ ... ]
> +release: > + /* > + * An empty table keeps the forced holdover; the PLL uses the source in > + * the selection nibble, which still names the old one. > + */ > + if (!chan->prio_mask && !ho_undo) { > + dev_dbg(sitdev->dev, > + "PLL%c: no source listed, holdover kept\n", > + 'A' + pll_idx); > + chan->ho_release_pending = false; > + chan->ho_kept = true; > + goto out; > + } > + > + if (ho_foreign) { > + dev_dbg(sitdev->dev, > + "PLL%c: holdover was forced before the write, left in place\n", > + 'A' + pll_idx); > + goto out; > + }
[Severity: Medium] Can this lose track of a holdover the profile forced? The empty-table branch runs before the ho_foreign check. Start with HO_CTRL bit 4 set by the configuration, prio_mask = {A} and ho_kept = false: DISCONNECTED on A sit9531x_input_prio_remove()->sit9531x_prio_table_apply() ->sit9531x_prio_table_commit() ho_foreign = true sit9531x_prio_mask_build() leaves prio_mask == 0 release: !chan->prio_mask, so chan->ho_kept = true; goto out SELECTABLE on A sit9531x_input_prio_add()->...->sit9531x_prio_table_commit() force bit still set, but prio_mask == 0, so ho_foreign = false prio_mask becomes non-zero release: the retry loop clears SIT9531X_PLL_HO_FORCE_BIT Doesn't the driver then clear a forced holdover it never set? Should ho_foreign be tested before the empty-table branch, or should ho_kept stay false when ho_foreign was true? The ordering looks unchanged at the end of the series. [ ... ]
> @@ -544,24 +1268,81 @@ static int sit9531x_chan_select_fetch(struct sit9531x_dev *sitdev, u8 pll_idx)
[ ... ]
> +relock: > + 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] If the relock still fails after the retries in sit9531x_write_pll_close(), only key_pending records it, and lock_rc is returned. During probe that error goes up the chain: sit9531x_dev_start() sit9531x_dev_state_fetch() sit9531x_chan_state_fetch() sit9531x_chan_routed_ref_read() sit9531x_dev_start() then returns without a retry. The devm action that runs sit9531x_dev_stop() is not registered yet, so nothing calls sit9531x_debug_back_retry(). Does the PLL debug window stay unlocked after the failed probe? A later dpll registration failure in sit9531x_devm_dpll_init() goes to err_destroy_worker the same way. The later patch "dpll: sit9531x: add support to get phase offset on the connected input" adds sit9531x_dev_pending_retry() to the registration failure path. The sit9531x_dev_state_fetch() failure path still has no retry at the end of the series. [ ... ]
> @@ -607,23 +1373,48 @@ static int sit9531x_chan_state_fetch(struct sit9531x_dev *sitdev, u8 pll_idx)
[ ... ]
> - chan->selected_ref = > - sit9531x_hw_src_input(input_sel & SIT9531X_PRIO_NIBBLE_MASK); > + chan->routed_ref = routed; > + if (chan->manual_input && routed != SIT9531X_REF_INVALID) > + chan->manual_ref = routed;
[Severity: Low] The commit message says: On manual input select the selected input is CONNECTED and requests are refused. For a PLL on the select pins or the indirect choice (manual_any), sit9531x_chan_select_fetch() keeps the previous manual_ref. At probe that value is SIT9531X_REF_INVALID: if (manual_any && chan->manual_input && chan->manual_any) manual_ref = chan->manual_ref; manual_ref is only learned here, from the routed reference while the PLL tracks. If such a PLL has not tracked since probe, won't sit9531x_dpll_selection_state_get() report every input as DISCONNECTED? This assignment also replaces a register-selected manual_ref with the routed reference. The kernel-doc for @manual_ref says "the register choice, else the input it last tracked". Should the register choice win here? [ ... ]
> @@ -798,34 +1638,279 @@ static int sit9531x_dev_state_fetch(struct sit9531x_dev *sitdev)
[ ... ]
> +/* > + * Frozen polls after which a stalled PLL is re-selected: 20, 10 s, doubled > + * after each such re-select up to 1280, 640 s. > + */ > +#define SIT9531X_RESELECT_STALL_POLLS 20 > +#define SIT9531X_RESELECT_STALL_SHIFT_MAX 6
[Severity: Low] The seconds in this comment assume one poll every 500 ms. That doesn't always hold: - The IRQ path runs the poll at once with kthread_mod_delayed_work(sitdev->kworker, &sitdev->work, 0). - The new poll_fails back-off stretches the period up to 8x. sit9531x_reselect() increments stall_polls on every run regardless. Should this comment and the @stall_polls kernel-doc give the count in polls instead of seconds?
> +static void sit9531x_reselect(struct sit9531x_dev *sitdev, u8 pll_idx) > +{
[ ... ]
> + if (chan->manual_input || !chan->active || !chan->prio_mask || > + chan->mode || chan->ho_release_pending || chan->table_pending) > + return;
[Severity: Medium] These early returns don't cover a holdover forced from outside the driver. Take a PLL that the profile holds in forced holdover, with a listed source that has signal. sit9531x_reselect_arm() at probe leads to: sit9531x_reselect() sit9531x_prio_table_commit(sitdev, pll_idx, chan->prio_srcs, true) forces holdover (already set) and sleeps 10 ms rewrites the priority registers and the CLK_ACTIVESEL nibble sit9531x_prio_prg_commit() ho_foreign: leaves the force set and returns 0 dev_info(..., "re-selecting, a source is back") On later polls ho_freeze stays set and top == live_top, so stall_polls reaches 20 << stall_shift and re-arms. stall_shift stops at 6. Doesn't this rewrite and latch repeat every 1280 polls for as long as the driver is bound, while the PLL can never leave holdover? Should sit9531x_reselect() skip a PLL whose holdover something other than the driver forced? [ ... ]
> diff --git a/drivers/dpll/sit9531x/core.h b/drivers/dpll/sit9531x/core.h > index f9bc9cce4ee7c..31c7d434978a5 100644 > --- a/drivers/dpll/sit9531x/core.h > +++ b/drivers/dpll/sit9531x/core.h
[ ... ]
> @@ -82,14 +87,21 @@ enum sit9531x_signal_mode { > * struct sit9531x_ref - input reference state > * @freq: configured frequency in Hz > * @enabled: input receiver is on
[Severity: Low] This isn't a bug, but @enabled now means "not forced off by the driver" rather than "input receiver is on". sit9531x_ref_state_fetch() computes it as not (FORCE set and STATE clear). sit9531x_input_enable() sets ref->enabled = true even though its own comment says a receiver the configuration keeps off stays off. Could the kernel-doc be updated to match? [ ... ]
> diff --git a/drivers/dpll/sit9531x/dpll.c b/drivers/dpll/sit9531x/dpll.c > index e9952e578face..5d16183aa1aeb 100644 > --- a/drivers/dpll/sit9531x/dpll.c > +++ b/drivers/dpll/sit9531x/dpll.c
[ ... ]
> + if (sit9531x_dpll_selection_active(sitdev, sitdpll, pin_id)) { > + *operstate = DPLL_PIN_OPERSTATE_ACTIVE; > + return; > + } > + > + if (pin_id < sitdev->info->num_inputs) { > + ref = sit9531x_ref_state_get(sitdev, pin_id); > + if (ref->los) { > + *operstate = DPLL_PIN_OPERSTATE_NO_SIGNAL; > + return; > + } > + if (ref->qual_fail) { > + *operstate = DPLL_PIN_OPERSTATE_QUAL_FAILED; > + return; > + } > + }
[Severity: Low] sit9531x_dpll_selection_active() checks only routed_ref, tracking and !los. A routed, tracked input whose monitor shows frequency drift (ref->qual_fail) is therefore reported ACTIVE. include/uapi/linux/dpll.h defines DPLL_PIN_OPERSTATE_ACTIVE as "pin is qualified and actively used by the DPLL". The same drift flags make a non-routed input QUAL_FAILED. Is it intended that userspace can't see when the active reference fails the driver's own qualification check? [ ... ]
> @@ -534,8 +1253,13 @@ static int sit9531x_chan_select_fetch(struct sit9531x_dev *sitdev, u8 pll_idx) > if (rc) > return rc; > manual_input = true; > + manual_any = !(sel & SIT9531X_MAN_IN_SEL_FROM_REG) || > + (sel & SIT9531X_MAN_IN_SEL_INDIRECT); > if (sel & SIT9531X_MAN_IN_SEL_FROM_REG) { > sel = FIELD_GET(SIT9531X_MAN_IN_SEL_MASK, sel); > + manual_ref = > + sit9531x_hw_src_input(sit9531x_prio_src_canon(sitdev, > + sel)); > dev_dbg(sitdev->dev, > "PLL%c: the profile selects its reference from the register, input code %u; reported as manual\n", > 'A' + pll_idx, sel);
[Severity: Medium] Does this decode a register choice for a PLL on the indirect choice? With both SIT9531X_MAN_IN_SEL_FROM_REG and SIT9531X_MAN_IN_SEL_INDIRECT set, manual_any is true. The following if (sel & SIT9531X_MAN_IN_SEL_FROM_REG) branch still runs, though, and fills manual_ref from the low nibble. The dev_dbg also reports that the profile selects from the register. At probe chan->manual_input and chan->manual_any are both still false. The check that keeps the previous manual_ref therefore doesn't fire, and the decoded value is recorded. The same happens on resume when the PLL was not on manual_any before. sit9531x_chan_state_fetch() only overwrites manual_ref while the PLL tracks a routed reference. For a PLL that is unlocked or in holdover, sit9531x_dpll_selection_state_get() then reports the low-nibble input as DPLL_PIN_STATE_CONNECTED to userspace. The regs.h comment says the driver takes the input of a PLL on the indirect choice as unknown. The @manual_any kernel-doc says the same. The receiver claims in sit9531x_manual_claims_add() already treat this case as unknown, so only the reported pin state disagrees. Should the decode be limited to FROM_REG without INDIRECT, for example by testing !manual_any, so manual_ref stays SIT9531X_REF_INVALID until the PLL is seen tracking? Or does the low nibble mean something for the indirect choice that the comments don't describe?
-- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40sitime.com