Skip to contentSkip to conversation

power: supply: max17040: adjust thermal channel scaling

PATCH Applied Svyatoslav Ryhel 2 participants 3 messages Apr 30, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover power: supply: max17040: adjust thermal channel scaling

IIO thermal channel is in millidegree while power supply framework expects decidegree values. Adjust scaling to get correct readings.

Svyatoslav Ryhel (1):
power: supply: max17040: adjust thermal channel scaling

 drivers/power/supply/max17040_battery.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Signature · 1 line
2.48.1
#1 lore raw

PATCH 1/1 power: supply: max17040: adjust thermal channel scaling

IIO thermal channel is in millidegree while power supply framework expects decidegree values. Adjust scaling to get correct readings.

---
 drivers/power/supply/max17040_battery.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/power/supply/max17040_battery.c +3 -2
index 51310f6e4803..c1640bc6accd 100644
@@ -410,8 +410,9 @@ static int max17040_get_property(struct power_supply *psy,
 		if (!chip->channel_temp)
 			return -ENODATA;
 
-		iio_read_channel_processed_scale(chip->channel_temp,
-						 &val->intval, 10);
+		iio_read_channel_processed(chip->channel_temp, &val->intval);
+		val->intval /= 100; /* Convert from milli- to deci-degree */
+
 		break;
 	default:
 		return -EINVAL;
Signature · 1 line
2.48.1
#2 lore raw
In reply to Svyatoslav Ryhel
Quoted 10 lines · Svyatoslav Ryhel

IIO thermal channel is in millidegree while power supply framework expects decidegree values. Adjust scaling to get correct readings.

Svyatoslav Ryhel (1):
power: supply: max17040: adjust thermal channel scaling

drivers/power/supply/max17040_battery.c | 5 +++--

 1 file changed, 3 insertions(+), 2 deletions(-)

[...]

Applied, thanks!

[1/1] power: supply: max17040: adjust thermal channel scaling

      commit: d055f51731744243b244aafb1720f793a5b61f7b

Best regards,

Signature · 1 line
Sebastian Reichel <[email protected]>