1.. SPDX-License-Identifier: GPL-2.0-only 2 3=============================================================================================== 4Kernel driver yogafan 5=============================================================================================== 6 7Supported chips: 8 9 * Lenovo Yoga, Legion, IdeaPad, Slim, Flex, and LOQ Embedded Controllers 10 * Prefix: 'yogafan' 11 * Addresses: ACPI handle (See Database Below) 12 13Author: Sergio Melas <sergiomelas@gmail.com> 14 15Description 16----------- 17 18This driver provides fan speed monitoring for modern Lenovo consumer laptops. 19Most Lenovo laptops do not provide fan tachometer data through standard 20ISA/LPC hardware monitoring chips. Instead, the data is stored in the 21Embedded Controller (EC) and exposed via ACPI. 22 23The driver implements a **Rate-Limited Lag (RLLag)** filter to handle 24the low-resolution and jittery sampling found in Lenovo EC firmware. 25 26Hardware Identification and Multiplier Logic 27-------------------------------------------- 28 29The driver supports two distinct EC architectures. Differentiation is handled 30deterministically via a DMI Product Family quirk table during the probe phase, 31eliminating the need for runtime heuristics. 32 331. 8-bit EC Architecture (Multiplier: 100) 34 35 - **Families:** Yoga, IdeaPad, Slim, Flex. 36 - **Technical Detail:** These models allocate a single 8-bit register for 37 tachometer data. Since 8-bit fields are limited to a value of 255, the 38 BIOS stores fan speed in units of 100 RPM (e.g., 42 = 4200 RPM). 39 402. 16-bit EC Architecture (Multiplier: 1) 41 42 - **Families:** Legion, LOQ. 43 - **Technical Detail:** High-performance gaming models require greater 44 precision for fans exceeding 6000 RPM. These use a 16-bit word (2 bytes) 45 storing the raw RPM value directly. 46 47Filter Details 48-------------- 49 50The RLLag filter is a passive discrete-time first-order lag model that ensures: 51 - **Smoothing:** Low-resolution step increments are smoothed into 1-RPM increments. 52 - **Slew-Rate Limiting:** Prevents unrealistic readings by capping the change 53 to 1500 RPM/s, matching physical fan inertia. 54 - **Polling Independence:** The filter math scales based on the time delta 55 between userspace reads, ensuring a consistent physical curve regardless 56 of polling frequency. 57 58Suspend and Resume 59------------------ 60 61The driver utilizes the boottime clock (ktime_get_boottime()) to calculate the 62sampling delta. This ensures that time spent in system suspend is accounted 63for. If the delta exceeds 5 seconds (e.g., after waking the laptop), the 64filter automatically resets to the current hardware value to prevent 65reporting "ghost" RPM data from before the sleep state. 66 67Usage 68----- 69 70The driver exposes standard hwmon sysfs attributes: 71 72=============== ============================ 73Attribute Description 74fanX_input Filtered fan speed in RPM. 75=============== ============================ 76 77 78Note: If the hardware reports 0 RPM, the filter is bypassed and 0 is reported 79immediately to ensure the user knows the fan has stopped. 80 81 82==================================================================================================== 83 LENOVO FAN CONTROLLER: MASTER REFERENCE DATABASE (2026) 84==================================================================================================== 85 86:: 87 88 MODEL (DMI PN) | FAMILY / SERIES | EC OFFSET | FULL ACPI OBJECT PATH | WIDTH | MULTiplier 89 ---------------------------------------------------------------------------------------------------- 90 82N7 | Yoga 14cACN | 0x06 | \_SB.PCI0.LPC0.EC0.FANS | 8-bit | 100 91 80V2 / 81C3 | Yoga 710/720 | 0x06 | \_SB.PCI0.LPC0.EC0.FAN0 | 8-bit | 100 92 83E2 / 83DN | Yoga Pro 7/9 | 0xFE | \_SB.PCI0.LPC0.EC0.FANS | 8-bit | 100 93 82A2 / 82A3 | Yoga Slim 7 | 0x06 | \_SB.PCI0.LPC0.EC0.FANS | 8-bit | 100 94 81YM / 82FG | IdeaPad 5 | 0x06 | \_SB.PCI0.LPC0.EC0.FAN0 | 8-bit | 100 95 82JW / 82JU | Legion 5 (AMD) | 0xFE/0xFF | \_SB.PCI0.LPC0.EC0.FANS (Fan1) | 16-bit | 1 96 82JW / 82JU | Legion 5 (AMD) | 0xFE/0xFF | \_SB.PCI0.LPC0.EC0.FA2S (Fan2) | 16-bit | 1 97 82WQ | Legion 7i (Int) | 0xFE/0xFF | \_SB.PCI0.LPC0.EC0.FANS (Fan1) | 16-bit | 1 98 82WQ | Legion 7i (Int) | 0xFE/0xFF | \_SB.PCI0.LPC0.EC0.FA2S (Fan2) | 16-bit | 1 99 82XV / 83DV | LOQ 15/16 | 0xFE/0xFF | \_SB.PCI0.LPC0.EC0.FANS /FA2S | 16-bit | 1 100 83AK | ThinkBook G6 | 0x06 | \_SB.PCI0.LPC0.EC0.FAN0 | 8-bit | 100 101 81X1 | Flex 5 | 0x06 | \_SB.PCI0.LPC0.EC0.FAN0 | 8-bit | 100 102 *Legacy* | Pre-2020 Models | 0x06 | \_SB.PCI0.LPC.EC.FAN0 | 8-bit | 100 103 ---------------------------------------------------------------------------------------------------- 104 105METHODOLOGY & IDENTIFICATION: 106 1071. DSDT ANALYSIS (THE PATH): 108 BIOS ACPI tables were analyzed using 'iasl' and cross-referenced with 109 public dumps. Internal labels (FANS, FAN0, FA2S) are mapped to 110 EmbeddedControl OperationRegion offsets. 111 1122. EC MEMORY MAPPING (THE OFFSET): 113 Validated by matching NBFC (NoteBook FanControl) XML logic with DSDT Field 114 definitions found in BIOS firmware. 115 1163. DATA-WIDTH ANALYSIS (THE MULTIPLIER): 117 - 8-bit (Multiplier 100): Standard for Yoga/IdeaPad. Raw values (0-255). 118 - 16-bit (Multiplier 1): Standard for Legion/LOQ. Two registers (0xFE/0xFF). 119 120 121References 122---------- 123 1241. **ACPI Specification (Field Objects):** Documentation on how 8-bit vs 16-bit 125 fields are accessed in OperationRegions. 126 https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html#field-objects 127 1282. **NBFC Projects:** Community-driven reverse engineering 129 of Lenovo Legion/LOQ EC memory maps (16-bit raw registers). 130 https://github.com/hirschmann/nbfc/tree/master/Configs 131 1323. **Linux Kernel Timekeeping API:** Documentation for ktime_get_boottime() and 133 handling deltas across suspend states. 134 https://www.kernel.org/doc/html/latest/core-api/timekeeping.html 135 1364. **Lenovo IdeaPad Laptop Driver:** Reference for DMI-based hardware 137 feature gating in Lenovo laptops. 138 https://github.com/torvalds/linux/blob/master/drivers/platform/x86/lenovo/ideapad-laptop.c 139