Skip to content

Commit fdb828e

Browse files
LorenzoBianconijic23
authored andcommitted
iio: imu: st_lsm6dsx: fix waitime for st_lsm6dsx i2c controller
i2c controller available in st_lsm6dsx series performs i2c slave configuration using accel clock as trigger. st_lsm6dsx_shub_wait_complete routine is used to wait the controller has carried out the requested configuration. However if the accel sensor is not enabled we should not use its configured odr to estimate a proper timeout Fixes: c91c1c8 ("iio: imu: st_lsm6dsx: add i2c embedded controller support") Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 9729174 commit fdb828e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,11 @@ static const struct st_lsm6dsx_ext_dev_settings st_lsm6dsx_ext_dev_table[] = {
9393
static void st_lsm6dsx_shub_wait_complete(struct st_lsm6dsx_hw *hw)
9494
{
9595
struct st_lsm6dsx_sensor *sensor;
96+
u16 odr;
9697

9798
sensor = iio_priv(hw->iio_devs[ST_LSM6DSX_ID_ACC]);
98-
msleep((2000U / sensor->odr) + 1);
99+
odr = (hw->enable_mask & BIT(ST_LSM6DSX_ID_ACC)) ? sensor->odr : 13;
100+
msleep((2000U / odr) + 1);
99101
}
100102

101103
/**

0 commit comments

Comments
 (0)