ACPI / fan: Properly handle fine grain control
Subsystems (2)
PATCH v2 1/1 ACPI / fan: Properly handle fine grain control
When _FIF object specifies support for fine grain control, then fan speed can be set from 0 to 100% with the recommended minimum "step size" via _FSL object. Here the control value doesn't need to match any value from _FPS object.
Currently we have a simple solution implemented which just pick maximum control value from _FPS to display the actual state, but this is not optimal when there is a big window between two control values in _FPS. Also there is no way to set to any speed which doesn't match control values in _FPS. The system firmware can start the fan at speed which doesn't match any control value.
To support fine grain control via thermal sysfs:
- cooling device max state is not _FPS state count but it will be 100 / _FIF.step_size
- cooling device current state is 100 / _FIF.step_size
- cooling device set state will set the control value curr_state * _FIF.step_size plus any adjustment for 100%. By the spec, when control value do not sum to 100% because of _FIF.step_size, OSPM may select an appropriate ending Level increment to reach 100%.
Also publish the actual fan rpm in sysfs in the same place where _FIF objects are displayed. Knowing fan rpm is helpful to reduce noise level and use passive control instead. Also fan performance may not be same over time, so the same control value may not be enough to run the fan at a speed. So a feedback value of speed is helpful. This sysfs attribute is called "fan_speed_rpm".
---
v2-update
Change log is missed for v2.
Missed one kfree(obj) on failure.
v2
Fix for build issue as reported by Reported-by: kernel test robot <[email protected]>
.../acpi/fan_performance_states.rst | 10 ++ drivers/acpi/fan.c | 142 ++++++++++++++---- 2 files changed, 125 insertions(+), 27 deletions(-)
Documentation/admin-guide/acpi/fan_performance_states.rst +10 -0
@@ -60,3 +60,13 @@ For example:: When a given field is not populated or its value provided by the platform firmware is invalid, the "not-defined" string is shown instead of the value. + +ACPI Fan Performance Feedback +============================= + +The optional _FST object provides status information for the fan device. +This includes field to provide current fan speed in revolutions per minute +at which the fan is rotating. + +This speed is presented in the sysfs using the attribute "fan_speed_rpm", +in the same directory as performance states.
drivers/acpi/fan.c +115 -27
223 lines not on this page · raw message
Signature · 1 line
2.34.1