Skip to contentSkip to conversation

hwmon: (nct6775) Add support for NCT5525

PATCH Superseded Anton Lundin 4 participants 10 messages Nov 3 – Nov 6

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: (nct6775) Add support for NCT5525

Extend nct6775 driver to support NCT5525.

Assisted-by Copilot:GPT-5.6-Terra
---
 .../bindings/hwmon/nuvoton,nct6775.yaml       |   1 +
 Documentation/hwmon/nct6775.rst               |  10 +-
 drivers/hwmon/nct6775-core.c                  | 130 +++++++++++++++++-
 drivers/hwmon/nct6775-i2c.c                   |   6 +-
 drivers/hwmon/nct6775-platform.c              |  12 ++
 drivers/hwmon/nct6775.h                       |   3 +-
 6 files changed, 156 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/hwmon/nuvoton,nct6775.yaml +1 -0
index 244470282890..16c21f1f46ef 100644
@@ -25,6 +25,7 @@ properties:
       - nuvoton,nct6797
       - nuvoton,nct6798
       - nuvoton,nct6799
+      - nuvoton,nct5525
 
   reg:
     maxItems: 1
Documentation/hwmon/nct6775.rst +9 -1
index d2dedade0606..3e2992a1e24f 100644
@@ -48,6 +48,14 @@ Supported chips:
 
     Datasheet: Available from the Nuvoton web site
 
+  * Nuvoton NCT5525D
+
+    Prefix: 'nct5525'
+
+    Addresses scanned: ISA address retrieved from Super I/O registers
+
+    Datasheet: Available from Nuvoton upon request
+
   * Nuvoton NCT5572D/NCT6771F/NCT6772F/NCT6775F/W83677HG-I
 
     Prefix: 'nct6775'
@@ -159,7 +167,7 @@ direct temperature sensor inputs, the others are special sources such as PECI,
 PCH, and SMBUS. Depending on the chip type, 2 to 6 of the temperature sources
 can be monitored and compared against minimum, maximum, and critical
 temperatures. The driver reports up to 10 of the temperatures to the user.
-There are 4 to 5 fan rotation speed sensors, 8 to 15 analog voltage sensors,
+There are 3 to 7 fan rotation speed sensors, 8 to 18 analog voltage sensors,
 one VID, alarms with beep warnings (control unimplemented), and some automatic
 fan regulation strategies (plus manual fan control mode).
 
drivers/hwmon/nct6775-core.c +128 -2

190 lines not on this page · raw message

drivers/hwmon/nct6775-i2c.c +4 -2
index 07783910c058..3efae4bf5e4a 100644
@@ -88,6 +88,7 @@ static const struct of_device_id __maybe_unused nct6775_i2c_of_match[] = {
 	{ .compatible = "nuvoton,nct6797", .data = (void *)nct6797, },
 	{ .compatible = "nuvoton,nct6798", .data = (void *)nct6798, },
 	{ .compatible = "nuvoton,nct6799", .data = (void *)nct6799, },
+	{ .compatible = "nuvoton,nct5525", .data = (void *)nct5525, },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, nct6775_i2c_of_match);
@@ -106,6 +107,7 @@ static const struct i2c_device_id nct6775_i2c_id[] = {
 	{ .name = "nct6797", .driver_data = nct6797 },
 	{ .name = "nct6798", .driver_data = nct6798 },
 	{ .name = "nct6799", .driver_data = nct6799 },
+	{ .name = "nct5525", .driver_data = nct5525 },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, nct6775_i2c_id);
@@ -126,8 +128,8 @@ static int nct6775_i2c_probe_init(struct nct6775_data *data)
 	 * controlling/monitoring the fans -- these are thus unlikely to be
 	 * doing anything actually useful.
 	 */
-	data->has_fan = 0x03;
-	data->has_fan_min = 0x03;
+	data->has_fan = data->kind == nct5525 ? 0x07 : 0x03;
+	data->has_fan_min = data->has_fan;
 	data->has_pwm = 0x03;
 
 	/*
drivers/hwmon/nct6775-platform.c +12 -0
index d359c28f3e0f..3bc7a27d58a6 100644
@@ -37,6 +37,7 @@ static const char * const nct6775_sio_names[] __initconst = {
 	[nct6797] = "NCT6797D",
 	[nct6798] = "NCT6798D/NCT5585D",
 	[nct6799] = "NCT6796D-S/NCT6799D-R",
+	[nct5525] = "NCT5525D",
 };
 
 static unsigned short force_id;
@@ -91,6 +92,7 @@ MODULE_PARM_DESC(fan_debounce, "Enable debouncing for fan RPM signal");
 #define SIO_NCT6797_ID		0xd450
 #define SIO_NCT6798_ID		0xd428
 #define SIO_NCT6799_ID		0xd800
+#define SIO_NCT5525_ID		0xd2b0
 #define SIO_ID_MASK		0xFFF8
 
 /*
@@ -552,6 +554,8 @@ nct6775_check_fan_inputs(struct nct6775_data *data, struct nct6775_sio_data *sio
 
 		fan3pin = !(cr24 & 0x80);
 		pwm3pin = cr24 & 0x08;
+	} else if (data->kind == nct5525) {
+		fan3pin = true;
 	} else if (data->kind == nct6116) {
 		int cr1a = sio_data->sio_inb(sio_data, 0x1a);
 		int cr1b = sio_data->sio_inb(sio_data, 0x1b);
@@ -839,6 +843,8 @@ static umode_t nct6775_other_is_visible(struct kobject *kobj,
 		if (data->BEEP_BITS[INTRUSION_ALARM_BASE + index - 3] < 0)
 			return 0;
 	}
+	if (index == 5 && data->BEEP_BITS[BEEP_ENABLE_BASE] < 0)
+		return 0;
 
 	return nct6775_attr_mode(data, attr);
 }
@@ -883,6 +889,7 @@ static int nct6775_platform_probe_init(struct nct6775_data *data)
 		data->have_vid = (cr2a & 0x60) == 0x40;
 		break;
 	case nct6106:
+	case nct5525:
 	case nct6116:
 	case nct6126:
 	case nct6779:
@@ -919,6 +926,8 @@ static int nct6775_platform_probe_init(struct nct6775_data *data)
 		case nct6126:
 			tmp |= 0xe0;
 			break;
+		case nct5525:
+			break;
 		case nct6775:
 			tmp |= 0x1e;
 			break;
@@ -1072,6 +1081,9 @@ static int __init nct6775_find(int sioaddr, struct nct6775_sio_data *sio_data)
 	case SIO_NCT6799_ID:
 		sio_data->kind = nct6799;
 		break;
+	case SIO_NCT5525_ID:
+		sio_data->kind = nct5525;
+		break;
 	default:
 		if (val != 0xffff)
 			pr_debug("unsupported chip ID: 0x%04x\n", val);
drivers/hwmon/nct6775.h +2 -1
index d18ac91be497..d94a1c1a31f5 100644
@@ -5,7 +5,8 @@
 #include <linux/types.h>
 
 enum kinds { nct6106, nct6116, nct6126, nct6775, nct6776, nct6779, nct6791,
-	     nct6792, nct6793, nct6795, nct6796, nct6797, nct6798, nct6799 };
+	     nct6792, nct6793, nct6795, nct6796, nct6797, nct6798, nct6799,
+	     nct5525 };
 enum pwm_enable { off, manual, thermal_cruise, speed_cruise, sf3, sf4 };
 
 #define NUM_TEMP	12	/* Max number of temp attribute sets w/ limits*/
