Re: [PATCH v1 1/1] iio: adc: nxp-sar-adc: Fix the delay calculation in nxp_sar_adc_wait_for()
From: Jonathan Cameron
Date: Fri Jul 03 2026 - 18:56:18 EST
On Fri, 3 Jul 2026 22:42:21 +0200
Daniel Lezcano <daniel.lezcano@xxxxxxxxxxxxxxxx> wrote:
> On 7/3/26 21:06, Jonathan Cameron wrote:
> > On Tue, 26 May 2026 14:48:44 +0200
> > Daniel Lezcano <daniel.lezcano@xxxxxxxxxxxxxxxx> wrote:
> >
> >> On 5/22/26 19:35, Jonathan Cameron wrote:
> >>> On Tue, 19 May 2026 23:56:06 +0200
> >>> Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> >>>
> >>>> The original code was using ndelay() twice. In one case the delay
> >>>> is calculated as 1/3 of ADC clock and in the other as 80 ADC clocks.
> >>>> But according to the comments in all cases it should be a multiplier
> >>>> of the ADC clock, and not a fraction of it. Inadvertently
> >>>> nxp_sar_adc_wait_for() takes the wrong case and spread it over
> >>>> the code make it wrong in all places. Fix this by modifying a helper
> >>>> to correctly use the multiplier.
> >>>>
> >>>> Fixes: 7e5c0f97c66a ("iio: adc: nxp-sar-adc: Avoid division by zero")
> >>>> Fixes: 4434072a893e ("iio: adc: Add the NXP SAR ADC support for the s32g2/3 platforms")
> >>>> Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
> >>>> Closes: https://sashiko.dev/#/patchset/20260416090122.758990-1-andriy.shevchenko%40linux.intel.com
> >>>> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> >>>
> >>> Daniel, could you take a look at this one.
> >>>
> >>> Explanation seems fine but original patch was yours so I'd like
> >>> some 'aware' eyes on it!
> >>
> >> Sounds like correct but let me loop in Ghenadi as I don't have the
> >> platform anymore to check the change
> >>
> > Hi
> >
> > This one is still outstanding if anyone has a chance to look at it.
> > If not I'll gamble and apply it :)
>
> Yes sure, go ahead
>
> Acked-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxxxxxxxx>
Applied and marked for stable
Thanks,
Jonathan
>