RE: [PATCH v4 7/8] iio: imu: adis16607: Add external clock sync support
From: Sabau, Radu bogdan
Date: Mon Oct 26 2026 - 06:55:00 EST
> -----Original Message-----
> From: Jonathan Cameron <jic23@xxxxxxxxxx>
> Sent: Monday, October 26, 2026 2:12 AM
...
> > +
> > + clk = devm_clk_get_optional_enabled(dev, NULL);
> > + if (IS_ERR(clk))
> > + return PTR_ERR(clk);
> > +
> > + if (clk) {
> > + ext_clk_hz = clk_get_rate(clk);
>
> Hmm. What if it is a controllable clock?
Good point. What I'm thinking: add a clk_notifier (same pattern as
adf4377_freq_change() in drivers/iio/frequency/adf4377.c) that
re-runs the sync/scale setup on POST_RATE_CHANGE, under the same
state_lock the trigger handler already uses, so it can't race with
an in-flight FIFO drain. Splitting adis16607_config_clk() into a
probe-time wrapper (gets the clk, registers the notifier if one's
present) and the actual setup logic, so the notifier can re-run just
the latter. A fixed-rate clock would simply never trigger it in
practice, so this covers both cases with the same code.
Does that work for you?