]> git.baikalelectronics.ru Git - kernel.git/commit
hwmon: (tmp102) Fix first temperature reading
authorGuenter Roeck <linux@roeck-us.net>
Tue, 24 Oct 2017 00:36:03 +0000 (17:36 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Tue, 24 Oct 2017 13:17:14 +0000 (06:17 -0700)
commit07c16ad7fe6dd28e2054d6f7fee3c7d043c4e8da
treee7a5edbed6f1ed383bb12702c1c01b6aae326d80
parent3084baa32c6d93687a84fae32bf039b4e1a7024f
hwmon: (tmp102) Fix first temperature reading

Commit f4b47bd3c135 ("hwmon: (tmp102) Improve handling of initial read
delay") reduced the initial temperature read delay and made it dependent
on the chip's shutdown mode. If the chip was not in shutdown mode at probe,
the read delay no longer applies.

This ignores the fact that the chip initialization changes the temperature
sensor resolution, and that the temperature register values change when
the resolution is changed. As a result, the reported temperature is twice
as high as the real temperature until the first temperature conversion
after the configuration change is complete. This can result in unexpected
behavior and, worst case, in a system shutdown. To fix the problem,
let's just always wait for a conversion to complete before reporting
a temperature.

Fixes: f4b47bd3c135 ("hwmon: (tmp102) Improve handling of initial read delay")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=197167
Reported-by: Ralf Goebel <ralf.goebel@imago-technologies.com>
Cc: Ralf Goebel <ralf.goebel@imago-technologies.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/tmp102.c