Signature · 1 line
2.47.3
#1 lore raw
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Medium] hwmon: (nct6775) nct6775_reg_is_word_sized() corrupts NCT5525 target regs - [Low] hwmon…

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] hwmon: (nct6775) nct6775_reg_is_word_sized() corrupts NCT5525 target regs
- [Low] hwmon: (nct6775) no-op fan_debounce handling in nct6775_platform_probe_init() --

commit b2c50b829c2c187ba7bd478ebf5b2095ec0b4f6d
Author: Anton Lundin <[email protected]>

hwmon: (nct6775) Add support for NCT5525

This commit adds hardware monitoring support for the Nuvoton NCT5525D chip to the nct6775 core, platform, and i2c drivers, as well as the device tree bindings and documentation.

Quoted 4 lines
drivers/hwmon/nct6775-core.c +0 -0
index cf27b9c7a89ed..fb99bdf16764a 100644

[ ... ]

drivers/hwmon/nct6775-core.c bool nct6775_reg_is_word_sized(struct nct6775_data *data, u16 reg) · line 1230

Quoted 8 lines
drivers/hwmon/nct6775-core.c +4 -0
@@ -1191,6 +1224,10 @@ bool nct6775_reg_is_word_sized(struct nct6775_data *data, u16 reg)
 		  (reg >= 0x59 && reg < 0x69 && (reg & 1)) ||
 		  reg == 0xe0 || reg == 0xe2 || reg == 0xe4 ||
 		  reg == 0x111 || reg == 0x121 || reg == 0x131;
+	case nct5525:
+		return reg == 0x20 || reg == 0x22 || reg == 0x28 ||
+		  reg == 0x59 || reg == 0x5b || reg == 0xe0 || reg == 0xe2 ||
+		  reg == 0xe8 || reg == 0x111 || reg == 0x121;

[Severity: Medium]
Should registers 0x111 and 0x121 be marked as word-sized in nct6775_reg_is_word_sized() for nct5525?

In drivers/hwmon/nct6775-core.c, nct6775_probe() configures nct5525 with:

	data->target_temp_mask = 0xff;
	data->REG_TARGET = NCT6106_REG_TARGET;
	data->REG_TOLERANCE_H = NCT6106_REG_TOLERANCE_H;

where NCT6106_REG_TARGET is { 0x111, 0x121, 0x131 } and NCT6106_REG_TOLERANCE_H is { 0x112, 0x122, 0x132 }.

When 0x111 and 0x121 are marked as word-sized, nct6775_read_value() performs a 16-bit big-endian read across reg (high byte) and reg + 1 (low byte), and nct6775_write_value() writes value >> 8 to reg and value & 0xff to reg + 1.

However, nct6775_update_pwm_limits() and pwm_update_registers() treat REG_TARGET and REG_TOLERANCE_H as separate 8-bit registers:

drivers/hwmon/nct6775-core.c:nct6775_update_pwm_limits() {
	...
	err = nct6775_read_value(data, data->REG_TARGET[i], &reg_t);
	if (err)
		return err;

	/* Update only in matching mode or if never updated */
	if (!data->target_temp[i] ||
	    data->pwm_enable[i] == thermal_cruise)
		data->target_temp[i] = reg_t & data->target_temp_mask;
	if (!data->target_speed[i] ||
	    data->pwm_enable[i] == speed_cruise) {
		if (data->REG_TOLERANCE_H) {
			err = nct6775_read_value(data, data->REG_TOLERANCE_H[i], &reg);
			if (err)
				return err;
			reg_t |= (reg & 0x0f) << 8;
		}
		data->target_speed[i] = reg_t;
	}
	...
}

And on write in pwm_update_registers():

drivers/hwmon/nct6775-core.c:pwm_update_registers() {
	...
	case speed_cruise:
		err = nct6775_write_value(data, data->REG_TARGET[nr],
					  data->target_speed[nr] & 0xff);
		...
	case thermal_cruise:
		err = nct6775_write_value(data, data->REG_TARGET[nr], data->target_temp[nr]);
	...
}

Because REG_TARGET[i] is read as a 16-bit big-endian value spanning 0x111 and 0x112, masking reg_t with target_temp_mask (0xff) discards byte 0x111 and reads byte 0x112 (REG_TOLERANCE_H) as the target temperature. Similarly, writing an 8-bit value to REG_TARGET[nr] in pwm_update_registers() writes 0x00 to 0x111/0x121 and overwrites 0x112/0x122 with the low byte.

Quoted 4 lines
drivers/hwmon/nct6775-platform.c +0 -0
index d359c28f3e0f3..3bc7a27d58a60 100644

[ ... ]

drivers/hwmon/nct6775-platform.c static int nct6775_platform_probe_init(struct nct6775_data *data) · line 933

Quoted 9 lines
drivers/hwmon/nct6775-platform.c +2 -0
@@ -919,6 +926,8 @@ static int nct6775_platform_probe_init(struct nct6775_data *data)
 		case nct6126:
 			tmp |= 0xe0;
 			break;
+		case nct5525:
+			break;
 		case nct6775:
 			tmp |= 0x1e;
 			break;

[Severity: Low]
In drivers/hwmon/nct6775-platform.c, when fan_debounce is enabled in nct6775_platform_probe_init(), the nct5525 case breaks without setting any bits in tmp, and then falls through to write the unchanged tmp value back to NCT6775_REG_CR_FAN_DEBOUNCE and log "Enabled fan debounce for chip ...":

drivers/hwmon/nct6775-platform.c:nct6775_platform_probe_init() {
	...
		sio_data->sio_outb(sio_data, NCT6775_REG_CR_FAN_DEBOUNCE,
			     tmp);
		pr_info("Enabled fan debounce for chip %s\n", data->name);
	}
}

Should nct5525 either set the appropriate debounce bits in tmp or skip writing NCT6775_REG_CR_FAN_DEBOUNCE and logging that fan debounce was enabled?

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

Extend nct6775 driver to support NCT5525.

Assisted-by Copilot:GPT-5.6-Terra

