This is a note to let you know that I've just added the patch titled platform/x86: dell-ddv: Fix temperature scaling to the 6.2-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: platform-x86-dell-ddv-fix-temperature-scaling.patch and it can be found in the queue-6.2 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit a97c3fe2066f82437a8b6996bbb1159e01842ba1 Author: Armin Wolf <W_Armin@xxxxxx> Date: Sat Feb 18 12:53:18 2023 +0100 platform/x86: dell-ddv: Fix temperature scaling [ Upstream commit 0331b1b0ba65376ecf1c69414aa7696fef0930cb ] 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: a77272c16041 ("platform/x86: dell: Add new dell-wmi-ddv driver") Signed-off-by: Armin Wolf <W_Armin@xxxxxx> Link: https://lore.kernel.org/r/20230218115318.20662-2-W_Armin@xxxxxx Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx> Reviewed-by: Hans de Goede <hdegoede@xxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/platform/x86/dell/dell-wmi-ddv.c b/drivers/platform/x86/dell/dell-wmi-ddv.c index f99c4cb686fdc..96fede24877f3 100644 --- a/drivers/platform/x86/dell/dell-wmi-ddv.c +++ b/drivers/platform/x86/dell/dell-wmi-ddv.c @@ -14,7 +14,6 @@ #include <linux/errno.h> #include <linux/kernel.h> #include <linux/kstrtox.h> -#include <linux/math.h> #include <linux/module.h> #include <linux/limits.h> #include <linux/power_supply.h> @@ -192,7 +191,8 @@ static ssize_t temp_show(struct device *dev, struct device_attribute *attr, char if (ret < 0) return ret; - return sysfs_emit(buf, "%d\n", DIV_ROUND_CLOSEST(value, 10)); + /* Use 2731 instead of 2731.5 to avoid unnecessary rounding */ + return sysfs_emit(buf, "%d\n", value - 2731); } static ssize_t eppid_show(struct device *dev, struct device_attribute *attr, char *buf)