thermal: qcom-spmi-adc-tm5: fix all temperature reads failing with -EINVAL
Subsystems (5)
PATCH 1/1 thermal: qcom-spmi-adc-tm5: fix all temperature reads failing with -EINVAL
In reply to Paul Hollinskyadc_tm5_get_temp() rejects any iio_read_channel_processed() return value that is not IIO_VAL_INT. Since commit bb21ee31f575 ("iio: Fix iio_multiply_value use in iio_read_channel_processed_scale"), iio_read_channel_processed() returns 0 on success, per its documented contract, instead of passing through the value type from the underlying read.
Since IIO_VAL_INT is 1, every successful read now takes the error path, so get_temp() returns -EINVAL unconditionally and every ADC-TM5 thermal zone is dead: with no valid temperature readings the core cannot evaluate trip points. Observed on a SC7180 Trogdor Chromebook (Lenovo IdeaPad Duet 3 / wormdingler), where the charger and skin-temp zones report an error on every read.
The check no longer serves its original defensive purpose either: since commit 05f958d003c9 ("iio: Improve iio_read_channel_processed_scale() precision"), fractional value types are folded into the integer result by iio_multiply_value() inside the IIO core, so the return value carries no information beyond success or failure. Just drop the check and rely on the ret < 0 test above it.
qcom-spmi-adc-tm5 is the only iio_read_channel_processed() consumer in tree still testing the return value this way.
--- drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 3 --- 1 file changed, 3 deletions(-)
drivers/thermal/qcom/qcom-spmi-adc-tm5.c +0 -3
@@ -369,9 +369,6 @@ static int adc_tm5_get_temp(struct thermal_zone_device *tz, int *temp)if (ret <0 )return ret; -if (ret !=IIO_VAL_INT ) -return -EINVAL ; -return 0 ; }
Signature · 1 line
2.55.0
PATCH 1/1 thermal: qcom-spmi-adc-tm5: fix all temperature reads failing with -EINVAL
adc_tm5_get_temp() rejects any iio_read_channel_processed() return value that is not IIO_VAL_INT. Since commit bb21ee31f575 ("iio: Fix iio_multiply_value use in iio_read_channel_processed_scale"), iio_read_channel_processed() returns 0 on success, per its documented contract, instead of passing through the value type from the underlying read.
Since IIO_VAL_INT is 1, every successful read now takes the error path, so get_temp() returns -EINVAL unconditionally and every ADC-TM5 thermal zone is dead: with no valid temperature readings the core cannot evaluate trip points. Observed on a SC7180 Trogdor Chromebook (Lenovo IdeaPad Duet 3 / wormdingler), where the charger and skin-temp zones report an error on every read.
The check no longer serves its original defensive purpose either: since commit 05f958d003c9 ("iio: Improve iio_read_channel_processed_scale() precision"), fractional value types are folded into the integer result by iio_multiply_value() inside the IIO core, so the return value carries no information beyond success or failure. Just drop the check and rely on the ret < 0 test above it.
qcom-spmi-adc-tm5 is the only iio_read_channel_processed() consumer in tree still testing the return value this way.
--- drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 3 --- 1 file changed, 3 deletions(-)
drivers/thermal/qcom/qcom-spmi-adc-tm5.c +0 -3
@@ -369,9 +369,6 @@ static int adc_tm5_get_temp(struct thermal_zone_device *tz, int *temp)if (ret <0 )return ret; -if (ret !=IIO_VAL_INT ) -return -EINVAL ; -return 0 ; }
Signature · 1 line
2.55.0
Quoted 21 lines · On Fri, 7 Aug 2026 19:45:52 -0700 Paul Hollinsky <[email protected]>…
adc_tm5_get_temp()rejects anyiio_read_channel_processed()return value that is notIIO_VAL_INT. Since commitbb21ee31f575("iio: Fixiio_multiply_valueuse iniio_read_channel_processed_scale"),iio_read_channel_processed()returns 0 on success, per its documented contract, instead of passing through the value type from the underlying read.Since
IIO_VAL_INTis 1, every successful read now takes the error path, soget_temp()returns-EINVALunconditionally and every ADC-TM5 thermal zone is dead: with no valid temperature readings the core cannot evaluate trip points. Observed on a SC7180 Trogdor Chromebook (Lenovo IdeaPad Duet 3 / wormdingler), where the charger and skin-temp zones report an error on every read.The check no longer serves its original defensive purpose either: since commit
05f958d003c9("iio: Improveiio_read_channel_processed_scale()precision"), fractional value types are folded into the integer result byiio_multiply_value()inside the IIO core, so the return value carries no information beyond success or failure. Just drop the check and rely on the ret < 0 test above it.
Quoted 6 lines
qcom-spmi-adc-tm5 is the only
iio_read_channel_processed()consumer in tree still testing the return value this way.Fixes bb21ee31f575 ("iio: Fix iio_multiply_value use in iio_read_channel_processed_scale")Cc [email protected] # 6.18+Signed-off-by Paul Hollinsky <[email protected]>
Sorry about this. I thought we'd checked all of them but seems some slipped through.
Quoted 18 lines
--- drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 3 --- 1 file changed, 3 deletions(-)drivers/thermal/qcom/qcom-spmi-adc-tm5.c +0
-3@@ -369,9 +369,6 @@ static int adc_tm5_get_temp(struct thermal_zone_device *tz, int *temp)if (ret <0 )return ret; -if (ret !=IIO_VAL_INT ) -return -EINVAL ; -return 0 ; }
Quoted 48 lines · Paul Hollinsky
adc_tm5_get_temp()rejects anyiio_read_channel_processed()return value that is notIIO_VAL_INT. Since commitbb21ee31f575("iio: Fixiio_multiply_valueuse iniio_read_channel_processed_scale"),iio_read_channel_processed()returns 0 on success, per its documented contract, instead of passing through the value type from the underlying read.Since
IIO_VAL_INTis 1, every successful read now takes the error path, soget_temp()returns-EINVALunconditionally and every ADC-TM5 thermal zone is dead: with no valid temperature readings the core cannot evaluate trip points. Observed on a SC7180 Trogdor Chromebook (Lenovo IdeaPad Duet 3 / wormdingler), where the charger and skin-temp zones report an error on every read.The check no longer serves its original defensive purpose either: since commit
05f958d003c9("iio: Improveiio_read_channel_processed_scale()precision"), fractional value types are folded into the integer result byiio_multiply_value()inside the IIO core, so the return value carries no information beyond success or failure. Just drop the check and rely on the ret < 0 test above it.qcom-spmi-adc-tm5 is the only
iio_read_channel_processed()consumer in tree still testing the return value this way.Fixes bb21ee31f575 ("iio: Fix iio_multiply_value use in iio_read_channel_processed_scale")Cc [email protected] # 6.18+Signed-off-by Paul Hollinsky <[email protected]>--- drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 3 --- 1 file changed, 3 deletions(-)drivers/thermal/qcom/qcom-spmi-adc-tm5.c +0
-3@@ -369,9 +369,6 @@ static int adc_tm5_get_temp(struct thermal_zone_device *tz, int *temp)if (ret <0 )return ret; -if (ret !=IIO_VAL_INT ) -return -EINVAL ; -return 0 ; }Signature · 1 line
2.55.0
This looks like the right fix. Bumping it since it's been a few weeks with no reply.
Rakesh Kota already fixed this same regression in linux-next (0c569e22020f, "thermal/drivers/qcom-spmi-adc-tm5: Drop IIO_VAL_INT check in adc_tm5_get_temp", applied 2026-07-27), but it went in without Cc:
stable, so it never reached a stable branch. Paul's patch has the tag this needs.
It also hits sc8280xp laptops (ThinkPad X13s, Huawei Gaokun 3, Microsoft Arcata) through the same qcom,spmi-adc-tm5 compatible string. On the X13s it's the only software throttling path on a fanless chassis: no cooling-device entries anywhere in sc8280xp.dtsi's CPU thermal zones, just the board-level skin zone. The zone stays enabled, since it's threshold-interrupt rather than polled, but get_temp() always returns -EINVAL, so no trip ever evaluates. During an 8-core kernel build the skin thermistor hit 73.7°C, past its own 73°C critical trip, with zero throttling applied.
We've had 0c569e22020f backported onto our own 7.1.10- and 7.2-based kernels for a ~week now, confirmed clean: the zone comes back enabled with correct trip points, no disable message. Neither linux-7.1.y (7.1.10) nor linux-7.2.y (7.2) has picked it up upstream yet.
Mark