Skip to contentSkip to conversation

hwmon: (tmp401) Add support for Nuvoton NCT7719W

PATCH In review [email protected] 3 participants 7 messages Dec 3 – Dec 4

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover hwmon: (tmp401) Add support for Nuvoton NCT7719W

From: Sheng-Yuan Huang <[email protected]>

Add support for the Nuvoton NCT7719W, a temperature sensor with one local and two remote channels.

The first patch updates the Device Tree binding. The second adds driver support and updates the hwmon documentation.

Sheng-Yuan Huang (2):
dt-bindings: hwmon: tmp401: Add Nuvoton NCT7719W
hwmon: (tmp401) Add support for Nuvoton NCT7719W

 .../devicetree/bindings/hwmon/ti,tmp401.yaml  |  27 ++-
 Documentation/hwmon/tmp401.rst                |  14 ++
 drivers/hwmon/tmp401.c                        | 213 ++++++++++++++++--
 3 files changed, 227 insertions(+), 27 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/2 dt-bindings: hwmon: tmp401: Add Nuvoton NCT7719W

From: Sheng-Yuan Huang <[email protected]>

Add the Nuvoton NCT7719W compatible to the TMP401 hwmon binding. Disallow TI-specific properties for this device.

---
 .../devicetree/bindings/hwmon/ti,tmp401.yaml  | 27 +++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/hwmon/ti,tmp401.yaml +25 -2
index f283b567d5b6..46f916c3a078 100644
@@ -4,7 +4,7 @@
 $id: http://devicetree.org/schemas/hwmon/ti,tmp401.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
-title: TMP401, TPM411 and TMP43x temperature sensor
+title: TMP401, TMP411, TMP43x, and NCT7719W temperature sensor
 
 maintainers:
   - Guenter Roeck <[email protected]>
@@ -12,7 +12,7 @@ maintainers:
 description: |
   ±1°C Remote and Local temperature sensor
 
-  Datasheets:
+  Texas Instruments datasheets:
   https://www.ti.com/lit/ds/symlink/tmp401.pdf
   https://www.ti.com/lit/ds/symlink/tmp411.pdf
   https://www.ti.com/lit/ds/symlink/tmp431.pdf
@@ -26,6 +26,7 @@ properties:
       - ti,tmp431
       - ti,tmp432
       - ti,tmp435
+      - nuvoton,nct7719w
 
   reg:
     maxItems: 1
@@ -75,6 +76,18 @@ allOf:
       properties:
         ti,beta-compensation: false
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - nuvoton,nct7719w
+    then:
+      properties:
+        ti,extended-range-enable: false
+        ti,n-factor: false
+        ti,beta-compensation: false
+
 required:
   - compatible
   - reg
@@ -105,3 +118,13 @@ examples:
         ti,beta-compensation = <0x7>;
       };
     };
+  - |
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      sensor@4d {
+        compatible = "nuvoton,nct7719w";
+        reg = <0x4d>;
+      };
+    };
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH v1 1/2] dt-bindings: hwmon: tmp401: Add Nuvoton NCT7719W

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] dt-bindings: hwmon: commit message omits hardware rationale for NCT7719W --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] dt-bindings: hwmon: commit message omits hardware rationale for NCT7719W
--

commit 782cd51dbfd8f7b51e1b7efeb1c1bc6d065413b1
Author: Sheng-Yuan Huang <[email protected]>

Quoted 6 lines

dt-bindings: hwmon: tmp401: Add Nuvoton NCT7719W

Add the Nuvoton NCT7719W compatible to the TMP401 hwmon binding. Disallow TI-specific properties for this device.

[Severity: Low]
Could the commit message explain the hardware rationale for adding nuvoton,nct7719w to ti,tmp401.yaml without a fallback compatible?

Sibling Nuvoton sensors (nct7716, nct7717, nct7718) are documented in Documentation/devicetree/bindings/hwmon/national,lm90.yaml. Without context, it is unclear why NCT7719W belongs in ti,tmp401.yaml instead or why it cannot fall back to a TMP43x compatible.