Please run scripts/checkpatch.pl on the patches and fix reported warnings. After that, run also 'scripts/checkpatch.pl --strict' on the patches and (probably) fix more warnings. Some warnings can be ignored, especially from --strict run, but the code here looks like it needs a fix. Feel free to get in touch if the warning is not clear.

Quoted 3 lines
---
 .../bindings/hwmon/nuvoton,nct6775.yaml       |   1 +

Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.

Tools like b4 or scripts/get_maintainer.pl provide you proper list of people, so fix your workflow. Tools might also fail if you work on some ancient tree (don't, instead use mainline) or work on fork of kernel (don't, instead use mainline). Just use b4 and everything should be fine, although remember about b4 prep --auto-to-cc if you added new patches to the patchset.

You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time.

Please kindly resend and include all necessary To/Cc entries.

Quoted 12 lines
 Documentation/hwmon/nct6775.rst               |  10 +-
 drivers/hwmon/nct6775-core.c                  | 130 +++++++++++++++++-
 drivers/hwmon/nct6775-i2c.c                   |   6 +-
 drivers/hwmon/nct6775-platform.c              |  12 ++
 drivers/hwmon/nct6775.h                       |   3 +-
 6 files changed, 156 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/hwmon/nuvoton,nct6775.yaml +0 -0
index 244470282890..16c21f1f46ef 100644

Documentation/devicetree/bindings/hwmon/nuvoton,nct6775.yaml properties: · line 28

Quoted 4 lines
Documentation/devicetree/bindings/hwmon/nuvoton,nct6775.yaml +1 -0
@@ -25,6 +25,7 @@ properties:
       - nuvoton,nct6797
       - nuvoton,nct6798
       - nuvoton,nct6799
+      - nuvoton,nct5525

Also, to spare you one review cycle - don't break the order.

Best regards,
Krzysztof

maintainer
#3 lore raw
In reply to Anton Lundin
Quoted 4 lines · Anton Lundin

Extend nct6775 driver to support NCT5525.

Assisted-by Copilot:GPT-5.6-Terra

I don't havea datasheet for this chip, but I do have to say that this seems to be off just form chip numbering perspective. From the registers it looks like the chip is mostly compatible with the NCT61xx series, but NCT55xx chips are typically scaled-down variants of MCT67xx series chips. I _will_ need to see a datasheet to confirm, or at the very least independent confirmation that the driver is correct.

Some more comments inline.

Quoted 54 lines
---
  .../bindings/hwmon/nuvoton,nct6775.yaml       |   1 +
  Documentation/hwmon/nct6775.rst               |  10 +-
  drivers/hwmon/nct6775-core.c                  | 130 +++++++++++++++++-
  drivers/hwmon/nct6775-i2c.c                   |   6 +-
  drivers/hwmon/nct6775-platform.c              |  12 ++
  drivers/hwmon/nct6775.h                       |   3 +-
  6 files changed, 156 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/hwmon/nuvoton,nct6775.yaml +1 -0
index 244470282890..16c21f1f46ef 100644
@@ -25,6 +25,7 @@ properties:
        - nuvoton,nct6797
        - nuvoton,nct6798
        - nuvoton,nct6799
+      - nuvoton,nct5525
 
    reg:
      maxItems: 1
Documentation/hwmon/nct6775.rst +9 -1
index d2dedade0606..3e2992a1e24f 100644
@@ -48,6 +48,14 @@ Supported chips:
 
      Datasheet: Available from the Nuvoton web site
 
+  * Nuvoton NCT5525D
+
+    Prefix: 'nct5525'
+
+    Addresses scanned: ISA address retrieved from Super I/O registers
+
+    Datasheet: Available from Nuvoton upon request
+
    * Nuvoton NCT5572D/NCT6771F/NCT6772F/NCT6775F/W83677HG-I
 
      Prefix: 'nct6775'
@@ -159,7 +167,7 @@ direct temperature sensor inputs, the others are special sources such as PECI,
  PCH, and SMBUS. Depending on the chip type, 2 to 6 of the temperature sources
  can be monitored and compared against minimum, maximum, and critical
  temperatures. The driver reports up to 10 of the temperatures to the user.
-There are 4 to 5 fan rotation speed sensors, 8 to 15 analog voltage sensors,
+There are 3 to 7 fan rotation speed sensors, 8 to 18 analog voltage sensors,
  one VID, alarms with beep warnings (control unimplemented), and some automatic
  fan regulation strategies (plus manual fan control mode).
 
drivers/hwmon/nct6775-core.c +0 -0
index cf27b9c7a89e..fb99bdf16764 100644

drivers/hwmon/nct6775-core.c line 41

Quoted 4 lines
drivers/hwmon/nct6775-core.c +1 -0
@@ -38,6 +38,7 @@
   * nct5585d    14      7       7       2+6    0xd428 0xc1    0x5ca3
   * nct6796d-s  18      7       7       6+2    0xd801 0xc1    0x5ca3
   * nct6799d-r  18      7       7       6+2    0xd802 0xc1    0x5ca3
+ * nct5525d     8      3       2       3+3    0xd2b3 0xc1    0x5ca3

Alphabetic order (unless associated with another chip).

