platform/x86: bitland-mifs-wmi: Add thermal cooling device fan control
Subsystems (3)
PATCH 1/1 platform/x86: bitland-mifs-wmi: Add thermal cooling device fan control
Register the onboard laptop fans within the Linux thermal framework as cooling devices to enable explicit thermal policy management.
This implementation exposes two separate fan loops:
- "bitland_main_fan"
- "bitland_sys_fan"
The cooling devices support states from 0 to 100:
- State 0 preserves or restores autonomous EC-driven fan curve control.
- States 1 to 100 transition the loop into manual mode, where the state is scaled linearly between a profile-defined minimum and maximum
hardware
duty cycle boundary.
Because safe operational constraints vary depending on the platform's current state and hardware configuration, the driver queries the active WMI platform profile at runtime and branches on the CPU vendor (boot_cpu_data.x86_vendor) to enforce distinct Intel or AMD fan speed safety ranges.
Managed device lifecycle support is handled via devm_add_action_or_reset()
to ensure that the cooling devices are cleanly unregistered and the fans are returned safely to hardware-controlled automatic mode upon driver unbind.
--- .../wmi/devices/bitland-mifs-wmi.rst | 21 +- drivers/platform/x86/bitland-mifs-wmi.c | 196 ++++++++++++++++++ 2 files changed, 216 insertions(+), 1 deletion(-)
Documentation/wmi/devices/bitland-mifs-wmi.rst +20 -1
@@ -201,7 +201,26 @@ The ``GPUMode`` (0x09) allows switching between Hybrid (Muxless) and Discrete take effect in the BIOS/Firmware. Fan Control ------------ +=========== + The system supports both automatic EC control and manual overrides. Command ID 0x14 (``MaxFanSpeedSwitch``) is used to toggle manual control, while ID 0x15 sets the actual PWM duty cycle. + +The driver exposes the two onboard fan loops to the Linux thermal framework as +standard cooling devices: + +- ``bitland_main_fan``: Controls the combined CPU/GPU cooling loop. +- ``bitland_sys_fan``: Controls the auxiliary chassis/system fan loop. + +Thermal framework cooling states range from 0 to 100 and map to hardware operations: + +- **State 0**: Restores autonomous EC fan curve control (Automatic mode). +- **State 1-100**: Switches the loop to Manual mode, scaling the target hardware + speed linearly between the profile's safe minimum and maximum bounds via: + ``target_speed = min_val + ((state - 1) * (max_val - min_val) / 99)`` + +The valid hardware boundaries (``min_val`` and ``max_val``) are evaluated +dynamically at runtime during state changes. The driver checks both the currently +active platform profile and the processor architecture (Intel vs. AMD via CPU +vendor matching) to enforce the correct operational safety envelopes.
drivers/platform/x86/bitland-mifs-wmi.c +196 -0
242 lines not on this page · raw message
base-commit: 174914ea551314c52a61713b9c4bde9e42d48073
Signature · 1 line
2.54.0