diff options
| author | Guenter Roeck <linux@roeck-us.net> | 2026-10-30 20:02:08 -0700 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2026-11-02 07:00:05 -0800 |
| commit | 7cd60538073e465310c94b2a2f0ea8d2f03768ef (patch) | |
| tree | e5a1c98a4465fa19bb856df0aca631d2c9094dad /scripts/const_structs.checkpatch | |
| parent | 3897309ede38d7f3ff34c4c4583b1dd345666988 (diff) | |
hwmon: (tmp108) Fix initial conversion delay and wait until ready
In tmp108_common_probe(), the driver only adds the 30 ms conversion delay
(TMP108_CONVERSION_TIME_MS) to ready_time if the sensor was previously in
TMP108_MODE_SHUTDOWN. However, the TMP108 hardware defaults to continuous
conversion mode (TMP108_MODE_CONTINUOUS) upon power-on reset, including
immediately after enabling the vcc supply regulator during probe, while
the temperature register retains its power-on reset value of 0x0000 (0°C)
until the first conversion completes. Because the initial mode is not
shutdown, the delay is bypassed and early reads via thermal zone
registration or sysfs before the first conversion finishes return an
uninitialized 0°C reading.
In addition, returning -EAGAIN from tmp108_read() while waiting for a
conversion to complete after probe or resume can trigger an unnecessary
tight retry loop in callers or fail initial reads.
Unconditionally set ready_time to TMP108_CONVERSION_TIME_MS ahead in
tmp108_common_probe(), track ready_time as ktime_t, and wait for the
remaining conversion time in tmp108_read() using usleep_range() instead
of returning -EAGAIN.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Fixes: 66e1c9171339 ("hwmon: Add Texas Instruments TMP108 temperature sensor driver.")
Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'scripts/const_structs.checkpatch')
0 files changed, 0 insertions, 0 deletions
