Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: imu: inv_icm45600: fix temperature offset reporting

Correct temperature computation is (raw + offset) * scale and not
apply scale and offset afterward.
Fix temperature offset reporting to the correct value and update
commentaries for the new computation.

Fixes: 27e072bc34d1 ("iio: imu: inv_icm45600: add IMU IIO gyroscope device")
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Jean-Baptiste Maneyrol and committed by
Jonathan Cameron
943cbf90 ea6b4feb

+5 -4
+5 -4
drivers/iio/imu/inv_icm45600/inv_icm45600_core.c
··· 960 960 return IIO_VAL_INT; 961 961 /* 962 962 * T°C = (temp / 128) + 25 963 - * Tm°C = 1000 * ((temp * 100 / 12800) + 25) 964 - * scale: 100000 / 13248 = 7.8125 965 - * offset: 25000 963 + * Tm°C = ((temp + 25 * 128) / 128)) * 1000 964 + * Tm°C = (temp + 3200) * (1000 / 128) 965 + * scale: 1000 / 128 = 7.8125 966 + * offset: 3200 966 967 */ 967 968 case IIO_CHAN_INFO_SCALE: 968 969 *val = 7; 969 970 *val2 = 812500; 970 971 return IIO_VAL_INT_PLUS_MICRO; 971 972 case IIO_CHAN_INFO_OFFSET: 972 - *val = 25000; 973 + *val = 3200; 973 974 return IIO_VAL_INT; 974 975 default: 975 976 return -EINVAL;