Linux Hardware Monitor development
 help / color / mirror / Atom feed
* [RFC PATCH v2 0/3] hwmon: asus-ec-sensors: MAXIMUS XI HERO Fan Extension Card
@ 2026-11-28 19:12 John den Heijer
  2026-11-28 19:12 ` [RFC PATCH v2 1/3] hwmon: (asus-ec-sensors) propagate EC read and selector errors John den Heijer
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: John den Heijer @ 2026-11-28 19:12 UTC (permalink / raw)
  To: linux-hwmon; +Cc: eugene.shalygin, linux

This is a request for design and safety feedback, not a request to merge
the series as-is. It adds opt-in monitoring of the three fan tachometers
and three thermistors on an ASUS Fan Extension Card attached to a ROG
MAXIMUS XI HERO (non-WiFi), BIOS 2004.

The pinned base is Guenter Roeck's hwmon-next at
8d0f79f49fb10c9f07fee6720551113272a1812b. It already contains the
MAXIMUS IX EXTREME selector-based extension fan path and EC 00:60..62
temperature descriptors, but does not select these sensors on XI HERO.

The BIOS 2004 image (SHA-256
034e6c688ca41cf448745398ce3ccfa184dfae217287ee7b72039498ff5aa812)
provides the following property and transaction evidence:

  EXT_FAN1/2/3: properties 0x060400e2/e3/e4; write EC 00:43 with
  selector 0x0a/0x0b/0x0c, then read high/low RPM bytes at 00:57/58.
  The getter checks EC 00:d4 on every call and performs first-use or
  lost-latch read-modify-writes d4 |= 0x80 and 89 |= 0x07.

  EXT_Sensor1/2/3: properties 0x06030032/34/36; after a firmware card
  property check, write EC 00:68 = 0x07 immediately before each read
  of 00:60/61/62. The exact meaning of 0x68 is not established.

BIOS 2203 has the same relevant fan mapping and getter control flow.
The BIOS presence property, IsEXTFanCardExist (0x06060050), reads the
EXTFanCard UEFI/Setup variable; we have not established a reliable live
electrical card-presence signal. Accordingly, the XI HERO extension
sensors remain disabled by default and are enabled only by an explicit
module parameter on the exact non-WiFi DMI name. The WiFi entry is not
changed. With the option enabled, the first read of any hwmon input may
trigger a full refresh and the extension setup writes, even if the user
did not request an EXT_* attribute.

Patch 1 changes generic EC/selector error propagation so a failed block
read cannot publish a partial sensor cache. This affects failure paths
on all supported boards, not only XI HERO. Patches 2 and 3 add the board
opt-in, RPM path and thermistor path. Patch 2 currently relies on the
restore/error path introduced by patch 1; we would rebase or reshape the
series if the generic change should be reviewed separately.

The new transactions use the driver's configured ACPI EC mutex, normally
\AMW0.ASMX on XI HERO. They do not add PWM, fan-control, NCT, direct
EC-port or WMI accesses. They do write the EC bank selector, the BIOS
observed d4/89 setup registers, the fan selector and 0x68. We do not
claim that these writes are harmless when the optional card is absent.

A different, locally maintained asus-ec-sensors module for Unraid 7.4.1
/ 6.18.64-Unraid has returned all six channels on a physical XI HERO
with the card installed, including after one reboot. The binaries and
some error/selector handling differ; that test is not a runtime test of
this upstream RFC. On the v1 base, x86_64 and i386 objects compiled with
W=1, an x86_64 module linked with modpost without diagnostics, and a
static comparison of 66 DMI names finds no default sensor-mask, family,
mutex or existing-descriptor change. We have not tested this RFC on
other boards or with the card absent.

Questions for maintainers:

1. Is a default-off, exact-DMI opt-in acceptable when firmware exposes
   only a Setup-variable-backed card property, or is another presence
   mechanism required before these EC writes can be accepted?
2. Should the driver preserve the BIOS first-use d4/89 writes even when
   d4 bit 7 is already set? We have not isolated their necessity and do
   not want to replace a working BIOS sequence with an untested shortcut.
3. Is reproducing the BIOS's 68=07 write before every thermistor read an
   acceptable basis while its bit semantics remain unknown? A separate
   BIOS Extension control initialization path also writes 68=07.
4. Would you prefer patch 1 as a separate bugfix before the board support,
   and what fault-path regression evidence would be useful?
5. Is the separate non-WiFi board profile and module parameter an
   appropriate interface, or should the board/card policy be expressed
   differently?

The series is intentionally an RFC. The three patches carry the
submitter-confirmed DCO sign-off. We welcome review of the card-presence
policy, register transactions and generic error handling before any
attempt to merge.

Changes since v1:
- Rebased on hwmon-next at Guenter's request. The resulting driver is
  byte-identical to the v1 driver.
- The archived v1 diffs contain wrapped lines. In particular, git
  reports corrupt patches for 2/3 and 3/3. The original diffs apply
  cleanly on this base.

v1: https://lore.kernel.org/linux-hwmon/CAP-m2G6VwPqTOZ_uQEAsWnb=j4yFj+_N0V33gOTL5kRYwwYbvg@mail.gmail.com/

John den Heijer (3):
  hwmon: (asus-ec-sensors) propagate EC read and selector errors
  hwmon: (asus-ec-sensors) add opt-in MAXIMUS XI HERO EXT fan RPM
  hwmon: (asus-ec-sensors) add MAXIMUS XI HERO EXT thermistors

 drivers/hwmon/asus-ec-sensors.c | 140 ++++++++++++++++++++++++++++----
 1 file changed, 122 insertions(+), 18 deletions(-)


base-commit: 8d0f79f49fb10c9f07fee6720551113272a1812b
-- 
2.54.0 (Apple Git-157)


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

* [RFC PATCH v2 1/3] hwmon: (asus-ec-sensors) propagate EC read and selector errors
  2026-11-28 19:12 [RFC PATCH v2 0/3] hwmon: asus-ec-sensors: MAXIMUS XI HERO Fan Extension Card John den Heijer
@ 2026-11-28 19:12 ` John den Heijer
  2026-11-28 19:17   ` sashiko-bot
  2026-11-28 19:12 ` [RFC PATCH v2 2/3] hwmon: (asus-ec-sensors) add opt-in MAXIMUS XI HERO EXT fan RPM John den Heijer
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: John den Heijer @ 2026-11-28 19:12 UTC (permalink / raw)
  To: linux-hwmon; +Cc: eugene.shalygin, linux

