Skip to content

Commit 51ed342

Browse files
Rongronggg9ij-intel
authored andcommitted
platform/x86: lenovo-wmi-other: Add HWMON for fan reporting/tuning
Register an HWMON device for fan reporting/tuning according to Capability Data 00 (capdata00) and Fan Test Data (capdata_fan) provided by lenovo-wmi-capdata. The corresponding HWMON nodes are: - fanX_div: internal RPM divisor - fanX_input: current RPM - fanX_max: maximum RPM - fanX_min: minimum RPM - fanX_target: target RPM (tunable, 0=auto) Information from capdata00 and capdata_fan are used to control the visibility and constraints of HWMON attributes. Fan info from capdata00 is collected on bind, while fan info from capdata_fan is collected in a callback. Once all fan info is collected, register the HWMON device. Signed-off-by: Rong Zhang <i@rong.moe> Reviewed-by: Derek J. Clark <derekjohn.clark@gmail.com> Tested-by: Kurt Borja <kuurtb@gmail.com> Link: https://patch.msgid.link/20260120182104.163424-8-i@rong.moe Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1 parent 67d9a39 commit 51ed342

3 files changed

Lines changed: 507 additions & 10 deletions

File tree

Documentation/wmi/devices/lenovo-wmi-other.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ under the following path:
3131

3232
/sys/class/firmware-attributes/lenovo-wmi-other/attributes/<attribute>/
3333

34+
Additionally, this driver also exports attributes to HWMON.
35+
3436
LENOVO_CAPABILITY_DATA_00
3537
-------------------------
3638

@@ -39,6 +41,14 @@ WMI GUID ``362A3AFE-3D96-4665-8530-96DAD5BB300E``
3941
The LENOVO_CAPABILITY_DATA_00 interface provides various information that
4042
does not rely on the gamezone thermal mode.
4143

44+
The following HWMON attributes are implemented:
45+
- fanX_div: internal RPM divisor
46+
- fanX_input: current RPM
47+
- fanX_target: target RPM (tunable, 0=auto)
48+
49+
Due to the internal RPM divisor, the current/target RPMs are rounded down to
50+
its nearest multiple. The divisor itself is not necessary to be a power of two.
51+
4252
LENOVO_CAPABILITY_DATA_01
4353
-------------------------
4454

@@ -70,6 +80,10 @@ WMI GUID ``B642801B-3D21-45DE-90AE-6E86F164FB21``
7080
The LENOVO_FAN_TEST_DATA interface provides reference data for self-test of
7181
cooling fans.
7282

83+
The following HWMON attributes are implemented:
84+
- fanX_max: maximum RPM
85+
- fanX_min: minimum RPM
86+
7387
WMI interface description
7488
=========================
7589

drivers/platform/x86/lenovo/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ config LENOVO_WMI_GAMEZONE
263263
config LENOVO_WMI_TUNING
264264
tristate "Lenovo Other Mode WMI Driver"
265265
depends on ACPI_WMI
266+
select HWMON
266267
select FW_ATTR_CLASS
267268
select LENOVO_WMI_CAPDATA
268269
select LENOVO_WMI_EVENTS

0 commit comments

Comments
 (0)