Re: [PATCH 04/15] iio: accel: adxl380: don't stay in standby on -EINVAL

From: Jonathan Cameron

Date: Sat Oct 31 2026 - 22:27:42 EST


On Wed, 28 Oct 2026 10:02:36 +0000
Nuno Sá <nuno.sa@xxxxxxxxxx> wrote:

> On Tue, Oct 27, 2026 at 05:19:08PM +0100, Greg Kroah-Hartman wrote:
> > From: Josef Bacik <josef@xxxxxxxxxxxxxx>
> >
> > adxl380_set_act_inact_threshold() puts the sensor into standby, writes the
> > threshold and switches the measurement on again. A threshold above 8191 is
> > refused in between, and the sensor stays in standby: no samples and no
> > events until the next write that succeeds.
> >
> > adxl380_set_range() has the same problem and a worse one. It rescales both
> > thresholds for the new range. If one no longer fits it returns -EINVAL
> > with the sensor in standby, the new range in the chip, the old one in
> > st->range and rescaled thresholds in the driver's state: from the next
> > successful write on the samples are reported with the wrong scale.
> >
> > Switch the measurement on again if the threshold is refused. In
> > adxl380_set_range() see whether the thresholds fit before anything is
> > changed.
> >
> > Fixes: df36de13677a ("iio: accel: add ADXL380 driver")
> > Cc: stable <stable@xxxxxxxxxx>
> > Cc: Ramona Gradinariu <ramona.gradinariu@xxxxxxxxxx>
> > Cc: Antoniu Miclaus <antoniu.miclaus@xxxxxxxxxx>
> > Cc: "Nuno Sá" <nuno.sa@xxxxxxxxxx>
> > Cc: Michael Hennerich <Michael.Hennerich@xxxxxxxxxx>
> > Cc: David Lechner <dlechner@xxxxxxxxxxxx>
> > Cc: Andy Shevchenko <andy@xxxxxxxxxx>
> > Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> > ---
>
> Reviewed-by: Nuno Sá <nuno.sa@xxxxxxxxxx>
Applied to the fixes-togreg branch of iio.git

thanks

J