It would also help to note that NCT7719W shares the TMP432 channel layout with different register and encoding details, and lacks extended-range, n-factor, and beta-compensation support in hardware rather than merely in the driver.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#3 lore raw

PATCH 2/2 hwmon: (tmp401) Add support for Nuvoton NCT7719W

In reply to [email protected]

From: Sheng-Yuan Huang <[email protected]>

The NCT7719W has one local and two remote temperature channels. It uses signed temperature values and requires separate SMBus byte accesses for the high and low bytes of remote temperatures and limits.

---
 Documentation/hwmon/tmp401.rst |  14 +++
 drivers/hwmon/tmp401.c         | 213 +++++++++++++++++++++++++++++----
 2 files changed, 202 insertions(+), 25 deletions(-)
Documentation/hwmon/tmp401.rst +14 -0
index 3aacf3d3bdf3..35ca055be7cf 100644
@@ -3,6 +3,12 @@ Kernel driver tmp401
 
 Supported chips:
 
+  * Nuvoton NCT7719W
+
+    Prefix: 'nct7719w'
+
+    Addresses scanned: I2C 0x4d
+
   * Texas Instruments TMP401
 
     Prefix: 'tmp401'
@@ -61,6 +67,14 @@ sensor resolution can be set to 0.5, 0.25, 0.125 or 0.0625 degree (not
 supported by the driver so far, so using the default resolution of 0.5
 degree).
 
+It also supports the Nuvoton NCT7719W, which implements two remote and one
+local temperature sensors. Its remote temperature resolution is 0.125 degree
+and its local temperature resolution is 1 degree.
+
+The NCT7719W shares one critical temperature hysteresis offset across all
+three channels. Writing any ``tempX_crit_hyst`` attribute changes the
+offset used by all three.
+
 The driver provides the common sysfs-interface for temperatures (see
 Documentation/hwmon/sysfs-interface.rst under Temperatures).
 
drivers/hwmon/tmp401.c +188 -25

349 lines not on this page · raw message

Signature · 1 line
2.43.0
#4 lore raw
Thank you for your contribution! Sashiko AI review found 6 potential issues to consider: - [Medium] hwmon: (tmp401) unguarded split byte reads in tmp401_reg_read() for NCT7719W - [Medium] hwmon…

Thank you for your contribution! Sashiko AI review found 6 potential issues to consider:
- [Medium] hwmon: (tmp401) unguarded split byte reads in tmp401_reg_read() for NCT7719W
- [Medium] hwmon: (tmp401) tmp401_detect() skips register checks for NCT7719W
- [Low] hwmon: (tmp401) missing NCT7719W entry in SENSORS_TMP401 Kconfig help text
- [Low] hwmon: (tmp401) nct7719w_set_convrate() floors update_interval values
- [Low] hwmon: (tmp401) missing .data in tmp4xx_of_match for nuvoton,nct7719w
- [Low] hwmon: (tmp401) tmp401_detect() truncates s32 SMBus errors into u8 reg
--

commit f864dd6c74364eb055ac2dd4bb06ee2eab5a2c95
Author: Sheng-Yuan Huang <[email protected]>

hwmon: (tmp401) Add support for Nuvoton NCT7719W

This commit adds support for the Nuvoton NCT7719W temperature sensor to the tmp401 driver and its documentation, using separate SMBus byte accesses for remote temperatures and limits and signed temperature conversion.

Quoted 5 lines
Documentation/hwmon/tmp401.rst +0 -0
index 3aacf3d3bdf33..35ca055be7cf8 100644

Documentation/hwmon/tmp401.rst Kernel driver tmp401 · line 11

Quoted 9 lines
Documentation/hwmon/tmp401.rst +6 -0
@@ -3,6 +3,12 @@ Kernel driver tmp401
 
 Supported chips:
 
+  * Nuvoton NCT7719W
+
+    Prefix: 'nct7719w'
+
+    Addresses scanned: I2C 0x4d
+

