Skip to contentSkip to conversation

hwmon: Add Minisforum UM780 XTX EC monitoring and fan control

PATCH Superseded Sebastián Peyrott 4 participants 6 messages Aug 25 – Aug 28

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover hwmon: Add Minisforum UM780 XTX EC monitoring and fan control

Add a DMI-gated hwmon driver for both fans on the Minisforum UM780 XTX. The EC is an ITE IT5571E, but its register layout and OEM commands are defined by machine-specific firmware, so the driver only binds to the exact board revision and BIOS version on which it was tested.

The driver exposes both fan-control temperatures and tachometers, two OEM automatic CPU fan profiles, and two writable system-fan transition temperatures. It preserves settings selected through its interface across s2idle.

Tested on the target system with concurrent RPM reads, OEM profile changes, system-fan threshold changes, unload/reload stress, and s2idle resume. The settings were correct from the first userspace sample after resume and remained stable for 15 seconds.

OpenAI Codex assisted with reverse-engineering review, code editing, test orchestration, and patch and email preparation across a long interactive session. I reviewed every change, ran the live tests on the target hardware, and take responsibility for the submission.

Sebastián Peyrott (1):
hwmon: Add Minisforum UM780 XTX EC monitoring and fan control

---
Changes in v3:
- return -EIO after bounded RPM coherence retries and -ENODATA for an unknown CPU profile;
- seed saved settings at probe, update them only after successful hwmon writes, and restore them at resume without reading the EC at suspend;
- clarify saved-state naming, live threshold validation, and resume documentation.

 Documentation/hwmon/index.rst               |   1 +
 Documentation/hwmon/minisforum-um780xtx.rst |  68 +++
 MAINTAINERS                                 |   7 +
 drivers/hwmon/Kconfig                       |  16 +
 drivers/hwmon/Makefile                      |   1 +
 drivers/hwmon/minisforum-um780xtx.c         | 501 ++++++++++++++++++++
 6 files changed, 594 insertions(+)
 create mode 100644 Documentation/hwmon/minisforum-um780xtx.rst
 create mode 100644 drivers/hwmon/minisforum-um780xtx.c

base-commit: 75f2c0b3690702c90863c2e138cb5520670845ea

Signature · 1 line
2.54.0
#1 lore raw

PATCH v3 1/1 hwmon: Add Minisforum UM780 XTX EC monitoring and fan control

Add a DMI-gated hwmon driver for the embedded controller used by the Minisforum UM780 XTX with board revision 1.1 and BIOS 1.06.

Expose the CPU and system fan control temperatures and tachometers. The tachometer protocol returns one byte per OEM command, so serialize transactions and use high-low-high sampling to reject torn values.

Allow selecting either complete OEM CPU fan profile through pwm1_enable and changing the two validated system fan transition temperatures through standard automatic-curve attributes. Cache coherent settings and restore them after the firmware reloads defaults following resume.

---
 Documentation/hwmon/index.rst               |   1 +
 Documentation/hwmon/minisforum-um780xtx.rst |  68 +++
 MAINTAINERS                                 |   7 +
 drivers/hwmon/Kconfig                       |  16 +
 drivers/hwmon/Makefile                      |   1 +
 drivers/hwmon/minisforum-um780xtx.c         | 501 ++++++++++++++++++++
 6 files changed, 594 insertions(+)
 create mode 100644 Documentation/hwmon/minisforum-um780xtx.rst
 create mode 100644 drivers/hwmon/minisforum-um780xtx.c
Documentation/hwmon/index.rst +1 -0
index d979e6d6e9f2..c98cad395455 100644
@@ -186,6 +186,7 @@ Hardware Monitoring Kernel Drivers
    mcp3021
    mcp9982
    menf21bmc
+   minisforum-um780xtx
    mlxreg-fan
    mp2856
    mp2869
Documentation/hwmon/minisforum-um780xtx.rst new file +68 -0

68 lines not on this page · raw message

MAINTAINERS +7 -0
index 6156e48e1816..f60ea9c6cfe7 100644
@@ -18012,6 +18012,13 @@ F:	include/linux/min_heap.h
 F:	lib/min_heap.c
 F:	lib/tests/min_heap_kunit.c
 
