On Tue, 24 Nov 2026 00:40:50 +0000, netd…@kernel.org wrote:
> > + "PLL%c: Fref * DIVN = %llu Hz is outside its VCO band\n", > > + 'A' + pll_idx, *fvco); > > + } > > + > > + return 0; > > +}
> > [Severity: Medium] > If Fref * DIVN is above the low-band minimum but outside this PLL's own > band, sit9531x_get_fvco() warns once and still returns 0. The comment > above says such a value is usually not the rate the PLL runs at. > > For that PLL, sit9531x_output_freq_get() then reports and caches > div64_u64(fvco, divo). sit9531x_output_divo_calc() rejects the same > Fvco: > > if (!sit9531x_fvco_in_band(pll_idx, fvco)) { > dev_dbg(sitdev->dev, > "out%u: PLL%c Fvco %llu Hz is outside its VCO band, rate not settable\n", > ... > return -EINVAL; > } > > So would a cascaded PLL report a nonzero DPLL_A_PIN_FREQUENCY that the > driver itself treats as wrong? > > The commit message says "An output whose divider chain does not resolve > reports 0 Hz". Should sit9531x_output_freq_get() apply the same band > check and return -ENODATA? > > The later patch "dpll: sit9531x: add support to adjust output phase" > adds the comment "Fref * DIVN outside the VCO band is not the rate the > PLL runs at" in sit9531x_output_phase_adjust_set(). Even so, > sit9531x_output_freq_get() still has no band check at the end of the > series.
No. In v17 sit9531x_get_fvco() returns -ENODATA for a product outside the PLL's VCO band; the getter reports 0 Hz and the setter refuses the rate.
> > + ctrl | SIT9531X_DIVO_PHASE_TRIG); > > + > > +restore: > > + ret = sit9531x_write_u8(sitdev, SIT9531X_REG_GPIO_FUNC_CTRL1, orig); > > + if (ret && !rc) > > + rc = ret;
> > [Severity: Medium] > regs.h describes the flush as "DIVO_PHASE_SEL_REG selects the register > trigger; pulsing DIVO_PHASE_TRIG high then low flushes". > > Here, the final write of orig clears DIVO_PHASE_TRIG and restores > DIVO_PHASE_SEL_REG in the same transfer. Suppose the profile had the pin > trigger selected, so SEL_REG is clear in orig. Then the register > trigger's high-to-low transition happens at the same moment the mux > switches back to the external pin. > > If the flush acts on the falling edge, can the flush be missed while > sit9531x_output_freq_set() still reports success? Would it help to write > ctrl (SEL_REG set, TRIG clear) before restoring orig? > > The same ordering is still there at the end of the series in > sit9531x_phase_flush_undo(), which writes the original ctrl straight > after the TRIG-high write.
v17 lowers the trigger with the register select still set and restores the select in a separate write after it, the order of the reference sequence.
> > + sitdev->out[out_idx].freq = 0; > > + return rc; > > + } > > + > > + *frequency = div64_u64(fvco, divo); > > + sitdev->out[out_idx].freq = *frequency;
> > [Severity: Medium] > Suppose the UPDATE_NVM write fails here but one of the LOOP_LOCK > attempts that follow succeeds. sitdev->loops_open then ends up false, > and nothing records that the bank update was never issued. Neither the > retry in sit9531x_dev_chan_states_update() nor the one in > sit9531x_dev_stop() will run, since both key on loops_open. > > sit9531x_output_freq_set() returns the error, but the five DIVO bytes > from sit9531x_output_divo_write() stay in the registers. The back flag > that sit9531x_output_divo_write() fills in is never checked. > > On that error, sit9531x_dpll_output_pin_frequency_set() calls > sit9531x_output_freq_get(). That reads the new DIVO bytes back through > sit9531x_output_divo_read() and caches Fvco / DIVO in > sitdev->out[].freq. If the result differs from the old value, the > setter then sends __dpll_pin_change_ntf(). > > If the divider only takes effect once UPDATE_NVM is written, user space > gets an error together with a notification for a rate the part is not > running. The cached freq follows the uncommitted register contents > rather than the hardware. > > Should a failed UPDATE_NVM be tracked as pending and retried by the > poll worker? Or should sit9531x_output_freq_set() restore the old DIVO > bytes before it closes the programming state? > > At the end of the series the retry path is sit9531x_prg_relock(), which > does not repeat the bank update either.
v17 records a failed bank update and issues it again from the poll and at removal, inside the programming sequence, so the divider the error path reads back is the one the retry commits.
> [Severity: Medium] > Can this value fall outside the range the pin advertises? For an output > without supported-frequencies-hz, sit9531x_pin_props_get() advertises: > > ranges[j].min = 1; > ranges[j].max = 1000000000ULL; /* 1 GHz */ > > Fvco is at least SIT9531X_FVCO_LOWBAND_MIN (4.9152 GHz). A profile with > DIVO of 4 or less therefore gives a reported frequency above 1 GHz. When > there is a DT list, the truncated Fvco / DIVO also need not match any > listed value. > > dpll_pin_freq_set() in the core calls dpll_pin_is_freq_supported() before > its freq == old_freq shortcut. Writing back the value just read would > then fail with "frequency is not supported by the device". Is that > intended? > > The 1 GHz cap is unchanged at the end of the series.
It could in v16. In v17 an output without a list advertises the datasheet rates, the setter accepts up to 2949.12 MHz and 250 MHz on an LVCMOS output, and the getter rounds to the nearest hertz.
> > > > + /* Retry pending writes first so the reads below see their result */ > > + if (sitdev->loops_open) > > + sit9531x_prg_commit(sitdev); > > + > > sit9531x_input_off_retry(sitdev);
> > [Severity: Medium] > Does this retry run with the Page 3 debug key locked? > > When every LOOP_LOCK attempt fails, sit9531x_prg_commit() sets > loops_open but still relocks the key at the end: > > sitdev->loops_open = !!rc2; > > msleep(100); > ... > rc3 = sit9531x_write_close(sitdev, SIT9531X_REG_OUTSYS_DEBUG, > SIT9531X_DEBUG_LOCK_VAL); > > This retry calls sit9531x_prg_commit() directly, and so does the one in > sit9531x_dev_stop(). Neither does the unlock that sit9531x_prg_enter() > performs before every other PRG_DIR_GEN write: > > rc = sit9531x_write_u8(sitdev, SIT9531X_REG_OUTSYS_DEBUG, > SIT9531X_DEBUG_UNLOCK_VAL); > > If PRG_DIR_GEN commands only take effect while the key is unlocked, the > LOOP_LOCK write would be ACKed but have no effect, and loops_open would > be cleared anyway. sit9531x_dev_stop() would then skip its "output loops > left unlocked at removal" warning, and later readers of loops_open would > treat the loops as closed. > > This retry also sends UPDATE_NVM again, outside the PRG_CMD sequence. > > The later patch "dpll: sit9531x: implement output pin state on a DPLL" > changes the retry to sit9531x_prg_relock(), which drops the UPDATE_NVM. > It still writes LOOP_LOCK without opening the debug window, though.
It did in v16. In v17 the retry opens the output-system debug key before the loop lock, as the first attempt does, and with a bank update pending it enters the programming sequence first.
> > struct regmap *regmap; > > const struct sit9531x_chip_info *info; > > - /* Serializes multi-step register sequences */ > > struct mutex multiop_lock; > > - /* Serializes a page select and the transfer it is for */ > > struct mutex page_lock;
> > [Severity: Low] > This isn't a bug, but removing these two comments looks unrelated to > frequency get/set, and the commit message doesn't mention it. > > The block comment above the struct is not kernel-doc, so checkpatch > --strict will report "struct mutex definition without comment" for both > locks. The comments are still missing at the end of the series.
Agreed. v17 leaves both comments in place.