RE: [PATCH v7 5/6] iio: adc: ad4691: add oversampling support

From: Sabau, Radu bogdan

Date: Tue Apr 14 2026 - 06:35:16 EST




> -----Original Message-----
> From: David Lechner <dlechner@xxxxxxxxxxxx>
> Sent: Saturday, April 11, 2026 12:15 AM

...

> >
> > osc_idx = FIELD_GET(AD4691_OSC_FREQ_MASK, reg_val);
> > - /* Wait 2 oscillator periods for the conversion to complete. */
> > - period_us = DIV_ROUND_UP(2UL * USEC_PER_SEC,
> ad4691_osc_freqs_Hz[osc_idx]);
> > + /* Wait osr oscillator periods for all accumulator samples to complete.
> */
>
> Why did we need to way 2 before and only 1 now when OSR == 1?
>

You are right, that extra period should exist when reading raw not dependent
on the OSR. If OSR = 4 then we should wait 5 just to make sure we are reading
a correct result, since the single_shot_read doesn’t use any interrupts as the
buffers do.