Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: John den Heijer <jdenheijer74@gmail.com>
To: linux-hwmon@vger.kernel.org
Cc: eugene.shalygin@gmail.com, linux@roeck-us.net
Subject: [RFC PATCH v3 3/3] hwmon: (asus-ec-sensors) add MAXIMUS XI HERO EXT thermistors
Date: Sat, 28 Nov 2026 21:09:52 +0100	[thread overview]
Message-ID: <20261128200952.2935-4-jdenheijer74@gmail.com> (raw)
In-Reply-To: <20261128200952.2935-1-jdenheijer74@gmail.com>

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 d9a42b26c..2f2cc6ef3 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),
@@ -1411,6 +1420,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)
@@ -1564,6 +1582,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;
@@ -1665,7 +1687,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)


  parent reply	other threads:[~2026-11-28 20:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28 20:09 [RFC PATCH v3 0/3] hwmon: asus-ec-sensors: MAXIMUS XI HERO Fan Extension Card John den Heijer
2026-11-28 20:09 ` [RFC PATCH v3 1/3] hwmon: (asus-ec-sensors) propagate EC read and selector errors John den Heijer
2026-11-28 20:09 ` [RFC PATCH v3 2/3] hwmon: (asus-ec-sensors) add opt-in MAXIMUS XI HERO EXT fan RPM John den Heijer
2026-11-28 20:09 ` John den Heijer [this message]
2026-11-28 20:17 ` [RFC PATCH v3 0/3] hwmon: asus-ec-sensors: MAXIMUS XI HERO Fan Extension Card sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261128200952.2935-4-jdenheijer74@gmail.com \
    --to=jdenheijer74@gmail.com \
    --cc=eugene.shalygin@gmail.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox