linux/drivers/iio/magnetometer
Javier Carrasco 3b8157ec45 iio: tmag5273: fix temperature offset
The current offset has the scale already applied to it. The ABI
documentation defines the offset parameter as "offset to be added
to <type>[Y]_raw prior to scaling by <type>[Y]_scale in order to
obtain value in the <type> units as specified in <type>[Y]_raw
documentation"

The right value is obtained at 0 degrees Celsius by the formula provided
in the datasheet:

T = Tsens_t0 + (Tadc_t - Tadc_t0) / Tadc_res

where:
T = 0 degrees Celsius
Tsens_t0 (reference temperature) = 25 degrees Celsius
Tadc_t0 (16-bit format for Tsens_t0) = 17508
Tadc_res = 60.1 LSB/degree Celsius

The resulting offset is 16005.5, which has been truncated to 16005 to
provide an integer value with a precision loss smaller than the 1-LSB
measurement precision.

Fix the offset to apply its value prior to scaling.

Signed-off-by: Javier Carrasco <javier.carrasco@wolfvision.net>
Link: https://lore.kernel.org/r/9879beec-05fc-4fc6-af62-d771e238954e@wolfvision.net
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2023-11-25 15:13:18 +00:00
..
ak8974.c iio: Switch i2c drivers back to use .probe() 2023-05-21 18:54:53 +01:00
ak8975.c iio: magnetometer: ak8975: Fix 'Unexpected device' error 2023-10-05 15:54:45 +01:00
bmc150_magn_i2c.c iio: Switch i2c drivers back to use .probe() 2023-05-21 18:54:53 +01:00
bmc150_magn_spi.c Char/Misc and other driver updates for 5.18-rc1 2022-03-28 12:27:35 -07:00
bmc150_magn.c iio:magnetometer:mbc150: Make bmc150_magn_remove() return void 2022-06-11 14:35:27 +01:00
bmc150_magn.h iio:magnetometer:mbc150: Make bmc150_magn_remove() return void 2022-06-11 14:35:27 +01:00
hid-sensor-magn-3d.c iio: magnetometer: hid-sensor-magn-3d: Convert to platform remove callback returning void 2023-09-23 15:06:55 +01:00
hmc5843_core.c iio: magn: hmc5843: Move struct dev_pm_ops out of header 2022-08-15 22:30:02 +01:00
hmc5843_i2c.c iio: Switch i2c drivers back to use .probe() 2023-05-21 18:54:53 +01:00
hmc5843_spi.c iio: magn: hmc5843: Move struct dev_pm_ops out of header 2022-08-15 22:30:02 +01:00
hmc5843.h iio: magn: hmc5843: Move struct dev_pm_ops out of header 2022-08-15 22:30:02 +01:00
Kconfig iio: magnetometer: st_magn: Add LSM303C 2023-01-08 13:01:02 +00:00
mag3110.c iio: Switch i2c drivers back to use .probe() 2023-05-21 18:54:53 +01:00
Makefile iio: magnetometer: add ti tmag5273 driver 2022-12-28 17:19:44 +00:00
mmc35240.c iio: Switch i2c drivers back to use .probe() 2023-05-21 18:54:53 +01:00
rm3100-core.c iio: magnetometer: rm3100: do not explicity set INDIO_BUFFER_TRIGGERED mode 2022-07-16 17:57:22 +01:00
rm3100-i2c.c iio: Switch i2c drivers back to use .probe() 2023-05-21 18:54:53 +01:00
rm3100-spi.c iio:magnetometer:rm3100: Move exports to IIO_RM3100 namespace 2022-02-18 11:42:27 +00:00
rm3100.h
st_magn_buffer.c iio:st-sensors: Remove duplicate MODULE_* 2022-02-18 11:36:54 +00:00
st_magn_core.c iio: magnetometer: st_accel: Add LSM303D 2023-05-13 17:56:04 +01:00
st_magn_i2c.c iio: Switch i2c drivers back to use .probe() 2023-05-21 18:54:53 +01:00
st_magn_spi.c iio: magnetometer: st_magn: Add LSM303C 2023-01-08 13:01:02 +00:00
st_magn.h iio: magnetometer: st_magn: Add LSM303C 2023-01-08 13:01:02 +00:00
tmag5273.c iio: tmag5273: fix temperature offset 2023-11-25 15:13:18 +00:00
yamaha-yas530.c iio: magnetometer: yamaha-yas530: Use i2c_get_match_data() 2023-09-11 20:12:41 +01:00