lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250430060239.12085-2-clamor95@gmail.com>
Date: Wed, 30 Apr 2025 09:02:39 +0300
From: Svyatoslav Ryhel <clamor95@...il.com>
To: Iskren Chernev <me@...ren.info>,
	Krzysztof Kozlowski <krzk@...nel.org>,
	Marek Szyprowski <m.szyprowski@...sung.com>,
	Matheus Castello <matheus@...tello.eng.br>,
	Sebastian Reichel <sre@...nel.org>,
	Jonathan Cameron <jic23@...nel.org>,
	Svyatoslav Ryhel <clamor95@...il.com>
Cc: linux-pm@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH v1 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.

Signed-off-by: Svyatoslav Ryhel <clamor95@...il.com>
---
 drivers/power/supply/max17040_battery.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c
index 51310f6e4803..c1640bc6accd 100644
--- a/drivers/power/supply/max17040_battery.c
+++ b/drivers/power/supply/max17040_battery.c
@@ -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;
-- 
2.48.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