Skip to content

Commit 95444b9

Browse files
jmaneyrol-invnjic23
authored andcommitted
iio: invensense: fix odr switching to same value
ODR switching happens in 2 steps, update to store the new value and then apply when the ODR change flag is received in the data. When switching to the same ODR value, the ODR change flag is never happening, and frequency switching is blocked waiting for the never coming apply. Fix the issue by preventing update to happen when switching to same ODR value. Fixes: 0ecc363 ("iio: make invensense timestamp module generic") Cc: stable@vger.kernel.org Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> Link: https://lore.kernel.org/r/20240524124851.567485-1-inv.git-commit@tdk.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent f00dd89 commit 95444b9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/iio/common/inv_sensors/inv_sensors_timestamp.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,15 @@ EXPORT_SYMBOL_NS_GPL(inv_sensors_timestamp_init, IIO_INV_SENSORS_TIMESTAMP);
6060
int inv_sensors_timestamp_update_odr(struct inv_sensors_timestamp *ts,
6161
uint32_t period, bool fifo)
6262
{
63+
uint32_t mult;
64+
6365
/* when FIFO is on, prevent odr change if one is already pending */
6466
if (fifo && ts->new_mult != 0)
6567
return -EAGAIN;
6668

67-
ts->new_mult = period / ts->chip.clock_period;
69+
mult = period / ts->chip.clock_period;
70+
if (mult != ts->mult)
71+
ts->new_mult = mult;
6872

6973
return 0;
7074
}

0 commit comments

Comments
 (0)