mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2026-10-12 06:01:58 +00:00
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> |
History
|
|
|---|---|---|
| .. | ||
| ak8974.c | ||
| ak8975.c | ||
| bmc150_magn.c | ||
| bmc150_magn.h | ||
| bmc150_magn_i2c.c | ||
| bmc150_magn_spi.c | ||
| hid-sensor-magn-3d.c | ||
| hmc5843.h | ||
| hmc5843_core.c | ||
| hmc5843_i2c.c | ||
| hmc5843_spi.c | ||
| Kconfig | ||
| mag3110.c | ||
| Makefile | ||
| mmc35240.c | ||
| rm3100-core.c | ||
| rm3100-i2c.c | ||
| rm3100-spi.c | ||
| rm3100.h | ||
| st_magn.h | ||
| st_magn_buffer.c | ||
| st_magn_core.c | ||
| st_magn_i2c.c | ||
| st_magn_spi.c | ||
| tmag5273.c | ||
| yamaha-yas530.c | ||