+MINISFORUM UM780 XTX EC HARDWARE MONITOR DRIVER
+M:	Sebastián Peyrott <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/hwmon/minisforum-um780xtx.rst
+F:	drivers/hwmon/minisforum-um780xtx.c
+
 MIPI CCS, SMIA AND SMIA++ IMAGE SENSOR DRIVER
 M:	Sakari Ailus <[email protected]>
 L:	[email protected]
drivers/hwmon/Kconfig +16 -0
index 81a9a1d40eec..45ac04c89b23 100644
@@ -1490,6 +1490,22 @@ config SENSORS_MENF21BMC_HWMON
 	  This driver can also be built as a module. If so the module
 	  will be called menf21bmc_hwmon.
 
+config SENSORS_MINISFORUM_UM780XTX
+	tristate "Minisforum UM780 XTX EC hardware monitoring"
+	depends on ACPI && DMI && X86
+	help
+	  If you say yes here you get support for the hardware monitoring
+	  features of the embedded controller in the Minisforum UM780 XTX.
+	  This includes CPU and system fan speeds, their control temperatures,
+	  two CPU fan profiles, system fan temperature thresholds, and
+	  preservation of the selected settings across suspend and resume.
+
+	  This driver only binds to explicitly supported board and firmware
+	  versions.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called minisforum-um780xtx.
+
 config SENSORS_MR75203
 	tristate "Moortec Semiconductor MR75203 PVT Controller"
 	select REGMAP_MMIO
drivers/hwmon/Makefile +1 -0
index 0cad7e21634c..a690f5f97ffc 100644
@@ -180,6 +180,7 @@ obj-$(CONFIG_SENSORS_TC654)	+= tc654.o
 obj-$(CONFIG_SENSORS_TPS23861)	+= tps23861.o
 obj-$(CONFIG_SENSORS_MLXREG_FAN) += mlxreg-fan.o
 obj-$(CONFIG_SENSORS_MENF21BMC_HWMON) += menf21bmc_hwmon.o
+obj-$(CONFIG_SENSORS_MINISFORUM_UM780XTX) += minisforum-um780xtx.o
 obj-$(CONFIG_SENSORS_MR75203)	+= mr75203.o
 obj-$(CONFIG_SENSORS_NCT6683)	+= nct6683.o
 obj-$(CONFIG_SENSORS_NCT6694)	+= nct6694-hwmon.o
drivers/hwmon/minisforum-um780xtx.c new file +501 -0

501 lines not on this page · raw message

Signature · 1 line
2.54.0
#2 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Missing Kconfig dependency on ACPI_EC leads to undefined reference errors at link time. --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Missing Kconfig dependency on ACPI_EC leads to undefined reference errors at link time. --

commit 95c2944ab1799dbc9f42157b5a4c6a9050da57ae
Author: Sebastián Peyrott <[email protected]>

hwmon: Add Minisforum UM780 XTX EC monitoring and fan control

This commit adds a DMI-gated hardware monitoring driver for the embedded controller used by the Minisforum UM780 XTX. It exposes CPU and system fan control temperatures and tachometers, utilizing the ACPI EC transport.

Quoted 4 lines
drivers/hwmon/Kconfig +0 -0
index 81a9a1d40eec8..45ac04c89b23d 100644

[ ... ]

drivers/hwmon/Kconfig config SENSORS_MENF21BMC_HWMON · line 1495

Quoted 7 lines
drivers/hwmon/Kconfig +3 -0
@@ -1490,6 +1490,22 @@ config SENSORS_MENF21BMC_HWMON
 	  This driver can also be built as a module. If so the module
 	  will be called menf21bmc_hwmon.
 
+config SENSORS_MINISFORUM_UM780XTX
+	tristate "Minisforum UM780 XTX EC hardware monitoring"
+	depends on ACPI && DMI && X86

[Severity: Low]
Does this also need to depend on ACPI_EC?

If a user configures the kernel with CONFIG_ACPI enabled but leaves CONFIG_ACPI_EC unselected, will this driver fail to build? It appears this would lead to undefined references to ec_read, ec_write, ec_transaction, and ec_get_handle at link time.

Quoted 3 lines
drivers/hwmon/Kconfig +3 -0
+	help
+	  If you say yes here you get support for the hardware monitoring
+	  features of the embedded controller in the Minisforum UM780 XTX.

[ ... ]

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#4 lore raw
In reply to Sebastián Peyrott
kernel test robot noticed the following build errors:

Hi Sebastián,

kernel test robot noticed the following build errors:

