On Tue, 24 Nov 2026 00:40:36 +0000, netd…@kernel.org wrote:
> > The register space is 32 pages of 256 registers, selected through offset > > 0xFF of any page. The regmap is the flat 256-byte window, and the > > accessors select the page under a lock. A regmap paged range is not > > used: it reads the selector back on each access, which doubles the bus > > traffic, and a debugfs access would move the page under the driver.
> > [Severity: Low] > > Does the debugfs part of this rationale hold for regmap ranges? > > As far as I can tell, _regmap_select_page() in drivers/base/regmap/regmap.c > selects the page again on every access through the range, under the > regmap lock: > > ret = _regmap_update_bits(map, range->selector_reg, > range->selector_mask, > win_page << range->selector_shift, > NULL, false); > > So a debugfs access should not leave a range-based driver with a stale > page. > > The flat window chosen here looks like the design that has the > page-tracking hazard. sit9531x_page_select() trusts the cached value and > skips the selector write: > > if (sitdev->page == page) > return 0; > > The regmap debugfs registers file for sit9531x_regmap_config dumps offsets > 0x00-0xFF of whatever page the driver last selected. It does this without > taking page_lock, and the dump does not say which page it shows. > > Debugfs writes to 0xFF are compiled out by default > (REGMAP_ALLOW_WRITE_DEBUGFS is undefined), so hitting the stale cache case > needs a source change. > > Could the commit message describe this tradeoff more precisely?
No, and v17 drops the debugfs reason. The message now gives only the bus traffic: with no register cache, a paged range reads the selector back on every access.
> > Suggested-by: Ivan Vecera <ivec…@redhat.com> > > Signed-off-by: Oleg Zadorozhnyi <Oleg…@devoxsoftware.com> > > Signed-off-by: Ali Rouhi <arou…@sitime.com>
> > [Severity: Low] > > This isn't a bug, but core.c, core.h and regs.h all name Ali Rouhi first > as Author in their headers, and MODULE_AUTHOR() lists him first too. If > he co-developed the patch, should there be a Co-developed-by: tag right > before his Signed-off-by:, as Documentation/process/submitting-patches.rst > describes?
v17 adds Co-developed-by: Ali Rouhi ahead of his Signed-off-by, after Oleg's Signed-off-by as author.
> > + > > + /* > > + * Fvco = Fref * (DIVN + frac/2^32); Fref is the rate of the XO feeding > > + * XIN/XO_CLK. > > + */ > > + xtal_clk = devm_clk_get_optional_enabled(sitdev->dev, "xtal");
> > [Severity: Medium] > > The comment above says the goal is to avoid gating the XO of a running > part. Doesn't devm_clk_get_optional_enabled() still gate it on every > failure path after this point? > > drivers/clk/clk-devres.c implements it as: > > return __devm_clk_get(dev, id, clk_get_optional, > clk_prepare_enable, clk_disable_unprepare); > > So devres calls clk_disable_unprepare() on any probe failure after this > point, while the part stays out of reset and configured. That includes: > > - the "no xtal rate" -EINVAL return > - a gpiod_direction_output() failure > - a transient I2C error from sit9531x_read_variant_id() > - the "Unknown variant ID" -ENODEV return > - a devm_mutex_init() failure > > The driver has no .remove and is fully devm-managed, so a sysfs unbind or > rmmod gates the XO as well. > > Later patches in the series add more failure points after the XO enable > (sit9531x_devm_dpll_init(), devm_request_threaded_irq()), and the XO is > still devm-enabled. > > If the XO is gateable and this driver is its only consumer, won't this > stop the reference of a chip running from its efuse/NVM configuration?
devres balances the enable on a failed probe and on unbind, as for any consumer. A clock that must keep running with no driver bound is lost at clk_disable_unused() unless its provider marks it critical, so holding the enable while bound can't be that guarantee. The reset line and the supplies are requested before the enable, so a deferral does not gate the XO. The v17 message says what devres releases.
> > + return dev_err_probe(sitdev->dev, rc, > > + "Failed to release the reset line\n"); > > + fsleep(10000); /* internal boot after release */ > > + } > > + > > + rc = sit9531x_read_variant_id(sitdev, &variant_id);
> > [Severity: Medium] > > Should probe get and enable the supplies defined in the binding before > this first I2C access? > > The binding in this series (sitime,sit95316.yaml) documents vdd-supply, > vddin-supply, vdds-supply and the vddoN-supply rails. It says they are > there so that "a board with switchable rails" can describe them, and its > example points vdd-supply/vddin-supply at &reg_1v8/&reg_3v3. > > The binding commit does note "The driver does not enable them", and > sit9531x_dev_probe() makes no regulator call. > > If the rail is off at probe on such a board, this read goes to an > unpowered part. Probe then fails with an I2C error or a misleading > "Unknown variant ID", and nothing points at the missing supply. > > If the bootloader left the rail on, no consumer claims it. Wouldn't > regulator_late_cleanup() then turn it off? It only skips regulators that > are always_on or have a nonzero use_count. That would cut power to a > running DPLL and drop the efuse/NVM configuration this patch tries to > keep. > > A separate point: when reset-gpios is absent, nothing waits before this > read, because the fsleep() only runs when the reset GPIO exists. Does the > part need time after the XO is enabled before it answers on I2C? > > At the end of the series, drivers/dpll/sit9531x/ still has no regulator > handling.
Yes. In v17 probe enables vdd and vddin with devm_regulator_bulk_get_enable(), and vdds and each VDDO rail of the variant when the board names it, before the XO and the first I2C access. Probe then waits the 10 ms start-up time, with or without a reset line.