drivers/hwmon/nct6775-core.c static const char * const nct6775_device_names[] = { · line 84

Quoted 8 lines
drivers/hwmon/nct6775-core.c +1 -0
   *
   * #temp lists the number of monitored temperature sources (first value) plus
   * the number of directly connectable temperature sensors (second value).
@@ -80,6 +81,7 @@ static const char * const nct6775_device_names[] = {
  	[nct6797] = "nct6797",
  	[nct6798] = "nct6798",
  	[nct6799] = "nct6799",
+	[nct5525] = "nct5525",

Alphabetic order.

Quoted 6 lines
drivers/hwmon/nct6775-core.c +0 -0
  };
 
  /* Common and NCT6775 specific data */
@@ -840,6 +842,33 @@ static const u16 NCT6106_REG_TEMP_CRIT[32] = {
 
  static const u16 NCT6106_REG_TSI_TEMP[] = { 0x59, 0x5b, 0x5d, 0x5f, 0x61, 0x63, 0x65, 0x67 };

drivers/hwmon/nct6775-core.c static const u16 NCT6106_REG_TEMP_CRIT[32] = { · line 853

Quoted 10 lines
drivers/hwmon/nct6775-core.c +9 -0
 
+/* NCT5525D specific data */
+
+static const u16 NCT5525_REG_IN_MAX[] = {
+	0x92, 0x94, 0x96, 0x9a, 0x9c, 0x9e, 0xa0, 0xa2 };
+static const u16 NCT5525_REG_IN_MIN[] = {
+	0x93, 0x95, 0x97, 0x9b, 0x9d, 0x9f, 0xa1, 0xa3 };
+static const u16 NCT5525_REG_IN[] = {
+	0x01, 0x02, 0x03, 0x05, 0x06, 0x07, 0x08, 0x09 };
+

The above are equivalent to the NCT6106 definitions. Please do not duplicate definitions unless necessary.

drivers/hwmon/nct6775-core.c static const u16 NCT6106_REG_TEMP_CRIT[32] = { · line 858

Quoted 5 lines
drivers/hwmon/nct6775-core.c +5 -0
+static const u16 NCT5525_REG_FAN[] = { 0x20, 0x22, 0x28 };
+static const u16 NCT5525_REG_FAN_MIN[] = { 0xe0, 0xe2, 0xe8 };
+static const u16 NCT5525_REG_FAN_PULSES[] = { 0xf6, 0xf6, 0xf5 };
+static const u16 NCT5525_FAN_PULSE_SHIFT[] = { 0, 2, 6 };
+

This suggests compatibility with NCT6116, with fans index 2 and 3 not populated. Would it be possible to model it that way ?

Quoted 28 lines
drivers/hwmon/nct6775-core.c +17 -0
+static const s8 NCT5525_ALARM_BITS[NUM_ALARM_BITS] = {
+	 1,  2,  3,  5,  6,  7,  8,  9, -1, -1, -1, -1,	  /* in0-in11     */
+	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,	  /* in12-in23    */
+	32, 33, 36, -1, -1, -1, -1, -1, -1, -1, -1, -1,	  /* fan1-fan12   */
+	16, 17, 18, -1, -1, -1, -1, -1, -1, -1, -1, -1,	  /* temp1-temp12 */
+	-1, -1,						  /* intr0-intr1  */
+};
+
+static const u16 NCT5525_REG_BEEP[NUM_REG_BEEP] = { 0 };
+static const s8 NCT5525_BEEP_BITS[NUM_BEEP_BITS] = {
+	[0 ... NUM_BEEP_BITS - 1] = -1,
+};
+
  /* NCT6112D/NCT6114D/NCT6116D specific data */
 
  static const u16 NCT6116_REG_FAN[] = { 0x20, 0x22, 0x24, 0x26, 0x28 };
@@ -1034,6 +1063,10 @@ static const u16 scale_in_6126[10] = {
  	800, 800, 1600, 1600, 800, 800, 1600, 1600, 1600, 800
  };
 
+static const u16 scale_in_5525[8] = {
+	800, 1600, 1600, 800, 1600, 1600, 1600, 800
+};
+
  static inline long in_from_reg(u8 reg, u8 nr, const u16 *scales)
  {
  	return DIV_ROUND_CLOSEST(reg * scales[nr], 100);

drivers/hwmon/nct6775-core.c bool nct6775_reg_is_word_sized(struct nct6775_data *data, u16 reg) · line 1230

Quoted 7 lines
drivers/hwmon/nct6775-core.c +4 -0
@@ -1191,6 +1224,10 @@ bool nct6775_reg_is_word_sized(struct nct6775_data *data, u16 reg)
  		  (reg >= 0x59 && reg < 0x69 && (reg & 1)) ||
  		  reg == 0xe0 || reg == 0xe2 || reg == 0xe4 ||
  		  reg == 0x111 || reg == 0x121 || reg == 0x131;
+	case nct5525:
+		return reg == 0x20 || reg == 0x22 || reg == 0x28 ||
+		  reg == 0x59 || reg == 0x5b || reg == 0xe0 || reg == 0xe2 ||
+		  reg == 0xe8 || reg == 0x111 || reg == 0x121;

Sashiko has some valid concerns here.

Quoted 12 lines
drivers/hwmon/nct6775-core.c +1 -0
  	case nct6116:
  	case nct6126:
  		return reg == 0x20 || reg == 0x22 || reg == 0x24 ||
@@ -1574,6 +1611,7 @@ static int nct6775_update_pwm_limits(struct device *dev)
  			data->auto_pwm[i][data->auto_pwm_num] = 0xff;
  			break;
  		case nct6106:
+		case nct5525:
  		case nct6116:
  		case nct6126:
  		case nct6779:

drivers/hwmon/nct6775-core.c static umode_t nct6775_in_is_visible(struct kobject *kobj, · line 1997

Quoted 5 lines
drivers/hwmon/nct6775-core.c +2 -0
@@ -1955,6 +1993,8 @@ static umode_t nct6775_in_is_visible(struct kobject *kobj,
 
  	if (nr == 1 && data->ALARM_BITS[in] == -1)
  		return 0;
+	if (nr == 2 && data->BEEP_BITS[in] == -1)
+		return 0;

This seems to be unrelated to this chip. Please do not make unrelated changes.

Quoted 5 lines
drivers/hwmon/nct6775-core.c +0 -0
  	if (!(data->have_in & BIT(in)))
  		return 0;
@@ -2398,8 +2438,12 @@ static umode_t nct6775_temp_is_visible(struct kobject *kobj,
  	if (nr == 2 && find_temp_source(data, temp, data->num_temp_alarms) < 0)

drivers/hwmon/nct6775-core.c static umode_t nct6775_temp_is_visible(struct kobject *kobj, · line 2446

Quoted 10 lines
drivers/hwmon/nct6775-core.c +6 -2
  		return 0;				/* alarm */
 
-	if (nr == 3 && find_temp_source(data, temp, data->num_temp_beeps) < 0)
-		return 0;				/* beep */
+	if (nr == 3) {
+		int source = find_temp_source(data, temp, data->num_temp_beeps);
+
+		if (source < 0 || data->BEEP_BITS[source + TEMP_ALARM_BASE] == -1)
+			return 0;			/* beep */
+	}

Same as above.

Quoted 104 lines
drivers/hwmon/nct6775-core.c +82 -0
  	if (nr == 4 && !data->reg_temp[1][temp])	/* max */
  		return 0;
@@ -3240,6 +3284,7 @@ store_auto_pwm(struct device *dev, struct device_attribute *attr,
  		case nct6776:
  			break; /* always enabled, nothing to do */
  		case nct6106:
+		case nct5525:
  		case nct6116:
  		case nct6126:
  		case nct6779:
@@ -3640,6 +3685,87 @@ int nct6775_probe(struct device *dev, struct nct6775_data *data,
  		reg_temp_crit_l = NCT6106_REG_TEMP_CRIT_L;
  		reg_temp_crit_h = NCT6106_REG_TEMP_CRIT_H;
 
+		break;
+	case nct5525:
+		data->in_num = 8;
+		data->scale_in = scale_in_5525;
+		data->pwm_num = 2;
+		data->auto_pwm_num = 4;
+		data->temp_fixed_num = 3;
+		data->num_temp_alarms = 3;
+		data->num_temp_beeps = 0;
+
+		data->ALARM_BITS = NCT5525_ALARM_BITS;
+		data->BEEP_BITS = NCT5525_BEEP_BITS;
+
+		data->fan_from_reg = fan_from_reg13;
+		data->fan_from_reg_min = fan_from_reg13;
+		data->target_temp_mask = 0xff;
+		data->tolerance_mask = 0x07;
+		data->speed_tolerance_limit = 63;
+
+		data->temp_label = nct6776_temp_label;
+		data->temp_mask = NCT6776_TEMP_MASK;
+		data->virt_temp_mask = NCT6776_VIRT_TEMP_MASK;
+
+		data->REG_VBAT = NCT6106_REG_VBAT;
+		data->REG_DIODE = NCT6106_REG_DIODE;
+		data->DIODE_MASK = NCT6106_DIODE_MASK;
+		data->REG_VIN = NCT5525_REG_IN;
+		data->REG_IN_MINMAX[0] = NCT5525_REG_IN_MIN;
+		data->REG_IN_MINMAX[1] = NCT5525_REG_IN_MAX;
+		data->REG_TARGET = NCT6106_REG_TARGET;
+		data->REG_FAN = NCT5525_REG_FAN;
+		data->REG_FAN_MODE = NCT6106_REG_FAN_MODE;
+		data->REG_FAN_MIN = NCT5525_REG_FAN_MIN;
+		data->REG_FAN_PULSES = NCT5525_REG_FAN_PULSES;
+		data->FAN_PULSE_SHIFT = NCT5525_FAN_PULSE_SHIFT;
+		data->REG_FAN_TIME[0] = NCT6106_REG_FAN_STOP_TIME;
+		data->REG_FAN_TIME[1] = NCT6106_REG_FAN_STEP_UP_TIME;
+		data->REG_FAN_TIME[2] = NCT6106_REG_FAN_STEP_DOWN_TIME;
+		data->REG_TOLERANCE_H = NCT6106_REG_TOLERANCE_H;
+		data->REG_PWM[0] = NCT6116_REG_PWM;
+		data->REG_PWM[1] = NCT6106_REG_FAN_START_OUTPUT;
+		data->REG_PWM[2] = NCT6106_REG_FAN_STOP_OUTPUT;
+		data->REG_PWM[5] = NCT6106_REG_WEIGHT_DUTY_STEP;
+		data->REG_PWM[6] = NCT6106_REG_WEIGHT_DUTY_BASE;
+		data->REG_PWM_READ = NCT6106_REG_PWM_READ;
+		data->REG_PWM_MODE = NCT6106_REG_PWM_MODE;
+		data->PWM_MODE_MASK = NCT6106_PWM_MODE_MASK;
+		data->REG_AUTO_TEMP = NCT6106_REG_AUTO_TEMP;
+		data->REG_AUTO_PWM = NCT6106_REG_AUTO_PWM;
+		data->REG_CRITICAL_TEMP = NCT6106_REG_CRITICAL_TEMP;
+		data->REG_CRITICAL_TEMP_TOLERANCE
+		  = NCT6106_REG_CRITICAL_TEMP_TOLERANCE;
+		data->REG_CRITICAL_PWM_ENABLE = NCT6106_REG_CRITICAL_PWM_ENABLE;
+		data->CRITICAL_PWM_ENABLE_MASK
+		  = NCT6106_CRITICAL_PWM_ENABLE_MASK;
+		data->REG_CRITICAL_PWM = NCT6106_REG_CRITICAL_PWM;
+		data->REG_TEMP_OFFSET = NCT6106_REG_TEMP_OFFSET;
+		data->REG_TEMP_SOURCE = NCT6106_REG_TEMP_SOURCE;
+		data->REG_TEMP_SEL = NCT6116_REG_TEMP_SEL;
+		data->REG_WEIGHT_TEMP_SEL = NCT6106_REG_WEIGHT_TEMP_SEL;
+		data->REG_WEIGHT_TEMP[0] = NCT6106_REG_WEIGHT_TEMP_STEP;
+		data->REG_WEIGHT_TEMP[1] = NCT6106_REG_WEIGHT_TEMP_STEP_TOL;
+		data->REG_WEIGHT_TEMP[2] = NCT6106_REG_WEIGHT_TEMP_BASE;
+		data->REG_ALARM = NCT6106_REG_ALARM;
+		data->REG_BEEP = NCT5525_REG_BEEP;
+		data->REG_TSI_TEMP = NCT6116_REG_TSI_TEMP;
+
+		reg_temp = NCT6106_REG_TEMP;
+		reg_temp_mon = NCT6106_REG_TEMP_MON;
+		num_reg_temp = 3;
+		num_reg_temp_mon = 2;
+		num_reg_tsi_temp = ARRAY_SIZE(NCT6116_REG_TSI_TEMP);
+		reg_temp_over = NCT6106_REG_TEMP_OVER;
+		reg_temp_hyst = NCT6106_REG_TEMP_HYST;
+		reg_temp_config = NCT6106_REG_TEMP_CONFIG;
+		num_reg_temp_config = 3;
+		reg_temp_alternate = NCT6106_REG_TEMP_ALTERNATE;
+		reg_temp_crit = NCT6106_REG_TEMP_CRIT;
+		reg_temp_crit_l = NCT6106_REG_TEMP_CRIT_L;
+		reg_temp_crit_h = NCT6106_REG_TEMP_CRIT_H;
+
  		break;
  	case nct6116:
  		data->in_num = 9;
drivers/hwmon/nct6775-i2c.c +0 -0
index 07783910c058..3efae4bf5e4a 100644

drivers/hwmon/nct6775-i2c.c static const struct of_device_id __maybe_unused nct6775_i2c_of_match[] = { · line 91

Quoted 4 lines
drivers/hwmon/nct6775-i2c.c +1 -0
@@ -88,6 +88,7 @@ static const struct of_device_id __maybe_unused nct6775_i2c_of_match[] = {
  	{ .compatible = "nuvoton,nct6797", .data = (void *)nct6797, },
  	{ .compatible = "nuvoton,nct6798", .data = (void *)nct6798, },
  	{ .compatible = "nuvoton,nct6799", .data = (void *)nct6799, },
+	{ .compatible = "nuvoton,nct5525", .data = (void *)nct5525, },

Alphabetic order, please. Everywhere, even if not explicitly mentioned.> { },

drivers/hwmon/nct6775-i2c.c static const struct i2c_device_id nct6775_i2c_id[] = { · line 110

Quoted 7 lines
drivers/hwmon/nct6775-i2c.c +1 -0
  };
  MODULE_DEVICE_TABLE(of, nct6775_i2c_of_match);
@@ -106,6 +107,7 @@ static const struct i2c_device_id nct6775_i2c_id[] = {
  	{ .name = "nct6797", .driver_data = nct6797 },
  	{ .name = "nct6798", .driver_data = nct6798 },
  	{ .name = "nct6799", .driver_data = nct6799 },
+	{ .name = "nct5525", .driver_data = nct5525 },

Alphabetic order, please.

Quoted 19 lines
drivers/hwmon/nct6775-i2c.c +2 -2
  	{ }
  };
  MODULE_DEVICE_TABLE(i2c, nct6775_i2c_id);
@@ -126,8 +128,8 @@ static int nct6775_i2c_probe_init(struct nct6775_data *data)
  	 * controlling/monitoring the fans -- these are thus unlikely to be
  	 * doing anything actually useful.
  	 */
-	data->has_fan = 0x03;
-	data->has_fan_min = 0x03;
+	data->has_fan = data->kind == nct5525 ? 0x07 : 0x03;
+	data->has_fan_min = data->has_fan;
  	data->has_pwm = 0x03;
 
  	/*
drivers/hwmon/nct6775-platform.c +0 -0
index d359c28f3e0f..3bc7a27d58a6 100644

drivers/hwmon/nct6775-platform.c static const char * const nct6775_sio_names[] __initconst = { · line 40

Quoted 4 lines
drivers/hwmon/nct6775-platform.c +1 -0
@@ -37,6 +37,7 @@ static const char * const nct6775_sio_names[] __initconst = {
  	[nct6797] = "NCT6797D",
  	[nct6798] = "NCT6798D/NCT5585D",
  	[nct6799] = "NCT6796D-S/NCT6799D-R",
+	[nct5525] = "NCT5525D",

Please retain alphabetic order.

Quoted 21 lines
drivers/hwmon/nct6775-platform.c +3 -0
  };
 
  static unsigned short force_id;
@@ -91,6 +92,7 @@ MODULE_PARM_DESC(fan_debounce, "Enable debouncing for fan RPM signal");
  #define SIO_NCT6797_ID		0xd450
  #define SIO_NCT6798_ID		0xd428
  #define SIO_NCT6799_ID		0xd800
+#define SIO_NCT5525_ID		0xd2b0
  #define SIO_ID_MASK		0xFFF8
 
  /*
@@ -552,6 +554,8 @@ nct6775_check_fan_inputs(struct nct6775_data *data, struct nct6775_sio_data *sio
 
  		fan3pin = !(cr24 & 0x80);
  		pwm3pin = cr24 & 0x08;
+	} else if (data->kind == nct5525) {
+		fan3pin = true;
  	} else if (data->kind == nct6116) {
  		int cr1a = sio_data->sio_inb(sio_data, 0x1a);
  		int cr1b = sio_data->sio_inb(sio_data, 0x1b);

drivers/hwmon/nct6775-platform.c static umode_t nct6775_other_is_visible(struct kobject *kobj, · line 847

Quoted 5 lines
drivers/hwmon/nct6775-platform.c +2 -0
@@ -839,6 +843,8 @@ static umode_t nct6775_other_is_visible(struct kobject *kobj,
  		if (data->BEEP_BITS[INTRUSION_ALARM_BASE + index - 3] < 0)
  			return 0;
  	}
+	if (index == 5 && data->BEEP_BITS[BEEP_ENABLE_BASE] < 0)
+		return 0;

That again seems to be unrelated to adding support for a new chip.>

Quoted 11 lines
drivers/hwmon/nct6775-platform.c +1 -0
  	return nct6775_attr_mode(data, attr);
  }
@@ -883,6 +889,7 @@ static int nct6775_platform_probe_init(struct nct6775_data *data)
  		data->have_vid = (cr2a & 0x60) == 0x40;
  		break;
  	case nct6106:
+	case nct5525:
  	case nct6116:
  	case nct6126:
  	case nct6779:

drivers/hwmon/nct6775-platform.c static int nct6775_platform_probe_init(struct nct6775_data *data) · line 930

Quoted 5 lines
drivers/hwmon/nct6775-platform.c +2 -0
@@ -919,6 +926,8 @@ static int nct6775_platform_probe_init(struct nct6775_data *data)
  		case nct6126:
  			tmp |= 0xe0;
  			break;
+		case nct5525:
+			break;

Why set fan_debounce if the chip does not support it ?

Quoted 18 lines
drivers/hwmon/nct6775-platform.c +3 -0
  		case nct6775:
  			tmp |= 0x1e;
  			break;
@@ -1072,6 +1081,9 @@ static int __init nct6775_find(int sioaddr, struct nct6775_sio_data *sio_data)
  	case SIO_NCT6799_ID:
  		sio_data->kind = nct6799;
  		break;
+	case SIO_NCT5525_ID:
+		sio_data->kind = nct5525;
+		break;
  	default:
  		if (val != 0xffff)
  			pr_debug("unsupported chip ID: 0x%04x\n", val);
drivers/hwmon/nct6775.h +0 -0
index d18ac91be497..d94a1c1a31f5 100644

drivers/hwmon/nct6775.h line 9

Quoted 6 lines
drivers/hwmon/nct6775.h +2 -1
@@ -5,7 +5,8 @@
  #include <linux/types.h>
 
  enum kinds { nct6106, nct6116, nct6126, nct6775, nct6776, nct6779, nct6791,
-	     nct6792, nct6793, nct6795, nct6796, nct6797, nct6798, nct6799 };
+	     nct6792, nct6793, nct6795, nct6796, nct6797, nct6798, nct6799,
+	     nct5525 };

Again, please retain alphabetic order.

Quoted 3 lines
drivers/hwmon/nct6775.h +0 -0
  enum pwm_enable { off, manual, thermal_cruise, speed_cruise, sf3, sf4 };
 
  #define NUM_TEMP	12	/* Max number of temp attribute sets w/ limits*/
#4 lore raw
In reply to Guenter Roeck
Quoted 7 lines · On 03 november, 2026 - Guenter Roeck wrote:
Quoted 4 lines · Anton Lundin

Extend nct6775 driver to support NCT5525.

Assisted-by Copilot:GPT-5.6-Terra
Quoted 5 lines

I don't havea datasheet for this chip, but I do have to say that this seems to be off just form chip numbering perspective. From the registers it looks like the chip is mostly compatible with the NCT61xx series, but NCT55xx chips are typically scaled-down variants of MCT67xx series chips.

Yes, its quite close. My first quick-n-dirty stab in the dark was to just alias it to NCT6116, and that worked surprisingly well.

Quoted 3 lines

I _will_ need to see a datasheet
to confirm, or at the very least independent confirmation that the driver is correct.

I have a datasheet which I could send you if you'd like, or if you rather request it yourself from Nuvoton.

Quoted 1 line

Some more comments inline.

i'll go through it and send a v2.

Quoted 7 lines

Documentation/devicetree/bindings/hwmon/nuvoton,nct6775.yaml properties: · line 28

Quoted 7 lines
Documentation/devicetree/bindings/hwmon/nuvoton,nct6775.yaml +1 -0
@@ -25,6 +25,7 @@ properties:
        - nuvoton,nct6797
        - nuvoton,nct6798
        - nuvoton,nct6799
+      - nuvoton,nct5525

I mostly added devicetree bindings because I saw that all the other variants the driver supports had them, but then I noticed that nct6126 was missing.

I won't consume the devicetree bindings, so should I rather leave that out until there's a consumer for it?

//Anton

maintainer
#5 lore raw
Quoted 18 lines · Anton Lundin
Quoted 7 lines · On 03 november, 2026 - Guenter Roeck wrote:
Quoted 4 lines · Anton Lundin

Extend nct6775 driver to support NCT5525.

Assisted-by Copilot:GPT-5.6-Terra
Quoted 5 lines

I don't havea datasheet for this chip, but I do have to say that this seems to be off just form chip numbering perspective.
From the registers it looks like the chip is mostly compatible
with the NCT61xx series, but NCT55xx chips are typically scaled-down variants of MCT67xx series chips.

Yes, its quite close. My first quick-n-dirty stab in the dark was to just alias it to NCT6116, and that worked surprisingly well.

Quoted 7 lines
Quoted 3 lines

I _will_ need to see a datasheet
to confirm, or at the very least independent confirmation that the driver is correct.

I have a datasheet which I could send you if you'd like, or if you rather request it yourself from Nuvoton.

It would be great if you can send it to me. I tried, but never got through to them. The form just did not work for some reason.

Quoted 16 lines
Quoted 1 line

Some more comments inline.

i'll go through it and send a v2.

Quoted 7 lines

Documentation/devicetree/bindings/hwmon/nuvoton,nct6775.yaml properties: · line 28

Quoted 7 lines
Documentation/devicetree/bindings/hwmon/nuvoton,nct6775.yaml +1 -0
@@ -25,6 +25,7 @@ properties:
         - nuvoton,nct6797
         - nuvoton,nct6798
         - nuvoton,nct6799
+      - nuvoton,nct5525

I mostly added devicetree bindings because I saw that all the other variants the driver supports had them, but then I noticed that nct6126 was missing.

Quoted 3 lines

I won't consume the devicetree bindings, so should I rather leave that out until there's a consumer for it?

Your call, really. If you add it, it will have to be a separate patch.

Guenter

#6 lore raw
In reply to Guenter Roeck
Quoted 15 lines · On 03 november, 2026 - Guenter Roeck wrote:
Quoted 4 lines · Anton Lundin

Extend nct6775 driver to support NCT5525.

Assisted-by Copilot:GPT-5.6-Terra

I don't havea datasheet for this chip, but I do have to say that this seems to be off just form chip numbering perspective. From the registers it looks like the chip is mostly compatible with the NCT61xx series, but NCT55xx chips are typically scaled-down variants of MCT67xx series chips. I _will_ need to see a datasheet to confirm, or at the very least independent confirmation that the driver is correct.

Quoted 1 line

Some more comments inline.

I've now reviewed all the comments and reworked the code. There are some things I'm still thinking about and I kindly ask for some guidance.

Quoted 8 lines
Quoted 8 lines
  };
  /* Common and NCT6775 specific data */
drivers/hwmon/nct6775-core.c +4 -0
@@ -840,6 +842,33 @@ static const u16 NCT6106_REG_TEMP_CRIT[32] = {
  static const u16 NCT6106_REG_TSI_TEMP[] = { 0x59, 0x5b, 0x5d, 0x5f, 0x61, 0x63, 0x65, 0x67 };
+/* NCT5525D specific data */
+
+static const u16 NCT5525_REG_IN_MAX[] = {
+	0x92, 0x94, 0x96, 0x9a, 0x9c, 0x9e, 0xa0, 0xa2 };
Quoted 8 lines

drivers/hwmon/nct6775-core.c static const u16 NCT6106_REG_TEMP_CRIT[32] = { · line 853

Quoted 5 lines
drivers/hwmon/nct6775-core.c +5 -0
+static const u16 NCT5525_REG_IN_MIN[] = {
+	0x93, 0x95, 0x97, 0x9b, 0x9d, 0x9f, 0xa1, 0xa3 };
+static const u16 NCT5525_REG_IN[] = {
+	0x01, 0x02, 0x03, 0x05, 0x06, 0x07, 0x08, 0x09 };
+

The above are equivalent to the NCT6106 definitions. Please do not duplicate definitions unless necessary.

I've now remodeled this into:

+ case nct5525:
...

+               data->REG_VIN = &NCT6106_REG_IN[1];
+               data->REG_IN_MINMAX[0] = &NCT6106_REG_IN_MIN[1];
+               data->REG_IN_MINMAX[1] = &NCT6106_REG_IN_MAX[1];

It's not the prettiest, but it works. Is that acceptable?

Quoted 8 lines

drivers/hwmon/nct6775-core.c static const u16 NCT6106_REG_TEMP_CRIT[32] = { · line 858

Quoted 5 lines
drivers/hwmon/nct6775-core.c +5 -0
+static const u16 NCT5525_REG_FAN[] = { 0x20, 0x22, 0x28 };
+static const u16 NCT5525_REG_FAN_MIN[] = { 0xe0, 0xe2, 0xe8 };
+static const u16 NCT5525_REG_FAN_PULSES[] = { 0xf6, 0xf6, 0xf5 };
+static const u16 NCT5525_FAN_PULSE_SHIFT[] = { 0, 2, 6 };
+

This suggests compatibility with NCT6116, with fans index 2 and 3 not populated. Would it be possible to model it that way ?

I'll rework it into that. The data sheet even calls it fan5 in one place, HM_Rev_Pulse_Fan5_Sel.

All the registers aligns nicely with this, so I think it's the right call.

The only interesting bit will be that the fan names are now 1 2 and 5.

In the data sheet they're SYSFAN, CPUFAN and AUXFAN.

Quoted 10 lines

drivers/hwmon/nct6775-core.c bool nct6775_reg_is_word_sized(struct nct6775_data *data, u16 reg) · line 1230

Quoted 8 lines
drivers/hwmon/nct6775-core.c +4 -0
@@ -1191,6 +1224,10 @@ bool nct6775_reg_is_word_sized(struct nct6775_data *data, u16 reg)
  		  (reg >= 0x59 && reg < 0x69 && (reg & 1)) ||
  		  reg == 0xe0 || reg == 0xe2 || reg == 0xe4 ||
  		  reg == 0x111 || reg == 0x121 || reg == 0x131;
+	case nct5525:
+		return reg == 0x20 || reg == 0x22 || reg == 0x28 ||
+		  reg == 0x59 || reg == 0x5b || reg == 0xe0 || reg == 0xe2 ||
+		  reg == 0xe8 || reg == 0x111 || reg == 0x121;

Sashiko has some valid concerns here.

This is the same as for nct6106, nct6116 and nct6126.

As far as I see it, we would need to look if we're in speed-cruise mode or thermal-cruise mode, and adjust if we read word sized or not.

Any preference on how that should be done or should I just make something up?

//Anton

#7 lore raw
Quoted 4 lines · On 06 november, 2026 - Anton Lundin wrote:
Quoted 2 lines · On 03 november, 2026 - Guenter Roeck wrote:
Quoted 1 line · Anton Lundin

Extend nct6775 driver to support NCT5525.

...

Quoted 11 lines
Quoted 10 lines

drivers/hwmon/nct6775-core.c bool nct6775_reg_is_word_sized(struct nct6775_data *data, u16 reg) · line 1230

Quoted 8 lines
drivers/hwmon/nct6775-core.c +4 -0
@@ -1191,6 +1224,10 @@ bool nct6775_reg_is_word_sized(struct nct6775_data *data, u16 reg)
  		  (reg >= 0x59 && reg < 0x69 && (reg & 1)) ||
  		  reg == 0xe0 || reg == 0xe2 || reg == 0xe4 ||
  		  reg == 0x111 || reg == 0x121 || reg == 0x131;
+	case nct5525:
+		return reg == 0x20 || reg == 0x22 || reg == 0x28 ||
+		  reg == 0x59 || reg == 0x5b || reg == 0xe0 || reg == 0xe2 ||
+		  reg == 0xe8 || reg == 0x111 || reg == 0x121;

Sashiko has some valid concerns here.

Quoted 7 lines

This is the same as for nct6106, nct6116 and nct6126.

As far as I see it, we would need to look if we're in speed-cruise mode or thermal-cruise mode, and adjust if we read word sized or not.

Any preference on how that should be done or should I just make something up?

After stearing it down for a while it became pretty clear how to solve it.

The code already handles it correctly, it's just that the register is always read as word sized which is wrong.

//Anton

maintainer
#8 lore raw
In reply to Anton Lundin
Quoted 47 lines · Anton Lundin
Quoted 15 lines · On 03 november, 2026 - Guenter Roeck wrote:
Quoted 4 lines · Anton Lundin

Extend nct6775 driver to support NCT5525.

Assisted-by Copilot:GPT-5.6-Terra

I don't havea datasheet for this chip, but I do have to say that this seems to be off just form chip numbering perspective.
From the registers it looks like the chip is mostly compatible
with the NCT61xx series, but NCT55xx chips are typically scaled-down variants of MCT67xx series chips. I _will_ need to see a datasheet to confirm, or at the very least independent confirmation that the driver is correct.

Quoted 1 line

Some more comments inline.

I've now reviewed all the comments and reworked the code. There are some things I'm still thinking about and I kindly ask for some guidance.

Quoted 8 lines
Quoted 8 lines
   };
   /* Common and NCT6775 specific data */
drivers/hwmon/nct6775-core.c +4 -0
@@ -840,6 +842,33 @@ static const u16 NCT6106_REG_TEMP_CRIT[32] = {
   static const u16 NCT6106_REG_TSI_TEMP[] = { 0x59, 0x5b, 0x5d, 0x5f, 0x61, 0x63, 0x65, 0x67 };
+/* NCT5525D specific data */
+
+static const u16 NCT5525_REG_IN_MAX[] = {
+	0x92, 0x94, 0x96, 0x9a, 0x9c, 0x9e, 0xa0, 0xa2 };
Quoted 8 lines

drivers/hwmon/nct6775-core.c static const u16 NCT6106_REG_TEMP_CRIT[32] = { · line 853

Quoted 5 lines
drivers/hwmon/nct6775-core.c +5 -0
+static const u16 NCT5525_REG_IN_MIN[] = {
+	0x93, 0x95, 0x97, 0x9b, 0x9d, 0x9f, 0xa1, 0xa3 };
+static const u16 NCT5525_REG_IN[] = {
+	0x01, 0x02, 0x03, 0x05, 0x06, 0x07, 0x08, 0x09 };
+

The above are equivalent to the NCT6106 definitions. Please do not duplicate definitions unless necessary.

I've now remodeled this into:

(quoted diff) +4 -0
+       case nct5525:
...
+               data->REG_VIN = &NCT6106_REG_IN[1];
+               data->REG_IN_MINMAX[0] = &NCT6106_REG_IN_MIN[1];
+               data->REG_IN_MINMAX[1] = &NCT6106_REG_IN_MAX[1];
Quoted 2 lines

It's not the prettiest, but it works. Is that acceptable?

No, just keep as is. I missed that the first voltage (register 0x00) isn't supported on this chip (assuming that is true).

Quoted 30 lines
Quoted 8 lines

drivers/hwmon/nct6775-core.c static const u16 NCT6106_REG_TEMP_CRIT[32] = { · line 858

Quoted 5 lines
drivers/hwmon/nct6775-core.c +5 -0
+static const u16 NCT5525_REG_FAN[] = { 0x20, 0x22, 0x28 };
+static const u16 NCT5525_REG_FAN_MIN[] = { 0xe0, 0xe2, 0xe8 };
+static const u16 NCT5525_REG_FAN_PULSES[] = { 0xf6, 0xf6, 0xf5 };
+static const u16 NCT5525_FAN_PULSE_SHIFT[] = { 0, 2, 6 };
+

This suggests compatibility with NCT6116, with fans index 2 and 3 not populated. Would it be possible to model it that way ?

I'll rework it into that. The data sheet even calls it fan5 in one place, HM_Rev_Pulse_Fan5_Sel.

All the registers aligns nicely with this, so I think it's the right call.

The only interesting bit will be that the fan names are now 1 2 and 5.

In the data sheet they're SYSFAN, CPUFAN and AUXFAN.

Quoted 10 lines

drivers/hwmon/nct6775-core.c bool nct6775_reg_is_word_sized(struct nct6775_data *data, u16 reg) · line 1230

Quoted 8 lines
drivers/hwmon/nct6775-core.c +4 -0
@@ -1191,6 +1224,10 @@ bool nct6775_reg_is_word_sized(struct nct6775_data *data, u16 reg)
   		  (reg >= 0x59 && reg < 0x69 && (reg & 1)) ||
   		  reg == 0xe0 || reg == 0xe2 || reg == 0xe4 ||
   		  reg == 0x111 || reg == 0x121 || reg == 0x131;
+	case nct5525:
+		return reg == 0x20 || reg == 0x22 || reg == 0x28 ||
+		  reg == 0x59 || reg == 0x5b || reg == 0xe0 || reg == 0xe2 ||
+		  reg == 0xe8 || reg == 0x111 || reg == 0x121;

Sashiko has some valid concerns here.

Quoted 8 lines

This is the same as for nct6106, nct6116 and nct6126.

As far as I see it, we would need to look if we're in speed-cruise mode or thermal-cruise mode, and adjust if we read word sized or not.

Any preference on how that should be done or should I just make something up?

Problem is that the second register is shared across tolerance_h and target_speed_h. I don't know (and have no time to figure out) if the code handles this correctly.

Fix appreciated if needed.

Thanks,
Guenter