[auto build test ERROR on 75f2c0b3690702c90863c2e138cb5520670845ea]

url:    https://github.com/intel-lab-lkp/linux/commits/Sebasti-n-Peyrott/hwmon-Add-Minisforum-UM780-XTX-EC-monitoring-and-fan-control/20260825-154107
base:   75f2c0b3690702c90863c2e138cb5520670845ea
patch link:    https://lore.kernel.org/r/20260825184107.355980-2-speyrott%40gmail.com
patch subject: [PATCH v3 1/1] hwmon: Add Minisforum UM780 XTX EC monitoring and fan control
config: i386-randconfig-141-20260827 (https://download.01.org/0day-ci/archive/20260827/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9187-g5189e3fb
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260827/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

ld: drivers/hwmon/minisforum-um780xtx.o: in function `um780xtx_oem_read':

>> drivers/hwmon/minisforum-um780xtx.c:75:(.text+0xa3): undefined reference to `ec_transaction'
   ld: drivers/hwmon/minisforum-um780xtx.o: in function `um780xtx_write_profile':
   drivers/hwmon/minisforum-um780xtx.c:141:(.text+0x19a): undefined reference to `ec_transaction'
>> ld: drivers/hwmon/minisforum-um780xtx.c:144:(.text+0x1ad): undefined reference to `ec_read'
   ld: drivers/hwmon/minisforum-um780xtx.o: in function `um780xtx_write_sys_point':
>> drivers/hwmon/minisforum-um780xtx.c:336:(.text+0x215): undefined reference to `ec_write'
   ld: drivers/hwmon/minisforum-um780xtx.c:339:(.text+0x223): undefined reference to `ec_read'
   ld: drivers/hwmon/minisforum-um780xtx.o: in function `um780xtx_sys_point_temp_store':
>> drivers/hwmon/minisforum-um780xtx.c:192:(.text+0x2ac): undefined reference to `ec_read'
   ld: drivers/hwmon/minisforum-um780xtx.c:195:(.text+0x2c3): undefined reference to `ec_read'
>> ld: drivers/hwmon/minisforum-um780xtx.c:209:(.text+0x385): undefined reference to `ec_write'
   ld: drivers/hwmon/minisforum-um780xtx.c:213:(.text+0x3ae): undefined reference to `ec_read'
   ld: drivers/hwmon/minisforum-um780xtx.o: in function `um780xtx_sys_point_temp_show':
   drivers/hwmon/minisforum-um780xtx.c:168:(.text+0x455): undefined reference to `ec_read'
   ld: drivers/hwmon/minisforum-um780xtx.o: in function `um780xtx_probe':
   drivers/hwmon/minisforum-um780xtx.c:431:(.text+0x4e9): undefined reference to `ec_read'
   ld: drivers/hwmon/minisforum-um780xtx.o: in function `um780xtx_read_initial_state':
   drivers/hwmon/minisforum-um780xtx.c:375:(.text+0x511): undefined reference to `ec_read'
   ld: drivers/hwmon/minisforum-um780xtx.c:382:(.text+0x53c): undefined reference to `ec_read'
   ld: drivers/hwmon/minisforum-um780xtx.o:drivers/hwmon/minisforum-um780xtx.c:385: more undefined references to `ec_read' follow
   ld: drivers/hwmon/minisforum-um780xtx.o: in function `um780xtx_restore_state':
   drivers/hwmon/minisforum-um780xtx.c:403:(.text+0x6f9): undefined reference to `ec_transaction'
   ld: drivers/hwmon/minisforum-um780xtx.c:406:(.text+0x712): undefined reference to `ec_read'
   ld: drivers/hwmon/minisforum-um780xtx.c:412:(.text+0x732): undefined reference to `ec_read'
   ld: drivers/hwmon/minisforum-um780xtx.o: in function `um780xtx_init':
>> drivers/hwmon/minisforum-um780xtx.c:473:(.init.text+0x75): undefined reference to `ec_get_handle'

vim +75 drivers/hwmon/minisforum-um780xtx.c

    72	
    73	static int um780xtx_oem_read(u8 command, u8 *value)
    74	{
  > 75		return ec_transaction(command, NULL, 0, value, 1);
    76	}
    77	
    78	static int um780xtx_read_rpm(u8 command_hi, u8 command_lo, long *rpm)
    79	{
    80		u8 hi_before;
    81		u8 hi_after;
    82		u8 lo;
    83		unsigned int value;
    84		int attempt;
    85		int ret;
    86	
    87		for (attempt = 0; attempt < UM780XTX_EC_RPM_RETRIES; attempt++) {
    88			ret = um780xtx_oem_read(command_hi, &hi_before);
    89			if (ret)
    90				return ret;
    91			ret = um780xtx_oem_read(command_lo, &lo);
    92			if (ret)
    93				return ret;
    94			ret = um780xtx_oem_read(command_hi, &hi_after);
    95			if (ret)
    96				return ret;
    97			if (hi_before != hi_after)
    98				continue;
    99	
   100			value = (hi_after << 8) | lo;
   101			if (value > UM780XTX_EC_MAX_RPM)
   102				continue;
   103	
   104			*rpm = value;
   105			return 0;
   106		}
   107	
   108		return -EIO;
   109	}
   110	
   111	static int um780xtx_read_profile(long *mode)
   112	{
   113		u8 profile;
   114		int ret;
   115	
   116		ret = ec_read(UM780XTX_EC_CPU_PROFILE, &profile);
   117		if (ret)
   118			return ret;
   119		if (profile == UM780XTX_EC_PROFILE_B1) {
   120			*mode = 2;
   121			return 0;
   122		}
   123		if (profile == UM780XTX_EC_PROFILE_B2) {
   124			*mode = 3;
   125			return 0;
   126		}
   127	
   128		return -ENODATA;
   129	}
   130	
   131	static int um780xtx_write_profile(struct um780xtx_data *data, long mode)
   132	{
   133		u8 expected;
   134		u8 profile;
   135		int ret;
   136	
   137		if (mode != 2 && mode != 3)
   138			return -EINVAL;
   139		expected = mode == 2 ? UM780XTX_EC_PROFILE_B1 : UM780XTX_EC_PROFILE_B2;
   140	
   141		ret = ec_transaction(expected, NULL, 0, NULL, 0);
   142		if (ret)
   143			return ret;
 > 144		ret = ec_read(UM780XTX_EC_CPU_PROFILE, &profile);
   145		if (ret)
   146			return ret;
   147		if (profile != expected)
   148			return -EIO;
   149	
   150		data->saved_profile = profile;
   151		return 0;
   152	}
   153	
   154	static const u8 um780xtx_sys_point_offsets[] = {
   155		UM780XTX_EC_SYS_POINT1,
   156		UM780XTX_EC_SYS_POINT2,
   157	};
   158	
   159	static ssize_t um780xtx_sys_point_temp_show(struct device *dev,
   160						    struct device_attribute *attr,
   161						    char *buf)
   162	{
   163		struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr);
   164		u8 value;
   165		int ret;
   166	
   167		guard(hwmon_lock)(dev);
   168		ret = ec_read(um780xtx_sys_point_offsets[sattr->index], &value);
   169		if (ret)
   170			return ret;
   171	
   172		return sysfs_emit(buf, "%u\n", value * 1000);
   173	}
   174	
   175	static ssize_t um780xtx_sys_point_temp_store(struct device *dev,
   176						     struct device_attribute *attr,
   177						     const char *buf, size_t count)
   178	{
   179		struct um780xtx_data *data = dev_get_drvdata(dev);
   180		struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr);
   181		u8 points[2];
   182		u8 readback;
   183		long value;
   184		int ret;
   185	
   186		ret = kstrtol(buf, 10, &value);
   187		if (ret)
   188			return ret;
   189	
   190		guard(hwmon_lock)(dev);
   191		/* Validate and clamp against the live peer threshold. */
 > 192		ret = ec_read(UM780XTX_EC_SYS_POINT1, &points[0]);
   193		if (ret)
   194			return ret;
   195		ret = ec_read(UM780XTX_EC_SYS_POINT2, &points[1]);
   196		if (ret)
   197			return ret;
   198		if (points[0] >= points[1] || points[1] >= data->sys_point3)
   199			return -EIO;
   200	
   201		value = DIV_ROUND_CLOSEST(value, 1000);
   202		if (!sattr->index)
   203			value = clamp_val(value, 0, points[1] - 1);
   204		else
   205			value = clamp_val(value, points[0] + 1,
   206					  data->sys_point3 - 1);
   207		points[sattr->index] = value;
   208	
 > 209		ret = ec_write(um780xtx_sys_point_offsets[sattr->index],

210 points[sattr->index]);
211 if (ret)
212 return ret;
213 ret = ec_read(um780xtx_sys_point_offsets[sattr->index], &readback);
214 if (ret)
215 return ret;
216 if (readback != points[sattr->index])
217 return -EIO;
218
219 data->saved_sys_point1 = points[0];
220 data->saved_sys_point2 = points[1];
221 return count;
222 }
223

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

maintainer
#3 lore raw
In reply to [email protected]
Quoted 22 lines · On 8/25/26 11:51, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Missing Kconfig dependency on ACPI_EC leads to undefined reference errors at link time. --

commit 95c2944ab1799dbc9f42157b5a4c6a9050da57ae
Author: Sebastián Peyrott <[email protected]>

hwmon: Add Minisforum UM780 XTX EC monitoring and fan control

This commit adds a DMI-gated hardware monitoring driver for the embedded controller used by the Minisforum UM780 XTX. It exposes CPU and system fan control temperatures and tachometers, utilizing the ACPI EC transport.

Quoted 4 lines
drivers/hwmon/Kconfig +0 -0
index 81a9a1d40eec8..45ac04c89b23d 100644

[ ... ]

Quoted 4 lines
drivers/hwmon/Kconfig +0 -0
@@ -1490,6 +1490,22 @@ config SENSORS_MENF21BMC_HWMON
  	  This driver can also be built as a module. If so the module
  	  will be called menf21bmc_hwmon.
 
Quoted 7 lines

drivers/hwmon/Kconfig config SENSORS_MENF21BMC_HWMON · line 1495

Quoted 3 lines
drivers/hwmon/Kconfig +3 -0
+config SENSORS_MINISFORUM_UM780XTX
+	tristate "Minisforum UM780 XTX EC hardware monitoring"
+	depends on ACPI && DMI && X86

[Severity: Low]
Does this also need to depend on ACPI_EC?

Yes, it does, which also explains the build error reported by 0-day.

Thanks,
Guenter

Quoted 5 lines

If a user configures the kernel with CONFIG_ACPI enabled but leaves CONFIG_ACPI_EC unselected, will this driver fail to build? It appears this would lead to undefined references to ec_read, ec_write, ec_transaction, and ec_get_handle at link time.

maintainer
#5 lore raw
In reply to Sebastián Peyrott
Quoted 20 lines · Sebastián Peyrott

Add a DMI-gated hwmon driver for both fans on the Minisforum UM780 XTX. The EC is an ITE IT5571E, but its register layout and OEM commands are defined by machine-specific firmware, so the driver only binds to the exact board revision and BIOS version on which it was tested.

The driver exposes both fan-control temperatures and tachometers, two OEM automatic CPU fan profiles, and two writable system-fan transition temperatures. It preserves settings selected through its interface across s2idle.

Tested on the target system with concurrent RPM reads, OEM profile changes, system-fan threshold changes, unload/reload stress, and s2idle resume. The settings were correct from the first userspace sample after resume and remained stable for 15 seconds.

OpenAI Codex assisted with reverse-engineering review, code editing, test orchestration, and patch and email preparation across a long interactive session. I reviewed every change, ran the live tests on the target hardware, and take responsibility for the submission.

Quoted 5 lines

Sebastián Peyrott (1):
hwmon: Add Minisforum UM780 XTX EC monitoring and fan control

Note: For a single patch, an introduction patch is unnecessary and just adds work for the maintainer.

Guenter

Quoted 21 lines

---
Changes in v3:
- return -EIO after bounded RPM coherence retries and -ENODATA for an unknown CPU profile;
- seed saved settings at probe, update them only after successful hwmon writes, and restore them at resume without reading the EC at suspend;
- clarify saved-state naming, live threshold validation, and resume documentation.

  Documentation/hwmon/index.rst               |   1 +
  Documentation/hwmon/minisforum-um780xtx.rst |  68 +++
  MAINTAINERS                                 |   7 +
  drivers/hwmon/Kconfig                       |  16 +
  drivers/hwmon/Makefile                      |   1 +
  drivers/hwmon/minisforum-um780xtx.c         | 501 ++++++++++++++++++++
  6 files changed, 594 insertions(+)

create mode 100644 Documentation/hwmon/minisforum-um780xtx.rst create mode 100644 drivers/hwmon/minisforum-um780xtx.c

base-commit: 75f2c0b3690702c90863c2e138cb5520670845ea