提交 fdb828e2 编写于 作者: L Lorenzo Bianconi 提交者: Jonathan Cameron

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: c91c1c84 ("iio: imu: st_lsm6dsx: add i2c embedded controller support")
Signed-off-by: NLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: NJonathan Cameron <Jonathan.Cameron@huawei.com>
上级 97291741
...@@ -93,9 +93,11 @@ static const struct st_lsm6dsx_ext_dev_settings st_lsm6dsx_ext_dev_table[] = { ...@@ -93,9 +93,11 @@ static const struct st_lsm6dsx_ext_dev_settings st_lsm6dsx_ext_dev_table[] = {
static void st_lsm6dsx_shub_wait_complete(struct st_lsm6dsx_hw *hw) static void st_lsm6dsx_shub_wait_complete(struct st_lsm6dsx_hw *hw)
{ {
struct st_lsm6dsx_sensor *sensor; struct st_lsm6dsx_sensor *sensor;
u16 odr;
sensor = iio_priv(hw->iio_devs[ST_LSM6DSX_ID_ACC]); sensor = iio_priv(hw->iio_devs[ST_LSM6DSX_ID_ACC]);
msleep((2000U / sensor->odr) + 1); odr = (hw->enable_mask & BIT(ST_LSM6DSX_ID_ACC)) ? sensor->odr : 13;
msleep((2000U / odr) + 1);
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册