]> git.hungrycats.org Git - linux/commit
iio: invensense: fix multiple odr switch when FIFO is off
authorJean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Mon, 21 Oct 2024 08:38:42 +0000 (10:38 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 Dec 2024 09:41:09 +0000 (10:41 +0100)
commitc11a06753211c186fa67b1fefb64a027e6a2e8dc
tree85602ac1a92385b0f762c321e678d0faa8523458
parent1344ff89fe4d6fb892b87ca27c1abbe76c66a39b
iio: invensense: fix multiple odr switch when FIFO is off

commit ef5f5e7b6f73f79538892a8be3a3bee2342acc9f upstream.

When multiple ODR switch happens during FIFO off, the change could
not be taken into account if you get back to previous FIFO on value.
For example, if you run sensor buffer at 50Hz, stop, change to
200Hz, then back to 50Hz and restart buffer, data will be timestamped
at 200Hz. This due to testing against mult and not new_mult.

To prevent this, let's just run apply_odr automatically when FIFO is
off. It will also simplify driver code.

Update inv_mpu6050 and inv_icm42600 to delete now useless apply_odr.

Fixes: 95444b9eeb8c ("iio: invensense: fix odr switching to same value")
Cc: stable@vger.kernel.org
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://patch.msgid.link/20241021-invn-inv-sensors-timestamp-fix-switch-fifo-off-v2-1-39ffd43edcc4@tdk.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c
drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c
drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c