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>] [day] [month] [year] [list]
Date:   Tue, 1 Oct 2019 11:03:41 -0500
From:   Patrick Williams <alpawi@...zon.com>
To:     unlisted-recipients:; (no To-header on input)
CC:     Patrick Williams <alpawi@...zon.com>,
        Patrick Williams <patrick@...cx.xyz>,
        Guenter Roeck <linux@...ck-us.net>,
        Jean Delvare <jdelvare@...e.com>,
        <linux-hwmon@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH] hwmon: (pmbus) add VR12/VR13 mode support write paths

pmbus_core supported VR11/VR12/VR13 modes when reading
VID-formatted registers, but the write path only supported
VR11 translations.  Add support for VR12 and VR13 to
'data2reg_vid' for translating these formats.  This is the
inverse of 'reg2data_vid'.

Signed-off-by: Patrick Williams <alpawi@...zon.com>
---
 drivers/hwmon/pmbus/pmbus_core.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index 8470097907bc..f0d696552142 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -845,9 +845,19 @@ static u16 pmbus_data2reg_direct(struct pmbus_data *data,
 static u16 pmbus_data2reg_vid(struct pmbus_data *data,
 			      struct pmbus_sensor *sensor, long val)
 {
-	val = clamp_val(val, 500, 1600);
+	switch (data->info->vrm_version) {
+	case vr11:
+		val = clamp_val(val, 500, 1600);
+		return 2 + DIV_ROUND_CLOSEST((1600 - val) * 100, 625);
+	case vr12:
+		val = clamp_val(val, 0, 1520);
+		return ((val - 250) / 5) + 1;
+	case vr13:
+		val = clamp_val(val, 0, 2500);
+		return ((val - 500) / 10) + 1;
+	}
 
-	return 2 + DIV_ROUND_CLOSEST((1600 - val) * 100, 625);
+	return 0;
 }
 
 static u16 pmbus_data2reg(struct pmbus_data *data,
-- 
2.17.2 (Apple Git-113)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