Skip to content

Commit 0331b1b

Browse files
Wer-Wolfjwrdegoede
authored andcommitted
platform/x86: dell-ddv: Fix temperature scaling
After using the built-in UEFI hardware diagnostics to compare the measured battery temperature, i noticed that the temperature is actually expressed in tenth degree kelvin, similar to the SBS-Data standard. For example, a value of 2992 is displayed as 26 degrees celsius. Fix the scaling so that the correct values are being displayed. Tested on a Dell Inspiron 3505. Fixes: a77272c ("platform/x86: dell: Add new dell-wmi-ddv driver") Signed-off-by: Armin Wolf <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Hans de Goede <[email protected]>
1 parent 001f61c commit 0331b1b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/platform/x86/dell/dell-wmi-ddv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <linux/kernel.h>
1818
#include <linux/hwmon.h>
1919
#include <linux/kstrtox.h>
20-
#include <linux/math.h>
2120
#include <linux/math64.h>
2221
#include <linux/module.h>
2322
#include <linux/mutex.h>
@@ -665,7 +664,8 @@ static ssize_t temp_show(struct device *dev, struct device_attribute *attr, char
665664
if (ret < 0)
666665
return ret;
667666

668-
return sysfs_emit(buf, "%d\n", DIV_ROUND_CLOSEST(value, 10));
667+
/* Use 2731 instead of 2731.5 to avoid unnecessary rounding */
668+
return sysfs_emit(buf, "%d\n", value - 2731);
669669
}
670670

671671
static ssize_t eppid_show(struct device *dev, struct device_attribute *attr, char *buf)

0 commit comments

Comments
 (0)