[Severity: Low]
Should SENSORS_TMP401 in drivers/hwmon/Kconfig also be updated to list the Nuvoton NCT7719W? Documentation/hwmon/submitting-patches.rst asks that Kconfig stay in sync with the driver documentation when adding a new chip.

[ ... ]

Quoted 4 lines
drivers/hwmon/tmp401.c +0 -0
index 83aafe4bd3e72..745494acae0f2 100644

[ ... ]

Quoted 9 lines
drivers/hwmon/tmp401.c +5 -0
@@ -143,6 +147,55 @@ static int tmp401_reg_read(void *context, unsigned int reg, unsigned int *val)
 	struct tmp401_data *data = context;
 	struct i2c_client *client = data->client;
 	int regval;
+	int low_reg;
+	int low_val;
+
+	/* NCT7719W remote values and limits require separate byte accesses. */
+	if (data->kind == nct7719w) {

[ ... ]

drivers/hwmon/tmp401.c static int tmp401_reg_read(void *context, unsigned int reg, unsigned int *val) · line 198

Quoted 11 lines
drivers/hwmon/tmp401.c +11 -0
+		if (low_reg) {
+			regval = i2c_smbus_read_byte_data(client, reg);
+			if (regval < 0)
+				return regval;
+			low_val = i2c_smbus_read_byte_data(client, low_reg);
+			if (low_val < 0)
+				return low_val;
+			*val = (regval << 8) | (low_val & GENMASK(7, 5));
+			return 0;
+		}
+	}

[Severity: Medium]
Can reading the remote temperature high and low bytes (0x01/0x10 and 0x23/0x24) in two separate SMBus byte transactions return a torn value if an ADC conversion completes between them?

If the NCT7719W does not latch the low byte on a high-byte read, an integer rollover between the two reads can skew readings by up to 0.875 C for sysfs and thermal zone consumers. Re-reading the high byte (and low byte if it changed), as lm90_read16() does, avoids tearing either way.

[ ... ]

Quoted 6 lines
drivers/hwmon/tmp401.c +2 -0
@@ -409,6 +540,19 @@ static int tmp401_chip_read(struct device *dev, u32 attr, int channel, long *val
 	return 0;
 }
 
