Bragatheswaran Manickavel
c788b9e56a
iio/imu: inv_icm42600: Use max() helper macros
...
Use the standard max() helper macros instead of direct variable comparison
using if/else blocks or ternary operator. Change identified using
minmax.cocci Coccinelle semantic patch.
Signed-off-by: Bragatheswaran Manickavel <bragathemanick0908@gmail.com >
Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com >
Link: https://lore.kernel.org/r/20231027094410.3706-1-bragathemanick0908@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-11-16 19:10:28 +00:00
Jean-Baptiste Maneyrol
0ecc363cce
iio: make invensense timestamp module generic
...
Rename common module to inv_sensors_timestamp, add configuration
at init (chip internal clock, acceptable jitter, ...) and update
inv_icm42600 driver integration.
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20230606162147.79667-4-inv.git-commit@tdk.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-20 19:21:28 +01:00
Jean-Baptiste Maneyrol
d99ff463ec
iio: move inv_icm42600 timestamp module in common
...
Create new inv_sensors common modules and move inv_icm42600
timestamp module inside. This module will be used by IMUs and
also in the future by other chips.
Modify inv_icm42600 driver to use timestamp module and do some
headers cleanup.
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Link: https://lore.kernel.org/r/20230606162147.79667-3-inv.git-commit@tdk.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-07-20 19:21:28 +01:00
Jean-Baptiste Maneyrol
bbaae0c79e
iio: imu: inv_icm42600: fix timestamp reset
...
Timestamp reset is not done in the correct place. It must be done
before enabling buffer. The reason is that interrupt timestamping
is always happening when the chip is on, even if the
corresponding sensor is off. When the sensor restarts, timestamp
is wrong if you don't do a reset first.
Fixes: ec74ae9fd3 ("iio: imu: inv_icm42600: add accurate timestamping")
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com >
Cc: <stable@vger.kernel.org >
Link: https://lore.kernel.org/r/20230509152202.245444-1-inv.git-commit@tdk.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2023-05-20 17:33:14 +01:00
Jean-Baptiste Maneyrol
ec74ae9fd3
iio: imu: inv_icm42600: add accurate timestamping
...
Add a timestamping mechanism for buffer that provides accurate
event timestamps when using watermark. This mechanism estimates
device internal clock by comparing FIFO interrupts delta time and
device elapsed time computed by parsing FIFO data.
Take interrupt timestamp in hard irq handler and add IIO device
specific timestamp structures in device private allocation.
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com >
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2020-06-27 14:24:42 +01:00
Jean-Baptiste Maneyrol
7f85e42a6c
iio: imu: inv_icm42600: add buffer support in iio devices
...
Add all FIFO parsing and reading functions. Add accel and gyro
kfifo buffer and FIFO data parsing. Use device interrupt for
reading data FIFO and launching accel and gyro parsing.
Support hwfifo watermark by multiplexing gyro and accel settings.
Support hwfifo flush.
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com >
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2020-06-27 14:23:18 +01:00