Skip to content

Commit daec424

Browse files
jmaneyrol-invnjic23
authored andcommitted
iio: imu: inv_mpu6050: fix frequency setting when chip is off
Track correctly FIFO state and apply ODR change before starting the chip. Without the fix, you cannot change ODR more than 1 time when data buffering is off. This restriction on a single pending ODR change should only apply when the FIFO is on. Fixes: 111e1ab ("iio: imu: inv_mpu6050: use the common inv_sensors timestamp module") Cc: stable@vger.kernel.org Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> Link: https://lore.kernel.org/r/20240219154741.90601-1-inv.git-commit@tdk.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent a9dd9ba commit daec424

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ int inv_mpu6050_prepare_fifo(struct inv_mpu6050_state *st, bool enable)
111111
if (enable) {
112112
/* reset timestamping */
113113
inv_sensors_timestamp_reset(&st->timestamp);
114+
inv_sensors_timestamp_apply_odr(&st->timestamp, 0, 0, 0);
114115
/* reset FIFO */
115116
d = st->chip_config.user_ctrl | INV_MPU6050_BIT_FIFO_RST;
116117
ret = regmap_write(st->map, st->reg->user_ctrl, d);
@@ -184,6 +185,10 @@ static int inv_mpu6050_set_enable(struct iio_dev *indio_dev, bool enable)
184185
if (result)
185186
goto error_power_off;
186187
} else {
188+
st->chip_config.gyro_fifo_enable = 0;
189+
st->chip_config.accl_fifo_enable = 0;
190+
st->chip_config.temp_fifo_enable = 0;
191+
st->chip_config.magn_fifo_enable = 0;
187192
result = inv_mpu6050_prepare_fifo(st, false);
188193
if (result)
189194
goto error_power_off;

0 commit comments

Comments
 (0)