+static int nct7719w_set_convrate(struct regmap *regmap, long val)
+{

drivers/hwmon/tmp401.c static int tmp401_chip_read(struct device *dev, u32 attr, int channel, long *val · line 554

Quoted 10 lines
drivers/hwmon/tmp401.c +10 -0
+	int rate;
+	int interval;
+
+	val = clamp_val(val, 63, 16000);
+	interval = 16000;
+	for (rate = 0; rate < 8 && val < interval; rate++)
+		interval /= 2;
+
+	return regmap_write(regmap, TMP401_CONVERSION_RATE, rate);
+}

[Severity: Low]
Does nct7719w_set_convrate() floor non-exact update_interval values instead of rounding to the nearest supported rate?

Comparing val < interval rather than the midpoint means writing 15999 ms selects 8000 ms (or 124 ms selects 63 ms), doubling the sampling rate compared to tmp401_set_convrate() right below it.

[ ... ]

drivers/hwmon/tmp401.c static int tmp401_detect(struct i2c_client *client, · line 763

Quoted 10 lines
drivers/hwmon/tmp401.c +6 -0
@@ -605,6 +755,15 @@ static int tmp401_detect(struct i2c_client *client,
 
 	/* Detect and identify the chip */
 	reg = i2c_smbus_read_byte_data(client, TMP401_MANUFACTURER_ID_REG);
+	if (reg == NCT7719W_MANUFACTURER_ID) {
+		if (client->addr != 0x4d)
+			return -ENODEV;
+		reg = i2c_smbus_read_byte_data(client, TMP401_DEVICE_ID_REG);
+		if ((reg & NCT7719W_DEVICE_ID_MASK) != NCT7719W_DEVICE_ID)
+			return -ENODEV;

[Severity: Low]
Can truncating the signed return value of i2c_smbus_read_byte_data() into u8 reg cause a false positive on an SMBus error?

On PA-RISC, -ETIMEDOUT (-238) truncates to 0x12, so a timeout reading TMP401_DEVICE_ID_REG matches NCT7719W_DEVICE_ID and probes nct7719w. The same u8 reg lets -ERESTARTSYS (0x00) bypass the TI checks below; making reg an int and checking reg < 0 fixes both paths.

drivers/hwmon/tmp401.c static int tmp401_detect(struct i2c_client *client, · line 766

Quoted 3 lines
drivers/hwmon/tmp401.c +3 -0
+		strscpy(info->type, "nct7719w", I2C_NAME_SIZE);
+		return 0;
+	}

[Severity: Medium]
Is matching only 12 ID bits at address 0x4d enough to detect the NCT7719W reliably without checking any other registers?

Unlike the TI path below (and lm90_detect_nuvoton()), this skips checking TMP401_CONVERSION_RATE (0..8), reserved TMP401_CONFIG bits, or unused LSB and hysteresis bits. A false positive on an I2C_CLASS_HWMON bus causes tmp401_init_client() to write to an unrelated chip at 0x4d.

[ ... ]

drivers/hwmon/tmp401.c static const struct of_device_id __maybe_unused tmp4xx_of_match[] = { · line 908

Quoted 7 lines
drivers/hwmon/tmp401.c +1 -0
@@ -741,6 +903,7 @@ static const struct of_device_id __maybe_unused tmp4xx_of_match[] = {
 	{ .compatible = "ti,tmp431", },
 	{ .compatible = "ti,tmp432", },
 	{ .compatible = "ti,tmp435", },
+	{ .compatible = "nuvoton,nct7719w", },
 	{ },
 };

[Severity: Low]
Should this entry set .data = (void *)nct7719w instead of relying on the i2c_match_id() fallback?

With .data omitted, i2c_get_match_data() falls back to case-sensitive matching on client->name from index 0 of the compatible list. If a DT or ACPI PRP0001 table puts a more specific compatible first with nuvoton,nct7719w as a fallback, i2c_match_id() returns NULL.

tmp401_probe() then silently sets data->kind to tmp401, issuing unsupported SMBus word accesses and misdecoding temperatures.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
maintainer
#5 lore raw
In reply to [email protected]

Hi,

Quoted 8 lines · On Thu, Dec 03, 2026 at 04:46:33PM +0800, [email protected] wrote:

From: Sheng-Yuan Huang <[email protected]>

Add support for the Nuvoton NCT7719W, a temperature sensor with one local and two remote channels.

The first patch updates the Device Tree binding. The second adds driver support and updates the hwmon documentation.

Quoted 9 lines

Sheng-Yuan Huang (2):
dt-bindings: hwmon: tmp401: Add Nuvoton NCT7719W
hwmon: (tmp401) Add support for Nuvoton NCT7719W

 .../devicetree/bindings/hwmon/ti,tmp401.yaml  |  27 ++-
 Documentation/hwmon/tmp401.rst                |  14 ++
 drivers/hwmon/tmp401.c                        | 213 ++++++++++++++++--
 3 files changed, 227 insertions(+), 27 deletions(-)

These changes look quite invasive. I'll need to determine if it even makes sense to add support for this chip to the tmp401 driver, if it would be better to add it to another driver, or if it should be a separate driver. Would it be possible to send me a datasheet ?

Thanks,
Guenter

#6 lore raw

Guenter Roeck <[email protected]> 於 2026年12月4日週五 上午2:16寫道:

Quoted 6 lines

These changes look quite invasive. I'll need to determine if it even makes sense to add support for this chip to the tmp401 driver, if it would be better to add it to another driver, or if it should be a separate driver. Would it be possible to send me a datasheet ?

Thank you for your review. Yes, this specification can be shared with everyone. Please see the attachment.
Thank you!

Quoted 3 lines

Thanks,
Guenter