FAILED: patch "[PATCH] iio: invensense: fix multiple odr switch when FIFO is off" failed to apply to 6.6-stable tree
[email protected]
maintainerThe patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x ef5f5e7b6f73f79538892a8be3a3bee2342acc9f
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024120613-exploring-lifter-215f@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From ef5f5e7b6f73f79538892a8be3a3bee2342acc9f Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Maneyrol <[email protected]>
Date: Mon, 21 Oct 2024 10:38:42 +0200
Subject: [PATCH] iio: invensense: fix multiple odr switch when FIFO is off
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.
drivers/iio/common/inv_sensors/inv_sensors_timestamp.c +4 -0
@@ -70,6 +70,10 @@ int inv_sensors_timestamp_update_odr(struct inv_sensors_timestamp *ts,if (mult != ts->mult) ts->new_mult = mult; +/* When FIFO is off, directly apply the new ODR */ +if (!fifo) +inv_sensors_timestamp_apply_odr (ts,0 ,0 ,0 ); +return 0 ; }EXPORT_SYMBOL_NS_GPL (inv_sensors_timestamp_update_odr,IIO_INV_SENSORS_TIMESTAMP );
drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c +0 -2
@@ -200,7 +200,6 @@ static int inv_icm42600_accel_update_scan_mode(struct iio_dev *indio_dev, {struct inv_icm42600_state *st =iio_device_get_drvdata (indio_dev);struct inv_icm42600_sensor_state *accel_st =iio_priv (indio_dev); -struct inv_sensors_timestamp *ts = &accel_st->ts;struct inv_icm42600_sensor_conf conf =INV_ICM42600_SENSOR_CONF_INIT ;unsigned int fifo_en =0 ;unsigned int sleep_temp =0 ;
@@ -229,7 +228,6 @@ static int inv_icm42600_accel_update_scan_mode(struct iio_dev *indio_dev, }/* update data FIFO write */ -inv_sensors_timestamp_apply_odr (ts,0 ,0 ,0 ); ret =inv_icm42600_buffer_set_fifo_en (st, fifo_en | st->fifo.en); out_unlock:
drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c +0 -3
@@ -99,8 +99,6 @@ static int inv_icm42600_gyro_update_scan_mode(struct iio_dev *indio_dev, const unsigned long *scan_mask) {struct inv_icm42600_state *st =iio_device_get_drvdata (indio_dev); -struct inv_icm42600_sensor_state *gyro_st =iio_priv (indio_dev); -struct inv_sensors_timestamp *ts = &gyro_st->ts;struct inv_icm42600_sensor_conf conf =INV_ICM42600_SENSOR_CONF_INIT ;unsigned int fifo_en =0 ;unsigned int sleep_gyro =0 ;
@@ -128,7 +126,6 @@ static int inv_icm42600_gyro_update_scan_mode(struct iio_dev *indio_dev, }/* update data FIFO write */ -inv_sensors_timestamp_apply_odr (ts,0 ,0 ,0 ); ret =inv_icm42600_buffer_set_fifo_en (st, fifo_en | st->fifo.en); out_unlock:
drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c +0 -1
@@ -112,7 +112,6 @@ int inv_mpu6050_prepare_fifo(struct inv_mpu6050_state *st, bool enable)if (enable) {/* reset timestamping */ inv_sensors_timestamp_reset (&st->timestamp); -inv_sensors_timestamp_apply_odr (&st->timestamp,0 ,0 ,0 );/* reset FIFO */ d = st->chip_config.user_ctrl |INV_MPU6050_BIT_FIFO_RST ; ret =regmap_write (st->map, st->reg->user_ctrl, d);
PATCH 1/1 iio: invensense: fix multiple odr switch when FIFO is off
From: Jean-Baptiste Maneyrol <[email protected]>
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.
--- drivers/iio/common/inv_sensors/inv_sensors_timestamp.c | 4 ++++ drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c | 2 -- drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c | 2 -- drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c | 1 - 4 files changed, 4 insertions(+), 5 deletions(-)
drivers/iio/common/inv_sensors/inv_sensors_timestamp.c +4 -0
@@ -70,6 +70,10 @@ int inv_sensors_timestamp_update_odr(struct inv_sensors_timestamp *ts,if (mult != ts->mult) ts->new_mult = mult; +/* When FIFO is off, directly apply the new ODR */ +if (!fifo) +inv_sensors_timestamp_apply_odr (ts,0 ,0 ,0 ); +return 0 ; }EXPORT_SYMBOL_NS_GPL (inv_sensors_timestamp_update_odr,IIO_INV_SENSORS_TIMESTAMP );
drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c +0 -2
@@ -99,7 +99,6 @@ static int inv_icm42600_accel_update_scan_mode(struct iio_dev *indio_dev, const unsigned long *scan_mask) {struct inv_icm42600_state *st =iio_device_get_drvdata (indio_dev); -struct inv_sensors_timestamp *ts =iio_priv (indio_dev);struct inv_icm42600_sensor_conf conf =INV_ICM42600_SENSOR_CONF_INIT ;unsigned int fifo_en =0 ;unsigned int sleep_temp =0 ;
@@ -127,7 +126,6 @@ static int inv_icm42600_accel_update_scan_mode(struct iio_dev *indio_dev, }/* update data FIFO write */ -inv_sensors_timestamp_apply_odr (ts,0 ,0 ,0 ); ret =inv_icm42600_buffer_set_fifo_en (st, fifo_en | st->fifo.en); out_unlock:
drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c +0 -2
@@ -99,7 +99,6 @@ static int inv_icm42600_gyro_update_scan_mode(struct iio_dev *indio_dev, const unsigned long *scan_mask) {struct inv_icm42600_state *st =iio_device_get_drvdata (indio_dev); -struct inv_sensors_timestamp *ts =iio_priv (indio_dev);struct inv_icm42600_sensor_conf conf =INV_ICM42600_SENSOR_CONF_INIT ;unsigned int fifo_en =0 ;unsigned int sleep_gyro =0 ;
@@ -127,7 +126,6 @@ static int inv_icm42600_gyro_update_scan_mode(struct iio_dev *indio_dev, }/* update data FIFO write */ -inv_sensors_timestamp_apply_odr (ts,0 ,0 ,0 ); ret =inv_icm42600_buffer_set_fifo_en (st, fifo_en | st->fifo.en); out_unlock:
drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c +0 -1
@@ -111,7 +111,6 @@ int inv_mpu6050_prepare_fifo(struct inv_mpu6050_state *st, bool enable)if (enable) {/* reset timestamping */ inv_sensors_timestamp_reset (&st->timestamp); -inv_sensors_timestamp_apply_odr (&st->timestamp,0 ,0 ,0 );/* reset FIFO */ d = st->chip_config.user_ctrl |INV_MPU6050_BIT_FIFO_RST ; ret =regmap_write (st->map, st->reg->user_ctrl, d);
Signature · 1 line
2.47.1
Sasha Levin
maintainerRe: [PATCH 6.6.y] iio: invensense: fix multiple odr switch when FIFO is off
[ Sasha's backport helper bot ]
Hi,
Found matching upstream commit: ef5f5e7b6f73f79538892a8be3a3bee2342acc9f
WARNING: Author mismatch between patch and found commit:
Backport author: [email protected]
Commit author: Jean-Baptiste Maneyrol <[email protected]>
Status in newer kernel trees:
6.12.y | Not found
6.6.y | Not found
Note: The patch differs from the upstream commit:
---
1: ef5f5e7b6f73f ! 1: cd8eeb84a6377 iio: invensense: fix multiple odr switch when FIFO is off
@@ Commit message
Signed-off-by: Jean-Baptiste Maneyrol <[email protected]>
Link: https://patch.msgid.link/20241021-invn-inv-sensors-timestamp-fix-switch-fifo-off-v2-1-39ffd43edcc4@tdk.com
Signed-off-by: Jonathan Cameron <[email protected]>
+ (cherry picked from commit ef5f5e7b6f73f79538892a8be3a3bee2342acc9f)
## drivers/iio/common/inv_sensors/inv_sensors_timestamp.c ##
@@ drivers/iio/common/inv_sensors/inv_sensors_timestamp.c: int inv_sensors_timestamp_update_odr(struct inv_sensors_timestamp *ts,
@@ drivers/iio/common/inv_sensors/inv_sensors_timestamp.c: int inv_sensors_timestam
## drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c ##
@@ drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c: static int inv_icm42600_accel_update_scan_mode(struct iio_dev *indio_dev,
+ const unsigned long *scan_mask)
{
struct inv_icm42600_state *st = iio_device_get_drvdata(indio_dev);
- struct inv_icm42600_sensor_state *accel_st = iio_priv(indio_dev);
-- struct inv_sensors_timestamp *ts = &accel_st->ts;
+- struct inv_sensors_timestamp *ts = iio_priv(indio_dev);
struct inv_icm42600_sensor_conf conf = INV_ICM42600_SENSOR_CONF_INIT;
unsigned int fifo_en = 0;
unsigned int sleep_temp = 0;
@@ drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c: static int inv_icm42600_gyro_u
const unsigned long *scan_mask)
{
struct inv_icm42600_state *st = iio_device_get_drvdata(indio_dev);
-- struct inv_icm42600_sensor_state *gyro_st = iio_priv(indio_dev);
-- struct inv_sensors_timestamp *ts = &gyro_st->ts;
+- struct inv_sensors_timestamp *ts = iio_priv(indio_dev);
struct inv_icm42600_sensor_conf conf = INV_ICM42600_SENSOR_CONF_INIT;
unsigned int fifo_en = 0;
unsigned int sleep_gyro = 0;---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-6.6.y | Success | Success |