On an EC or selector failure, asus_ec_block_read() can continue with a
partial buffer. A successful final bank restore then reports success,
so update_ec_sensors() publishes stale bytes.

Propagate the first error. Attempt selector restoration in its bank,
then restore the original bank. A failed restore also rejects the
update. This changes the failure path for all supported boards.

Signed-off-by: John den Heijer <jdenheijer74@gmail.com>
---
 drivers/hwmon/asus-ec-sensors.c | 39 ++++++++++++++++++++++-----------
 1 file changed, 26 insertions(+), 13 deletions(-)

diff --git a/drivers/hwmon/asus-ec-sensors.c b/drivers/hwmon/asus-ec-sensors.c
index d0c01b825..6e06256a5 100644
--- a/drivers/hwmon/asus-ec-sensors.c
+++ b/drivers/hwmon/asus-ec-sensors.c
@@ -1309,7 +1309,7 @@ static int asus_ec_bank_switch(u8 bank, u8 *old)
 static int asus_ec_block_read(const struct device *dev,
 			      struct ec_sensors_data *ec)
 {
-	int ireg, ibank, status;
+	int ireg, ibank, status, restore_status;
 	u8 bank, reg_bank, prev_bank, select, prev_select;
 	bool select_saved;
 
@@ -1330,7 +1330,8 @@ static int asus_ec_block_read(const struct device *dev,
 	for (ibank = 0; ibank < ec->nr_banks; ibank++) {
 		if (bank != ec->banks[ibank]) {
 			bank = ec->banks[ibank];
-			if (asus_ec_bank_switch(bank, NULL)) {
+			status = asus_ec_bank_switch(bank, NULL);
+			if (status) {
 				dev_warn(dev, "EC bank switch to %d failed",
 					 bank);
 				break;
@@ -1345,24 +1346,36 @@ static int asus_ec_block_read(const struct device *dev,
 			select = register_select(ec->registers[ireg]);
 			if (select) {
 				if (!select_saved) {
-					if (ec_read(ASUS_EC_SELECT_REGISTER,
-						    &prev_select))
-						continue;
+					status = ec_read(ASUS_EC_SELECT_REGISTER,
+							 &prev_select);
+					if (status)
+						goto restore_select;
 					select_saved = true;
 				}
-				if (ec_write(ASUS_EC_SELECT_REGISTER, select))
-					continue;
+				status = ec_write(ASUS_EC_SELECT_REGISTER, select);
+				if (status)
+					goto restore_select;
 			}
-			ec_read(register_index(ec->registers[ireg]),
-				ec->read_buffer + ireg);
+			status = ec_read(register_index(ec->registers[ireg]),
+					 ec->read_buffer + ireg);
+			if (status)
+				goto restore_select;
 		}
+restore_select:
 		/* restore the selector while still in its bank */
-		if (select_saved &&
-		    ec_write(ASUS_EC_SELECT_REGISTER, prev_select))
-			dev_warn(dev, "EC selector restore failed");
+		if (select_saved) {
+			restore_status = ec_write(ASUS_EC_SELECT_REGISTER,
+						  prev_select);
+			if (!status)
+				status = restore_status;
+		}
+		if (status)
+			break;
 	}
 
-	status = asus_ec_bank_switch(prev_bank, NULL);
+	restore_status = asus_ec_bank_switch(prev_bank, NULL);
+	if (!status)
+		status = restore_status;
 	return status;
 }
 
-- 
2.54.0 (Apple Git-157)


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

* [RFC PATCH v2 2/3] hwmon: (asus-ec-sensors) add opt-in MAXIMUS XI HERO EXT fan RPM
  2026-11-28 19:12 [RFC PATCH v2 0/3] hwmon: asus-ec-sensors: MAXIMUS XI HERO Fan Extension Card John den Heijer
  2026-11-28 19:12 ` [RFC PATCH v2 1/3] hwmon: (asus-ec-sensors) propagate EC read and selector errors John den Heijer
@ 2026-11-28 19:12 ` John den Heijer
  2026-11-28 19:19   ` sashiko-bot
  2026-11-28 19:12 ` [RFC PATCH v2 3/3] hwmon: (asus-ec-sensors) add MAXIMUS XI HERO EXT thermistors John den Heijer
  2026-11-28 19:19 ` [RFC PATCH v2 0/3] hwmon: asus-ec-sensors: MAXIMUS XI HERO Fan Extension Card sashiko-bot
  3 siblings, 1 reply; 7+ messages in thread
From: John den Heijer @ 2026-11-28 19:12 UTC (permalink / raw)
  To: linux-hwmon; +Cc: eugene.shalygin, linux

BIOS 2004 reads the three optional extension fan tachometers by writing
selector 0x0a, 0x0b or 0x0c to EC bank-0 register 0x43 and reading the
high and low RPM bytes from 0x57/0x58.

Before the first read, or after a lost latch, the BIOS getter sets bit 7
of 0xd4 and bits 0-2 of 0x89. Reuse the upstream MAXIMUS IX EXTREME
selector path, but add this initialization only for the exact non-WiFi
MAXIMUS XI HERO DMI name. Keep the optional-card support default-off:
a reliable live card-presence detector has not been established.

Signed-off-by: John den Heijer <jdenheijer74@gmail.com>
---
 drivers/hwmon/asus-ec-sensors.c | 76 ++++++++++++++++++++++++++++++---
 1 file changed, 71 insertions(+), 5 deletions(-)

diff --git a/drivers/hwmon/asus-ec-sensors.c b/drivers/hwmon/asus-ec-sensors.c
index 6e06256a5..45beba10f 100644
--- a/drivers/hwmon/asus-ec-sensors.c
+++ b/drivers/hwmon/asus-ec-sensors.c
@@ -37,6 +37,7 @@
 #include <linux/unaligned.h>
 
 static char *mutex_path_override;
+static bool enable_ext_fan;
 
 /* Writing to this EC register switches EC bank */
 #define ASUS_EC_BANK_REGISTER	0xff
@@ -45,6 +46,9 @@ static char *mutex_path_override;
  * group of registers reports (e.g. one of the fans of the fan extension card).
  */
 #define ASUS_EC_SELECT_REGISTER	0x43
+#define ASUS_EC_EXT_FAN_RPM_MIN	0xa5
+#define ASUS_EC_EXT_FAN_ENABLE_REGISTER	0xd4
+#define ASUS_EC_EXT_FAN_CHANNEL_REGISTER	0x89
 #define SENSOR_LABEL_LEN	16
 
 /*
@@ -414,6 +418,12 @@ static const struct ec_sensor_info sensors_family_intel_300[] = {
 	[ec_sensor_fan_vrm_hs] = EC_SENSOR("VRM HS", hwmon_fan, 2, 0x00, 0xb2),
 	[ec_sensor_fan_water_flow] =
 		EC_SENSOR("Water_Flow", hwmon_fan, 2, 0x00, 0xbc),
+	[ec_sensor_fan_ext_1] =
+		EC_SENSOR_SELECT("EXT_FAN1", hwmon_fan, 2, 0x00, 0x57, 0x0a),
+	[ec_sensor_fan_ext_2] =
+		EC_SENSOR_SELECT("EXT_FAN2", hwmon_fan, 2, 0x00, 0x57, 0x0b),
+	[ec_sensor_fan_ext_3] =
+		EC_SENSOR_SELECT("EXT_FAN3", hwmon_fan, 2, 0x00, 0x57, 0x0c),
 	[ec_sensor_temp_water_in] =
 		EC_SENSOR("Water_In", hwmon_temp, 1, 0x01, 0x00),
 	[ec_sensor_temp_water_out] =
@@ -484,6 +494,7 @@ static const struct ec_sensor_info sensors_family_intel_700[] = {
 
 struct ec_board_info {
 	unsigned long sensors;
+	bool ext_fan_capable;
 	/*
 	 * Defines which mutex to use for guarding access to the state and the
 	 * hardware. Can be either a full path to an AML mutex or the
@@ -593,6 +604,16 @@ static const struct ec_board_info board_info_maximus_xi_hero = {
 	.family = family_intel_300_series,
 };
 
+static const struct ec_board_info board_info_maximus_xi_hero_ext = {
+	.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB |
+		SENSOR_TEMP_T_SENSOR |
+		SENSOR_TEMP_VRM | SENSOR_SET_TEMP_WATER |
+		SENSOR_FAN_CPU_OPT | SENSOR_FAN_WATER_FLOW,
+	.ext_fan_capable = true,
+	.mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX,
+	.family = family_intel_300_series,
+};
+
 static const struct ec_board_info board_info_maximus_z690_formula = {
 	.sensors = SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM |
 		SENSOR_SET_TEMP_WATER | SENSOR_FAN_WATER_FLOW,
@@ -1004,7 +1025,7 @@ static const struct dmi_system_id dmi_table[] = {
 	DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG CROSSHAIR X870E HERO",
 					&board_info_crosshair_x870e_hero),
 	DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG MAXIMUS XI HERO",
-					&board_info_maximus_xi_hero),
+					&board_info_maximus_xi_hero_ext),
 	DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG MAXIMUS XI HERO (WI-FI)",
 					&board_info_maximus_xi_hero),
 	DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG MAXIMUS X HERO",
@@ -1135,6 +1156,9 @@ static bool unlock_global_acpi_lock(struct lock_data *data)
 struct ec_sensors_data {
 	const struct ec_board_info *board_info;
 	const struct ec_sensor_info *sensors_info;
+	unsigned long sensor_mask;
+	bool ext_fan_enabled;
+	bool ext_fan_initialized;
 	struct ec_sensor *sensors;
 	/*
 	 * EC registers to read from: (select << 16) + (bank << 8) + index,
@@ -1224,8 +1248,8 @@ static void setup_sensor_data(struct ec_sensors_data *ec)
 	ec->nr_banks = 0;
 	ec->nr_registers = 0;
 
-	for_each_set_bit(i, &ec->board_info->sensors,
-			 BITS_PER_TYPE(ec->board_info->sensors)) {
+	for_each_set_bit(i, &ec->sensor_mask,
+			 BITS_PER_TYPE(ec->sensor_mask)) {
 		s->info_index = i;
 		s->cached_value = 0;
 		ec->nr_registers +=
@@ -1306,6 +1330,30 @@ static int asus_ec_bank_switch(u8 bank, u8 *old)
 	return ec_write(ASUS_EC_BANK_REGISTER, bank);
 }
 
+static int asus_ec_prepare_ext_fans(struct ec_sensors_data *ec)
+{
+	u8 enabled, channels;
+	int status;
+
+	status = ec_read(ASUS_EC_EXT_FAN_ENABLE_REGISTER, &enabled);
+	if (status)
+		return status;
+	if (ec->ext_fan_initialized && (enabled & BIT(7)))
+		return 0;
+
+	status = ec_write(ASUS_EC_EXT_FAN_ENABLE_REGISTER, enabled | BIT(7));
+	if (status)
+		return status;
+	status = ec_read(ASUS_EC_EXT_FAN_CHANNEL_REGISTER, &channels);
+	if (status)
+		return status;
+	status = ec_write(ASUS_EC_EXT_FAN_CHANNEL_REGISTER,
+			  channels | GENMASK(2, 0));
+	if (!status)
+		ec->ext_fan_initialized = true;
+	return status;
+}
+
 static int asus_ec_block_read(const struct device *dev,
 			      struct ec_sensors_data *ec)
 {
@@ -1325,6 +1373,11 @@ static int asus_ec_block_read(const struct device *dev,
 		dev_warn(dev,
 			"Concurrent access to the ACPI EC detected.\nRace condition possible.");
 	}
+	if (ec->ext_fan_enabled) {
+		status = asus_ec_prepare_ext_fans(ec);
+		if (status)
+			goto restore_bank;
+	}
 
 	/* read registers minimizing bank switches. */
 	for (ibank = 0; ibank < ec->nr_banks; ibank++) {
@@ -1373,6 +1426,7 @@ restore_select:
 			break;
 	}
 
+restore_bank:
 	restore_status = asus_ec_bank_switch(prev_bank, NULL);
 	if (!status)
 		status = restore_status;
@@ -1503,8 +1557,11 @@ static int asus_ec_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
 		return ret;
 
 	sensor_info = get_sensor_info(state, sidx);
+	ec_sensor = get_ec_sensor_type(state, sidx);
+	if (state->ext_fan_enabled && ec_sensor >= ec_sensor_fan_ext_1 &&
+	    ec_sensor <= ec_sensor_fan_ext_3 && value < ASUS_EC_EXT_FAN_RPM_MIN)
+		value = 0;
 	if (sensor_info->type == hwmon_temp) {
-		ec_sensor = get_ec_sensor_type(state, sidx);
 		if ((environment_temp_sensors & BIT(ec_sensor)) &&
 		    is_blank_temperature_value(value))
 			return -ENODATA;
@@ -1601,6 +1658,12 @@ static int asus_ec_probe(struct platform_device *pdev)
 	ec_data->next_update = INITIAL_JIFFIES;
 	dev_set_drvdata(dev, ec_data);
 	ec_data->board_info = pboard_info;
+	ec_data->sensor_mask = pboard_info->sensors;
+	ec_data->ext_fan_enabled = pboard_info->ext_fan_capable &&
+				   enable_ext_fan;
+	if (ec_data->ext_fan_enabled)
+		ec_data->sensor_mask |= SENSOR_FAN_EXT_1 |
+					SENSOR_FAN_EXT_2 | SENSOR_FAN_EXT_3;
 
 	switch (ec_data->board_info->family) {
 	case family_amd_400_series:
@@ -1645,7 +1708,7 @@ static int asus_ec_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	ec_data->nr_sensors = hweight_long(ec_data->board_info->sensors);
+	ec_data->nr_sensors = hweight_long(ec_data->sensor_mask);
 	ec_data->sensors = devm_kzalloc_objs(dev, struct ec_sensor,
 					     ec_data->nr_sensors);
 	if (!ec_data->sensors)
@@ -1745,6 +1808,9 @@ module_exit(asus_ec_exit);
 module_param_named(mutex_path, mutex_path_override, charp, 0);
 MODULE_PARM_DESC(mutex_path,
 		 "Override ACPI mutex path used to guard access to hardware");
+module_param(enable_ext_fan, bool, 0);
+MODULE_PARM_DESC(enable_ext_fan,
+		 "Enable Fan Extension Card sensors on ROG MAXIMUS XI HERO");
 
 MODULE_AUTHOR("Eugene Shalygin <eugene.shalygin@gmail.com>");
 MODULE_DESCRIPTION(
-- 
2.54.0 (Apple Git-157)


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

* [RFC PATCH v2 3/3] hwmon: (asus-ec-sensors) add MAXIMUS XI HERO EXT thermistors
  2026-11-28 19:12 [RFC PATCH v2 0/3] hwmon: asus-ec-sensors: MAXIMUS XI HERO Fan Extension Card John den Heijer
  2026-11-28 19:12 ` [RFC PATCH v2 1/3] hwmon: (asus-ec-sensors) propagate EC read and selector errors John den Heijer
  2026-11-28 19:12 ` [RFC PATCH v2 2/3] hwmon: (asus-ec-sensors) add opt-in MAXIMUS XI HERO EXT fan RPM John den Heijer
@ 2026-11-28 19:12 ` John den Heijer
  2026-11-28 19:19 ` [RFC PATCH v2 0/3] hwmon: asus-ec-sensors: MAXIMUS XI HERO Fan Extension Card sashiko-bot
  3 siblings, 0 replies; 7+ messages in thread
From: John den Heijer @ 2026-11-28 19:12 UTC (permalink / raw)
  To: linux-hwmon; +Cc: eugene.shalygin, linux

BIOS 2004 maps the three optional Fan Extension Card thermistors to EC
bank-0 registers 0x60, 0x61 and 0x62. Its getter writes 0x68=0x07
immediately before each read.

Reproduce that sequence only for the opted-in non-WiFi XI HERO and
return -ENODATA for firmware-invalid values. The bit-level meaning of
0x68 is not established.

Signed-off-by: John den Heijer <jdenheijer74@gmail.com>
---
 drivers/hwmon/asus-ec-sensors.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/asus-ec-sensors.c b/drivers/hwmon/asus-ec-sensors.c
index 45beba10f..09bfccf58 100644
--- a/drivers/hwmon/asus-ec-sensors.c
+++ b/drivers/hwmon/asus-ec-sensors.c
@@ -49,6 +49,8 @@ static bool enable_ext_fan;
 #define ASUS_EC_EXT_FAN_RPM_MIN	0xa5
 #define ASUS_EC_EXT_FAN_ENABLE_REGISTER	0xd4
 #define ASUS_EC_EXT_FAN_CHANNEL_REGISTER	0x89
+#define ASUS_EC_EXT_TEMP_PREPARE_REGISTER	0x68
+#define ASUS_EC_EXT_TEMP_PREPARE_VALUE	0x07
 #define SENSOR_LABEL_LEN	16
 
 /*
@@ -413,6 +415,13 @@ static const struct ec_sensor_info sensors_family_intel_300[] = {
 	[ec_sensor_temp_t_sensor] =
 		EC_SENSOR("T_Sensor", hwmon_temp, 1, 0x00, 0x3d),
 	[ec_sensor_temp_vrm] = EC_SENSOR("VRM", hwmon_temp, 1, 0x00, 0x3e),
+	/* BIOS 2004 properties 0x06030032, 0x06030034, 0x06030036 */
+	[ec_sensor_temp_sensor_extra_1] =
+		EC_SENSOR("EXT_Sensor1", hwmon_temp, 1, 0x00, 0x60),
+	[ec_sensor_temp_sensor_extra_2] =
+		EC_SENSOR("EXT_Sensor2", hwmon_temp, 1, 0x00, 0x61),
+	[ec_sensor_temp_sensor_extra_3] =
+		EC_SENSOR("EXT_Sensor3", hwmon_temp, 1, 0x00, 0x62),
 	[ec_sensor_fan_cpu_opt] =
 		EC_SENSOR("CPU_Opt", hwmon_fan, 2, 0x00, 0xb0),
 	[ec_sensor_fan_vrm_hs] = EC_SENSOR("VRM HS", hwmon_fan, 2, 0x00, 0xb2),
@@ -1409,6 +1418,15 @@ static int asus_ec_block_read(const struct device *dev,
 				if (status)
 					goto restore_select;
 			}
+			/* BIOS 2004 performs this write before each EXT probe read. */
+			if (ec->ext_fan_enabled && !bank &&
+			    register_index(ec->registers[ireg]) >= 0x60 &&
+			    register_index(ec->registers[ireg]) <= 0x62) {
+				status = ec_write(ASUS_EC_EXT_TEMP_PREPARE_REGISTER,
+						  ASUS_EC_EXT_TEMP_PREPARE_VALUE);
+				if (status)
+					goto restore_select;
+			}
 			status = ec_read(register_index(ec->registers[ireg]),
 					 ec->read_buffer + ireg);
 			if (status)
@@ -1562,6 +1580,10 @@ static int asus_ec_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
 	    ec_sensor <= ec_sensor_fan_ext_3 && value < ASUS_EC_EXT_FAN_RPM_MIN)
 		value = 0;
 	if (sensor_info->type == hwmon_temp) {
+		if (state->ext_fan_enabled &&
+		    ec_sensor >= ec_sensor_temp_sensor_extra_1 &&
+		    ec_sensor <= ec_sensor_temp_sensor_extra_3 && value < -50)
+			return -ENODATA;
 		if ((environment_temp_sensors & BIT(ec_sensor)) &&
 		    is_blank_temperature_value(value))
 			return -ENODATA;
@@ -1663,7 +1685,10 @@ static int asus_ec_probe(struct platform_device *pdev)
 				   enable_ext_fan;
 	if (ec_data->ext_fan_enabled)
 		ec_data->sensor_mask |= SENSOR_FAN_EXT_1 |
-					SENSOR_FAN_EXT_2 | SENSOR_FAN_EXT_3;
+					SENSOR_FAN_EXT_2 | SENSOR_FAN_EXT_3 |
+					SENSOR_TEMP_SENSOR_EXTRA_1 |
+					SENSOR_TEMP_SENSOR_EXTRA_2 |
+					SENSOR_TEMP_SENSOR_EXTRA_3;
 
 	switch (ec_data->board_info->family) {
 	case family_amd_400_series:
-- 
2.54.0 (Apple Git-157)


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

* Re: [RFC PATCH v2 1/3] hwmon: (asus-ec-sensors) propagate EC read and selector errors
  2026-11-28 19:12 ` [RFC PATCH v2 1/3] hwmon: (asus-ec-sensors) propagate EC read and selector errors John den Heijer
@ 2026-11-28 19:17   ` sashiko-bot
  0 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-11-28 19:17 UTC (permalink / raw)
  To: John den Heijer, linux-hwmon

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] hwmon: (asus-ec-sensors) missing Fixes trailers for
  asus_ec_block_read() fix
--

commit 4b3195eecd2db5d08bb4ef745641f9f72b1d17b5
Author: John den Heijer <jdenheijer74@gmail.com>

> hwmon: (asus-ec-sensors) propagate EC read and selector errors
>
> On an EC or selector failure, asus_ec_block_read() can continue with a
> partial buffer. A successful final bank restore then reports success,
> so update_ec_sensors() publishes stale bytes.
>
> Propagate the first error. Attempt selector restoration in its bank,
> then restore the original bank. A failed restore also rejects the
> update. This changes the failure path for all supported boards.
>
> Signed-off-by: John den Heijer <jdenheijer74@gmail.com>

[Severity: Low]
This fixes unpropagated EC bank switch and register read errors from the
initial driver commit, as well as the selector read, write, and restore
error handling added later.  Should the commit message include:

  Fixes: d0ddfd241e57 ("hwmon: (asus-ec-sensors) add driver for ASUS EC")
  Fixes: daa4896813b2 ("hwmon: (asus-ec-sensors) add fan extension card fans for MAXIMUS IX EXTREME")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261128191225.2990-1-jdenheijer74@gmail.com?part=1

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

* Re: [RFC PATCH v2 2/3] hwmon: (asus-ec-sensors) add opt-in MAXIMUS XI HERO EXT fan RPM
  2026-11-28 19:12 ` [RFC PATCH v2 2/3] hwmon: (asus-ec-sensors) add opt-in MAXIMUS XI HERO EXT fan RPM John den Heijer
@ 2026-11-28 19:19   ` sashiko-bot
  0 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-11-28 19:19 UTC (permalink / raw)
  To: John den Heijer, linux-hwmon

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] hwmon: (asus-ec-sensors) stale init flag in
  asus_ec_prepare_ext_fans()
- [Low] hwmon: (asus-ec-sensors) undocumented enable_ext_fan module
  parameter
- [Low] hwmon: (asus-ec-sensors) unexplained RPM threshold and param in
  changelog
--

commit e9b20b7038826b0be65d8cbba573ea701113d8d0
Author: John den Heijer <jdenheijer74@gmail.com>

hwmon: (asus-ec-sensors) add opt-in MAXIMUS XI HERO EXT fan RPM

This commit adds opt-in support for reading the three extension fan card
tachometer channels on the ROG MAXIMUS XI HERO motherboard via a new
enable_ext_fan module parameter.

> diff --git a/drivers/hwmon/asus-ec-sensors.c b/drivers/hwmon/asus-ec-sensors.c
> index 6e06256a5e2d6..45beba10fd5c5 100644
> --- a/drivers/hwmon/asus-ec-sensors.c
> +++ b/drivers/hwmon/asus-ec-sensors.c

[ ... ]

> @@ -1306,6 +1330,30 @@ static int asus_ec_bank_switch(u8 bank, u8 *old)
>  	return ec_write(ASUS_EC_BANK_REGISTER, bank);
>  }
>  
> +static int asus_ec_prepare_ext_fans(struct ec_sensors_data *ec)
> +{
> +	u8 enabled, channels;
> +	int status;
> +
> +	status = ec_read(ASUS_EC_EXT_FAN_ENABLE_REGISTER, &enabled);
> +	if (status)
> +		return status;
> +	if (ec->ext_fan_initialized && (enabled & BIT(7)))
> +		return 0;
> +
> +	status = ec_write(ASUS_EC_EXT_FAN_ENABLE_REGISTER, enabled | BIT(7));
> +	if (status)
> +		return status;
> +	status = ec_read(ASUS_EC_EXT_FAN_CHANNEL_REGISTER, &channels);
> +	if (status)
> +		return status;
> +	status = ec_write(ASUS_EC_EXT_FAN_CHANNEL_REGISTER,
> +			  channels | GENMASK(2, 0));
> +	if (!status)
> +		ec->ext_fan_initialized = true;
> +	return status;
> +}

[Severity: Medium]
Can a transient failure when accessing ASUS_EC_EXT_FAN_CHANNEL_REGISTER
after a lost latch leave the extension fan channels unconfigured on all
later polls?

Once the first poll sets ec->ext_fan_initialized = true, a later lost latch
clears BIT(7) in ASUS_EC_EXT_FAN_ENABLE_REGISTER without clearing
ec->ext_fan_initialized.  If re-enabling BIT(7) in
ASUS_EC_EXT_FAN_ENABLE_REGISTER succeeds on recovery, but reading or
writing ASUS_EC_EXT_FAN_CHANNEL_REGISTER fails, both
ec->ext_fan_initialized and BIT(7) remain set.  Subsequent calls to
asus_ec_prepare_ext_fans() will then take the early return and skip
restoring GENMASK(2, 0) in ASUS_EC_EXT_FAN_CHANNEL_REGISTER.

Clearing ec->ext_fan_initialized = false before writing
ASUS_EC_EXT_FAN_ENABLE_REGISTER would ensure recovery retries the full
sequence.

[ ... ]

> @@ -1503,8 +1557,11 @@ static int asus_ec_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
>  		return ret;
>  
>  	sensor_info = get_sensor_info(state, sidx);
> +	ec_sensor = get_ec_sensor_type(state, sidx);
> +	if (state->ext_fan_enabled && ec_sensor >= ec_sensor_fan_ext_1 &&
> +	    ec_sensor <= ec_sensor_fan_ext_3 && value < ASUS_EC_EXT_FAN_RPM_MIN)
> +		value = 0;

[Severity: Low]
This isn't a bug, but neither the commit message nor a comment explains why
extension fan readings below ASUS_EC_EXT_FAN_RPM_MIN (0xa5) are clamped to
0, and the commit message does not mention the enable_ext_fan module
parameter used to opt in.

[ ... ]

> @@ -1745,6 +1808,9 @@ module_exit(asus_ec_exit);
>  module_param_named(mutex_path, mutex_path_override, charp, 0);
>  MODULE_PARM_DESC(mutex_path,
>  		 "Override ACPI mutex path used to guard access to hardware");
> +module_param(enable_ext_fan, bool, 0);
> +MODULE_PARM_DESC(enable_ext_fan,
> +		 "Enable Fan Extension Card sensors on ROG MAXIMUS XI HERO");

[Severity: Low]
Should the new enable_ext_fan module parameter also be documented under the
Module Parameters section in Documentation/hwmon/asus_ec_sensors.rst?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261128191225.2990-1-jdenheijer74@gmail.com?part=2

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

* Re: [RFC PATCH v2 0/3] hwmon: asus-ec-sensors: MAXIMUS XI HERO Fan Extension Card
  2026-11-28 19:12 [RFC PATCH v2 0/3] hwmon: asus-ec-sensors: MAXIMUS XI HERO Fan Extension Card John den Heijer
                   ` (2 preceding siblings ...)
  2026-11-28 19:12 ` [RFC PATCH v2 3/3] hwmon: (asus-ec-sensors) add MAXIMUS XI HERO EXT thermistors John den Heijer
@ 2026-11-28 19:19 ` sashiko-bot
  3 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-11-28 19:19 UTC (permalink / raw)
  To: John den Heijer, linux-hwmon

Sashiko has finished reviewing this 3-patch series:

- Patch 3: no issues found.
- Patch 1 ("hwmon: (asus-ec-sensors) propagate EC read and selec..."): 1
  potential issue (1 Low)
- Patch 2 ("hwmon: (asus-ec-sensors) add opt-in MAXIMUS XI HERO..."): 3
  potential issues (1 Medium, 2 Low)

Detailed reviews have been sent as separate replies to patches 1 and 2.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261128191225.2990-1-jdenheijer74@gmail.com

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

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

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-28 19:12 [RFC PATCH v2 0/3] hwmon: asus-ec-sensors: MAXIMUS XI HERO Fan Extension Card John den Heijer
2026-11-28 19:12 ` [RFC PATCH v2 1/3] hwmon: (asus-ec-sensors) propagate EC read and selector errors John den Heijer
2026-11-28 19:17   ` sashiko-bot
2026-11-28 19:12 ` [RFC PATCH v2 2/3] hwmon: (asus-ec-sensors) add opt-in MAXIMUS XI HERO EXT fan RPM John den Heijer
2026-11-28 19:19   ` sashiko-bot
2026-11-28 19:12 ` [RFC PATCH v2 3/3] hwmon: (asus-ec-sensors) add MAXIMUS XI HERO EXT thermistors John den Heijer
2026-11-28 19:19 ` [RFC PATCH v2 0/3] hwmon: asus-ec-sensors: MAXIMUS XI HERO Fan Extension Card sashiko-bot

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