summaryrefslogtreecommitdiff
path: root/drivers/acpi/fan_attr.c
AgeCommit message (Collapse)Author
2025-07-07ACPI: fan: Replace sprintf() with sysfs_emit()Eslam Khafagy
Replace sprintf() with sysfs_emit() in function show_fine_grain_control() in according to Documentation/filesystems/sysfs.rst. Link: https://lore.kernel.org/all/20250621055200.166361-1-abdelrahmanfekry375@gmail.com/ Signed-off-by: Eslam Khafagy <eslam.medhat1993@gmail.com> Link: https://patch.msgid.link/20250704004002.70839-1-eslam.medhat1993@gmail.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-07-02ACPI: fan: Replace sprintf()/scnprintf() with sysfs_emit() in show() functionsAbdelrahman Fekry
Update two sysfs show() functions in the ACPI fan driver to use sysfs_emit() and sysfs_emit_at() instead of sprintf() and scnprintf(). - show_fan_speed(): replaced sprintf() with sysfs_emit(). - show_state(): replaced scnprintf() with sysfs_emit() for the first write, and retained sysfs_emit_at() for incremental writes. This change is in accordance with Documentation/filesystems/sysfs.rst, which recommends using sysfs_emit/sysfs_emit_at in all sysfs show() callbacks for buffer safety, clarity, and consistency. Signed-off-by: Abdelrahman Fekry <abdelrahmanfekry375@gmail.com> Link: https://patch.msgid.link/20250621055200.166361-1-abdelrahmanfekry375@gmail.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-02-25ACPI: fan: Add fan speed reporting for fans with only _FSTJoshua Grisham
Add support for ACPI fans with _FST to report their speed even if they do not support fan control. As suggested by Armin Wolf [1] and per the Windows Thermal Management Design Guide [2], Samsung Galaxy Book series devices (and possibly many more devices where the Windows guide was strictly followed) only implement the _FST method and do not support ACPI-based fan control. Currently, these fans are not supported by the kernel driver but this patch will make some very small adjustments to allow them to be supported. This patch is tested and working for me on a Samsung Galaxy Book2 Pro whose DSDT (and several other Samsung Galaxy Book series notebooks which currently have the same issue) can be found at [3]. Link: https://lore.kernel.org/platform-driver-x86/53c5075b-1967-45d0-937f-463912dd966d@gmx.de [1] Link: https://learn.microsoft.com/en-us/windows-hardware/design/device-experiences/design-guide [2] Link: https://github.com/joshuagrisham/samsung-galaxybook-extras/tree/8e3087a06b8bdcdfdd081367af4b744a56cc4ee9/dsdt [3] Signed-off-by: Joshua Grisham <josh@joshuagrisham.com> Reviewed-by: Armin Wolf <W_Armin@gmx.de> Link: https://patch.msgid.link/20250222094407.9753-1-josh@joshuagrisham.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2022-12-06ACPI: fan: Convert to use sysfs_emit_at() APIye xingchen
Follow the advice of the Documentation/filesystems/sysfs.rst and show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2022-02-25ACPI: fan: Add additional attributes for fine grain controlSrinivas Pandruvada
Add additional attributes, which helps in implementing algorithm in the user space to optimize fan control. These attributes are presented in the same directory as the existing performance state attributes. Additional attributes: 1. Support of fine grain control Publish support of presence of fine grain control so that fan speed can be tuned correctly. This attribute is called "fine_grain_control". 2. fan speed Publish the actual fan rpm in sysfs. 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". Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2022-02-25ACPI: fan: Separate file for attributes creationSrinivas Pandruvada
Move the functionality of creation of sysfs attributes under acpi device to a new file fan_attr.c. This cleans up the core fan code, which just use thermal sysfs interface. The original fan.c is renamed to fan_core.c. No functional changes are expected. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>