I'm trying to switch from Kernel 4.4.12 to 4.9.28 and seeing an immediate shutdown because of overtemperature:
[ 1.942609] i2c /dev entries driver
[ 1.949093] thermal thermal_zone5: critical temperature reached(87 C),shutting down
[ 1.956863] tmp102 0-0048: initialized
[ 1.960667] reboot: Failed to start orderly shutdown: forcing the issue
[ 1.967445] Emergency Sync complete
[ 1.972549] reboot: Power down
This problem occurs only after cold-start of the system, not after reboot.
It think the problem is caused by initialization, when switching the device from 12-bit to 13-bit mode. If the first read happens before the next conversion cycle, the temperature register still has a 12-bit value. The conversion to Celsius is then twice as high.
I worked around this problem by evaluating the LSB of the temperature register: a one indicates that value has 13 bits. I use this to right-shift the value accordingly:
static inline int tmp102_reg_to_mC(s16 val)
return ((val & ~0x01) * 1000) >> (8 - (val & 0x01));
Commit 3d8f7a89a197 ("hwmon: (tmp102) Improve handling of initial read delay") would be my prime suspect. Guenter?
My workaround using bit 0 of the temperature register doesn't seem to work. Bit 0 turns to 1 as soon as the 13-bit mode is activated, even if the contents are still 12 bits.
Yes, I guess it is 3d8f7a89a197. That commit sets the wait period only if the chip was shut down, but it appears that it is also needed if the resolution changes. I'll check the datasheet tonight to confirm and submit a patch.
Author: Guenter Roeck
Date: Mon Oct 23 17:36:03 2017 -0700
hwmon: (tmp102) Fix first temperature reading