Re: [PATCH v2] iio: magnetometer: st_magn: fix default DRDY pin selection for LIS2MDL

From: Jonathan Cameron

Date: Mon Apr 20 2026 - 13:51:27 EST


On Tue, 7 Apr 2026 18:08:05 +0300
Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:

> On Tue, Apr 07, 2026 at 12:50:59PM +0530, Advait Dhamorikar wrote:
> > The device tree binding for st,lis2mdl does not support
> > st,drdy-int-pin property. However, when no platform data is provided
> > and the property is absent, the driver falls back to default_magn_pdata
> > which hardcodes drdy_int_pin = 2. This causes
> > `st_sensors_set_drdy_int_pin` to fail with -EINVAL because the LIS2MDL
> > sensor settings have no INT2 DRDY mask defined.
> >
> > Fix this by checking the sensor's INT2 DRDY mask availability at
> > probe time and selecting the appropriate default pin. Sensors that
> > do not support INT2 DRDY will default to INT1, while all others
> > retain the existing default of INT2.
>
> LGTM,
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
>
Applied to the fixes-togreg branch of iio.git and marked for stable inclusion.

Note I'll be rebasing that branch of rc1 once available before sending
a pull request.

Thanks,

Jonathan