The correct way to set the sampling rate to 12.5 Hz before commit f8710f0357bc ("iio: imu: st_lsm6dsx: express odr in mHZ") was to write 13 Hz to sampling_frequency. Before this patch writing 13 to samplerate results in sample rate set to 26 Hz. Now we return EINVAL if the sampling rate is not in table. Signed-off-by: Sean Nyekjaer <sean@xxxxxxxxxx> --- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c index a3ab16615729..a14a1df8537b 100644 --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c @@ -1427,7 +1427,7 @@ int st_lsm6dsx_check_odr(struct st_lsm6dsx_sensor *sensor, u32 odr, u8 *val) * ext devices can run at different odr respect to * accel sensor */ - if (odr_table->odr_avl[i].milli_hz >= odr) + if (odr_table->odr_avl[i].milli_hz == odr) break; } -- 2.31.0