Linux Hardware Monitor development
 help / color / mirror / Atom feed
* [PATCH] hwmon: (nct6683) Remove the 32 mV voltage scale
@ 2026-11-07 15:06 Tomasz Bojanowski
  2026-11-07 15:09 ` sashiko-bot
  2026-11-07 16:28 ` Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Tomasz Bojanowski @ 2026-11-07 15:06 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-hwmon, linux-kernel, Hamza Mahfooz

in_from_reg() is meant to scale the VCC, VSB, AVSB and VBAT sources
by 32 mV, but show_in_reg() passes it the monitor channel of the first
three voltage sensors instead of the source of the sensor shown. The
32 mV case therefore never matches, and all voltages have been scaled
by 16 mV since commit 41082d66bfd6 ("hwmon: Driver for NCT6683D").

According to the datasheet, there is no 32 mV LSB. On an MSI MAG
B850M MORTAR WIFI (NCT6687D, customer ID 0x20d), VCC reads 3.31 V,
VSB and AVSB 3.34 V and VBAT 3.10 V with 16 mV. With 32 mV they would
read 6.6 V, 6.7 V and 6.2 V.

Drop the source argument and the 32 mV case. No functional change.

Link: https://lore.kernel.org/linux-hwmon/20261106144247.30507-1-tomasz@bojanowski.me/
Signed-off-by: Tomasz Bojanowski <tomasz@bojanowski.me>
---
On this board, CPU Vcore is connected to VIN4 (confirmed from the EC
monitor configuration registers) and reads 1.33-1.36 V with 16 mV
with the cores at 5.5 GHz, so a separate 8 mV scale for Vcore does
not apply here. I have no data from boards of other vendors.

 drivers/hwmon/nct6683.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/hwmon/nct6683.c b/drivers/hwmon/nct6683.c
index d0ae3daaf049..b5c5931d3dfe 100644
--- a/drivers/hwmon/nct6683.c
+++ b/drivers/hwmon/nct6683.c
@@ -503,20 +503,10 @@ nct6683_create_attr_group(struct device *dev,
 	return group;
 }
 
-/* LSB is 16 mV, except for the following sources, where it is 32 mV */
-#define MON_SRC_VCC	0x60
-#define MON_SRC_VSB	0x61
-#define MON_SRC_AVSB	0x62
-#define MON_SRC_VBAT	0x64
-
-static inline long in_from_reg(u16 reg, u8 src)
+/* LSB is 16 mV */
+static inline long in_from_reg(u8 reg)
 {
-	int scale = 16;
-
-	if (src == MON_SRC_VCC || src == MON_SRC_VSB || src == MON_SRC_AVSB ||
-	    src == MON_SRC_VBAT)
-		scale <<= 1;
-	return reg * scale;
+	return reg * 16;
 }
 
 static u16 nct6683_read(struct nct6683_data *data, u16 reg)
@@ -701,7 +691,7 @@ show_in_reg(struct device *dev, struct device_attribute *attr, char *buf)
 	int nr = sattr->nr;
 
 	return sprintf(buf, "%ld\n",
-		       in_from_reg(data->in[index][nr], data->in_index[index]));
+		       in_from_reg(data->in[index][nr]));
 }
 
 static umode_t nct6683_in_is_visible(struct kobject *kobj,
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-07 16:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-07 15:06 [PATCH] hwmon: (nct6683) Remove the 32 mV voltage scale Tomasz Bojanowski
2026-11-07 15:09 ` sashiko-bot
2026-11-07 16:28 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox