]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iio: magnetometer: st_magn: fix default DRDY pin selection for LIS2MDL
authorAdvait Dhamorikar <advaitd@mechasystems.com>
Tue, 7 Apr 2026 07:20:59 +0000 (12:50 +0530)
committerJonathan Cameron <jic23@kernel.org>
Fri, 15 May 2026 11:01:38 +0000 (12:01 +0100)
commit49f79cd28f1e3333cbe0d616ce59ead0b24bf34e
tree6da71b77ca8ff1fb0bd249d72ff0362f755a5ad7
parenta093999355084bdbfe6e97f1dd232e58a1525f0b
iio: magnetometer: st_magn: fix default DRDY pin selection for LIS2MDL

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.

Fixes: 38934daf7b5c ("iio: magnetometer: st_magn: Provide default platform data")
Signed-off-by: Advait Dhamorikar <advaitd@mechasystems.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/magnetometer/st_magn_core.c