]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
power: supply: max17040: adjust thermal channel scaling
authorSvyatoslav Ryhel <clamor95@gmail.com>
Wed, 30 Apr 2025 06:02:39 +0000 (09:02 +0300)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Wed, 30 Apr 2025 22:50:14 +0000 (00:50 +0200)
IIO thermal channel is in millidegree while power supply framework expects
decidegree values. Adjust scaling to get correct readings.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Link: https://lore.kernel.org/r/20250430060239.12085-2-clamor95@gmail.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/max17040_battery.c

index 51310f6e4803b92468cde3aaf8a641a215846b69..c1640bc6accd27fd0338b9b34d5e81a163293a10 100644 (file)
@@ -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;