Thread (3 messages) flat view 3 messages, 2 authors, 8d ago

Re: [PATCH v3] hwmon: (lm75) Add support for Nuvoton NCT7715

From: Guenter Roeck <linux@roeck-us.net>
Date: 2026-09-15 14:37:44
Also in: linux-devicetree, linux-hwmon, lkml

On 9/14/26 22:20, hsyemail2@gmail.com wrote:
quoted hunk ↗ jump to hunk
From: Sheng-Yuan Huang <redacted>

The Nuvoton NCT7715 is compatible with the LM75 temperature and
limit register layout. Its 16-bit configuration register shares the
TMP112 configuration layout.

Signed-off-by: Sheng-Yuan Huang <redacted>
---
v3:
- Reuse the existing TMP112 handling for NCT7715 configuration,
   update intervals, and alarms.

v2:
- Use the standard SMBus word representation for the NCT7715
   configuration register, removing the NCT7715-specific byte swapping
   and updating its configuration masks accordingly.
   
  .../devicetree/bindings/hwmon/lm75.yaml       |  2 ++
  Documentation/hwmon/lm75.rst                  |  6 ++++++
  drivers/hwmon/lm75.c                          | 21 ++++++++++++++++++-
  3 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/hwmon/lm75.yaml b/Documentation/devicetree/bindings/hwmon/lm75.yaml
index b48bf3fd721f..d55b8b7e49c5 100644
--- a/Documentation/devicetree/bindings/hwmon/lm75.yaml
+++ b/Documentation/devicetree/bindings/hwmon/lm75.yaml
@@ -31,6 +31,7 @@ properties:
        - nxp,p3t1750
        - nxp,p3t1755
        - nxp,pct2075
+      - nuvoton,nct7715
Sorry, I did not notice this before. Devicetree changes have to be
made with a separate patch.
quoted hunk ↗ jump to hunk
        - st,stds75
        - st,stlm75
        - microchip,tcn75
@@ -78,6 +79,7 @@ allOf:
                  - ti,tmp101
                  - ti,tmp112
                  - ti,tmp75
+                - nuvoton,nct7715
      then:
        properties:
          interrupts: false
diff --git a/Documentation/hwmon/lm75.rst b/Documentation/hwmon/lm75.rst
index ca46754e028b..fac0b8f29ddc 100644
--- a/Documentation/hwmon/lm75.rst
+++ b/Documentation/hwmon/lm75.rst
@@ -150,6 +150,12 @@ Supported chips:
  
                 https://ams.com/documents/20143/36005/AS6200_DS000449_4-00.pdf
  
+  * Nuvoton NCT7715
+
+    Prefix: 'nct7715'
+
+    Addresses scanned: none
+
  Author: Frodo Looijaard <frodol@dds.nl>
  
  Description
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
index 2d2d752aeac9..1a98ecb142c9 100644
--- a/drivers/hwmon/lm75.c
+++ b/drivers/hwmon/lm75.c
@@ -39,6 +39,7 @@ enum lm75_type {		/* keep sorted in alphabetical order */
  	max6626,
  	max31725,
  	mcp980x,
+	nct7715,
  	p3t1750,
  	p3t1755,
  	pct2075,
@@ -259,6 +260,16 @@ static const struct lm75_params device_params[] = {
  		.sample_times = (unsigned int []){ 30, 60, 120, 240 },
  		.resolutions = (u8 []) {9, 10, 11, 12 },
  	},
+	[nct7715] = {
+		.config_reg_16bits = true,
+		.set_mask = 0x8060,	/* 12-bit mode, 4 samples / second */
+		.clr_mask = 1 << 7,	/* no one-shot mode */
+		.default_resolution = 12,
+		.default_sample_time = 250,
+		.num_sample_times = 4,
+		.sample_times = (unsigned int []){ 125, 250, 1000, 4000 },
+		.alarm = true,
+	},
  	[tmp100] = {
  		.set_mask = 3 << 5,	/* 12-bit mode */
  		.clr_mask = 1 << 7,	/* not one-shot mode */
@@ -417,6 +428,7 @@ static int lm75_read(struct device *dev, enum hwmon_sensor_types type,
  		if (attr == hwmon_temp_alarm) {
  			switch (data->kind) {
  			case as6200:
+			case nct7715:
  			case tmp112:
  				*val = !!(regval & BIT(13)) == !!(regval & BIT(2));
  				break;
@@ -486,6 +498,7 @@ static int lm75_update_interval(struct device *dev, long val)
  		if (data->params->resolutions)
  			data->resolution = data->params->resolutions[index];
  		break;
+	case nct7715:
  	case tmp112:
  	case as6200:
  		err = regmap_update_bits(data->regmap, LM75_REG_CONF,
@@ -848,6 +861,7 @@ static const struct i2c_device_id lm75_i2c_ids[] = {
  	{ .name = "max31725", .driver_data = max31725 },
  	{ .name = "max31726", .driver_data = max31725 },
  	{ .name = "mcp980x", .driver_data = mcp980x },
+	{ .name = "nct7715", .driver_data = nct7715 },
  	{ .name = "p3t1750", .driver_data = p3t1750 },
  	{ .name = "p3t1755", .driver_data = p3t1755 },
  	{ .name = "pct2075", .driver_data = pct2075 },
@@ -972,6 +986,10 @@ static const struct of_device_id lm75_of_match[] = {
  		.compatible = "nxp,pct2075",
  		.data = (void *)pct2075
  	},
+	{
+		.compatible = "nuvoton,nct7715",
+		.data = (void *)nct7715
+	},
  	{
  		.compatible = "st,stds75",
  		.data = (void *)stds75
@@ -1129,7 +1147,8 @@ static int lm75_suspend(struct device *dev)
  {
  	struct lm75_data *data = dev_get_drvdata(dev);
  
-	return regmap_update_bits(data->regmap, LM75_REG_CONF, LM75_SHUTDOWN, LM75_SHUTDOWN);
+	return regmap_update_bits(data->regmap, LM75_REG_CONF,
+				  LM75_SHUTDOWN, LM75_SHUTDOWN);
Drop this change.

Thanks,
Guenter
  }
  
  static int lm75_resume(struct device *dev)
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help