Documentation/hwmon/yogafan.rst
.. SPDX-License-Identifier: GPL-2.0-only
Supported chips:
Author: Sergio Melas [email protected]
This driver provides fan speed monitoring for modern Lenovo consumer laptops. Most Lenovo laptops do not provide fan tachometer data through standard ISA/LPC hardware monitoring chips. Instead, the data is stored in the Embedded Controller (EC) and exposed via ACPI.
The driver implements a Rate-Limited Lag (RLLag) filter to handle the low-resolution and jittery sampling found in Lenovo EC firmware.
The driver supports two distinct EC architectures. Differentiation is handled deterministically via a DMI Product Family quirk table during the probe phase, eliminating the need for runtime heuristics.
8-bit EC Architecture (Multiplier: 100)
16-bit EC Architecture (Multiplier: 1)
The RLLag filter is a passive discrete-time first-order lag model that ensures:
The driver utilizes the boottime clock (ktime_get_boottime()) to calculate the sampling delta. This ensures that time spent in system suspend is accounted for. If the delta exceeds 5 seconds (e.g., after waking the laptop), the filter automatically resets to the current hardware value to prevent reporting "ghost" RPM data from before the sleep state.
The driver exposes standard hwmon sysfs attributes:
=============== ============================ Attribute Description fanX_input Filtered fan speed in RPM. =============== ============================
Note: If the hardware reports 0 RPM, the filter is bypassed and 0 is reported immediately to ensure the user knows the fan has stopped.
::
METHODOLOGY & IDENTIFICATION:
DSDT ANALYSIS (THE PATH): BIOS ACPI tables were analyzed using 'iasl' and cross-referenced with public dumps. Internal labels (FANS, FAN0, FA2S) are mapped to EmbeddedControl OperationRegion offsets.
EC MEMORY MAPPING (THE OFFSET): Validated by matching NBFC (NoteBook FanControl) XML logic with DSDT Field definitions found in BIOS firmware.
DATA-WIDTH ANALYSIS (THE MULTIPLIER):
ACPI Specification (Field Objects): Documentation on how 8-bit vs 16-bit fields are accessed in OperationRegions. https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html#field-objects
NBFC Projects: Community-driven reverse engineering of Lenovo Legion/LOQ EC memory maps (16-bit raw registers). https://github.com/hirschmann/nbfc/tree/master/Configs
Linux Kernel Timekeeping API: Documentation for ktime_get_boottime() and handling deltas across suspend states. https://www.kernel.org/doc/html/latest/core-api/timekeeping.html
Lenovo IdeaPad Laptop Driver: Reference for DMI-based hardware feature gating in Lenovo laptops. https://github.com/torvalds/linux/blob/master/drivers/platform/x86/lenovo/ideapad-laptop.c