https://wiki.archlinux.org/api.php?action=feedcontributions&user=Filol&feedformat=atomArchWiki - User contributions [en]2024-03-28T17:27:42ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Fan_speed_control&diff=527042Fan speed control2018-06-20T10:22:16Z<p>Filol: Correct mistakes on asus_fan commands</p>
<hr />
<div>[[Category:CPU]]<br />
[[Category:Graphics]]<br />
[[it:Fan speed control]]<br />
[[ja:ファンスピード制御]]<br />
[[ru:Fan speed control]]<br />
[[zh-hans:Fan speed control]]<br />
{{Related articles start}}<br />
{{Related|Lm_sensors}}<br />
{{Related articles end}}<br />
<br />
Fan control can bring various benefits to your system, such as quieter working system and power saving by completely stopping fans on low CPU load.<br />
<br />
{{Warning|Configuring or completely stopping fans on high system load might result in permanently damaged hardware. You have been warned!}}<br />
<br />
== Overview ==<br />
<br />
{{Note|Laptop users should be aware about how cooling system works in their hardware. Some laptops have single fan for both CPU and GPU and cools both at the same time. Some laptops have two fans for CPU and GPU, but the first fan cools down CPU and GPU at the same time, while the other one cools CPU only. In some cases, you will not be able to use [[#Fancontrol (lm-sensors)|Fancontrol]] script due to incompatible cooling architecture (e.g. one fan for both GPU and CPU). [https://github.com/daringer/asus-fan/issues/47#issue-232063547 Here] is some more information about this topic.}}<br />
<br />
There are multiple working solutions for fan control for both desktops and notebooks. Depending on your needs:<br />
<br />
* [[#Fancontrol (lm-sensors)|Fancontrol (lm-sensors)]] - Script (written in Bash) to configure fan speeds. Most suitable for desktops and laptops with a single fan and without discrete graphics card.<br />
* [[#NBFC|NoteBook Fan Control (NBFC)]] - Cross-platform solution for laptop fan control, written in C# and works under [[Mono]] runtime. Most suitable for latest, unsupported by [[#Fancontrol (lm-sensors)|Fancontrol]] laptops.<br />
* [[#Dell laptops|Dell laptops]] - Alternative fan control daemon for some Dell laptops.<br />
* [[#ThinkPad laptops|ThinkPad laptops]] - Fan configuration for some ThinkPad laptops.<br />
* [[#Asus laptops|Asus laptops]] - Configure some Asus laptops for [[#Fancontrol (lm-sensors)|Fancontrol]] or manual control.<br />
<br />
== Fancontrol (lm-sensors) ==<br />
<br />
{{Expansion|Instructions are not clear and organized in overall.}}<br />
<br />
{{ic|fancontrol}} is a part of {{Pkg|lm_sensors}}, which can be used to control the speed of CPU/case fans.<br />
<br />
Support for newer motherboards may not yet be in the Linux kernel. Check the official [https://hwmon.wiki.kernel.org/device_support_status lm-sensors devices] table to see if experimental drivers are available for such motherboards.<br />
<br />
It is recommended not to use {{ic|lm_sensors.service}} to load the needed modules for fancontrol. Instead, manually place them in {{ic|/etc/modules-load.d/load_these.conf}} since the order in which these modules are loaded dictate the order in which the needed symlinks for hwmon get created. In other words, using the {{ic|lm_sensors.service}} causes inconsistencies boot-to-boot which will render the configuration file for fan control worthless for a consistency point of view. To avoid this problem: <br />
<br />
In {{ic|/etc/conf.d/lm_sensors}} you find the modules. If not there, run as root {{ic|sensors-detect}} accepting the defaults. In the {{ic|modules-load.d}} file place one module name per line. Specifying them like this will create a reproducible order. Another alternative is to use absolute device names in the configuration file.[https://bbs.archlinux.org/viewtopic.php?pid=1415552#p1415552]<br />
<br />
=== lm-sensors ===<br />
<br />
Set up [[lm_sensors]].<br />
<br />
{{hc|$ sensors|2=<br />
coretemp-isa-0000<br />
Adapter: ISA adapter<br />
Core 0: +29.0°C (high = +76.0°C, crit = +100.0°C) <br />
<br />
[...]<br />
<br />
it8718-isa-0290<br />
Adapter: ISA adapter<br />
Vcc: +1.14 V (min = +0.00 V, max = +4.08 V) <br />
VTT: +2.08 V (min = +0.00 V, max = +4.08 V) <br />
+3.3V: +3.33 V (min = +0.00 V, max = +4.08 V) <br />
NB Vcore: +0.03 V (min = +0.00 V, max = +4.08 V) <br />
VDRAM: +2.13 V (min = +0.00 V, max = +4.08 V) <br />
fan1: 690 RPM (min = 10 RPM)<br />
temp1: +37.5°C (low = +129.5°C, high = +129.5°C) sensor = thermistor<br />
temp2: +25.0°C (low = +127.0°C, high = +127.0°C) sensor = thermal diode<br />
}}<br />
<br />
If the output does not display an RPM value for the CPU fan, one may need to increase the fan divisor. If fan speed is shown and higher than 0, skip the next step.<br />
<br />
==== Increasing fan_div ====<br />
<br />
The first line of the sensors output is the chipset used by the motherboard for readings of temperatures and voltages. <br />
<br />
Create a file in {{ic|/etc/sensors.d/}}:<br />
<br />
{{hc|/etc/sensors.d/fan-speed-control.conf|chip "''coretemp-isa-''*"<br />
set fan''X''_div 4}}<br />
<br />
Replacing ''coretemp-isa-'' with name of the chipset and ''X'' with the number of the CPU fan to change.<br />
<br />
Save the file, and run as root:<br />
# sensors -s<br />
<br />
which will reload the configuration files.<br />
<br />
Run {{ic|sensors}} again, and check if there is an RPM readout. If not, increase the divisor to 8, 16, or 32. YMMV!<br />
<br />
=== Configuration ===<br />
<br />
{{Note|Advanced users may want to skip this section and write {{ic|/etc/fancontrol}} on their own, which also saves them from hearing all of the fans at full speed.}}<br />
<br />
Once sensors are properly configured, use {{ic|pwmconfig}} to test and configure fan speed control. The default configuration options should create {{ic|/etc/fancontrol}} configuration file:<br />
# pwmconfig<br />
<br />
==== Tweaking ====<br />
<br />
{{Note|On several systems, the included script may report errors as it tries to calibrate fans to the respective pulse-width modulation (PWM). Users may safely ignore these errors. The problem is that the script does not wait long enough before ramping up or down the PWM.}}<br />
<br />
Users wishing more control may need to tweak the generated configuration. Here is a sample configuration file:<br />
INTERVAL=10<br />
DEVPATH=hwmon0=devices/platform/coretemp.0 hwmon2=devices/platform/w83627ehf.656<br />
DEVNAME=hwmon0=coretemp hwmon2=w83627dhg<br />
FCTEMPS=hwmon0/device/pwm1=hwmon0/device/temp1_input<br />
FCFANS= hwmon0/device/pwm1=hwmon0/device/fan1_input<br />
MINTEMP=hwmon0/device/pwm1=20<br />
MAXTEMP=hwmon0/device/pwm1=55<br />
MINSTART=hwmon0/device/pwm1=150<br />
MINSTOP=hwmon0/device/pwm1=105<br />
<br />
* {{ic|INTERVAL}}: how often the daemon should poll CPU temps and adjust fan speeds. INTERVAL is in seconds.<br />
<br />
The rest of the configuration file is split into (at least) two values per configuration option. Each configuration option first points to a PWM device which is written to which sets the fan speed. The second "field" is the actual value to set. This allows monitoring and controlling multiple fans and temperatures.<br />
<br />
* {{ic|FCTEMPS}}: The temperature input device to read for CPU temperature. The above example corresponds to {{ic|/sys/class/hwmon/hwmon0/device/temp1_input}}.<br />
* {{ic|FCFANS}}: The current fan speed, which can be read (like the temperature) in {{ic|/sys/class/hwmon/hwmon0/device/fan1_input}}<br />
* {{ic|MINTEMP}}: The temperature (&deg;C) at which to '''SHUT OFF''' the CPU fan. Efficient CPUs often will not need a fan while idling. Be sure to set this to a temperature that ''you know is safe''. Setting this to 0 is not recommended and may ruin your hardware!<br />
* {{ic|MAXTEMP}}: The temperature (&deg;C) at which to spin the fan at its ''MAXIMUM'' speed. This should be probably be set to perhaps 10 or 20 degrees (&deg;C) below your CPU's critical/shutdown temperature. Setting it closer to MINTEMP will result in higher fan speeds overall.<br />
* {{ic|MINSTOP}}: The PWM value at which your fan stops spinning. Each fan is a little different. Power tweakers can {{ic|echo}} different values (between 0 and 255) to {{ic|/sys/class/hwmon/hwmon0/device/pwm1}} and then watch the CPU fan. When the CPU fan stops, use this value.<br />
* {{ic|MINSTART}}: The PWM value at which your fan starts to spin again. This is often a higher value than MINSTOP as more voltage is required to overcome inertia.<br />
<br />
There are also two settings fancontrol needs to verify the configuration file is still up to date. The lines start with the setting name and an equality sign, followed by groups of hwmon-class-device=setting, separated by spaces. You need to specify each setting for each hwmon class device you use anywhere in the config, or fancontrol will not work.<br />
<br />
* {{ic|DEVPATH}}: Sets the physical device. You can determine this by executing the command<br />
readlink -f /sys/class/hwmon/''[your-hwmon-device]''/device | sed -e 's/^\/sys\///'<br />
* {{ic|DEVNAME}}: Sets the name of the device. Try:<br />
$ sed -e 's/[[:space:]=]/_/g' /sys/class/hwmon/''[your-hwmon-device]''/device/name<br />
<br />
{{Tip|Use {{ic|MAXPWM}} and {{ic|MINPWM}} options that limit fan speed range. See fancontrol manual page for details.}}<br />
{{Tip|Not only the {{ic|DEVPATH}} may change on reboot due to different timing of module loading, but also e.g. the temperature sensor paths (hwmon0/device/temp1_input becomes hwmon0/temp1_input). This usually happens on a kernel update. Check the system log to find out which is the troublemaker:<br />
# systemctl status fancontrol.service<br />
and correct your config file accordingly.}}<br />
<br />
=== fancontrol ===<br />
{{Note|Upon upgrading/changing the kernel, running {{ic|fancontrol}} may result in an error regarding changed device paths. This issue may be fixed by running {{ic|sensors-detect}} again and restarting the system.}}<br />
<br />
Try to run ''fancontrol'':<br />
<br />
# /usr/bin/fancontrol<br />
<br />
A properly configured setup will not error out and will take control of system fans. Users should hear system fans slowing shortly after executing this command.<br />
<br />
To enable starting ''fancontrol'' automatically on every boot, [[enable]] {{ic|fancontrol.service}}.<br />
<br />
For an unofficial GUI [[install]] {{AUR|fancontrol-gui}} or {{AUR|fancontrol-kcm}}.<br />
<br />
== NBFC ==<br />
<br />
NBFC is a cross-platform fan control solution for notebooks. It comes with a powerful configuration system, which allows to adjust it to many different notebook models, including some of the latest ones.<br />
<br />
=== Installation ===<br />
<br />
NBFC can be installed as {{AUR|nbfc-git}}. Also enable {{ic|nbfc.service}}.<br />
<br />
=== Configuration ===<br />
<br />
NBFC comes with pre-made profiles. You can find them in {{ic|/opt/nbfc/Configs/}} directory. When applying them, use exact profile name without extension (e.g. {{ic|some profile.xml}} becomes {{ic|"some profile"}}).<br />
<br />
Check if there is anything NBFC can recommend:<br />
$ nbfc config -r<br />
<br />
If there is at least one model, try to apply this profile and see how fan speeds are being handled. For example:<br />
$ nbfc config -a "Asus Zenbook UX430UA"<br />
<br />
{{Note|If you are getting error message "''File Descriptor does not support writing''" - append {{ic|1=ec_sys.write_support=1}} to kernel parameters.}}<br />
<br />
If there are no recommended models, go to [https://github.com/hirschmann/nbfc/tree/master/Configs NBFC git repository] or {{ic|/opt/nbfc/Configs/}} and check if there are any similar models available from the same manufacturer. For example, on '''Asus Zenbook UX430UQ''', the configuration '''Asus Zenbook UX430UA''' did not work well (fans completelly stopped all the time), but '''Asus Zenbook UX410UQ''' worked fantastically.<br />
<br />
Run {{ic|nbfc}} to see all options. More information about configuration is available at [https://github.com/hirschmann/nbfc/wiki/ upstream wiki].<br />
<br />
== Dell laptops ==<br />
<br />
{{ic|i8kutils}} is a daemon to configure fan speed according to CPU temperatures on some Dell Inspiron and Latitude laptops. It uses the {{ic|/proc/i8k}} interface provided by the {{ic|dell_smm_hwmon}} driver (formerly {{ic|i8k}}). Results will vary depending on the exact model of laptop.<br />
<br />
=== Installation ===<br />
<br />
{{AUR|i8kutils}} is the main package to control fan speed. Additionally, you might want to install these:<br />
<br />
* {{Pkg|tcl}} - must be installed in order to run {{ic|i8kmon}} as a background service (using the {{ic|--daemon}} option).<br />
* {{Pkg|tk}} - must be installed together with {{Pkg|tcl}} to run as X11 desktop applet.<br />
<br />
=== Configuration ===<br />
<br />
By default, {{ic|i8kmon}} only monitors the CPU temperature and fan speed passively. To enable its fan speed control, either run it with the {{ic|--auto}} option or enable the option permanently in {{ic|/etc/i8kutils/i8kmon.conf}}:<br />
<br />
set config(auto) 1<br />
<br />
The temperature points at which the fan changes speed can be adjusted in the same configuration file. Only three fans speeds are supported (high, low, and off). Look for a section similar to the following:<br />
<br />
set config(0) {{0 0} -1 55 -1 55}<br />
set config(1) {{1 1} 45 75 45 75}<br />
set config(2) {{2 2} 65 128 65 128}<br />
<br />
This example starts the fan at low speed when the CPU temperature reaches 55 °C, switching to high speed at 75 °C. The fan will switch back to low speed once the temperature drops to 65 °C, and turns off completely at 45 °C.<br />
<br />
=== Installation as a service ===<br />
<br />
{{ic|i8kmon}} can be started automatically as a [[systemd]] service using a unit file similar to the following:<br />
<br />
{{hc|1=/etc/systemd/system/i8kmon.service|2=[Unit]<br />
Description=i8kmon<br />
<br />
[Service]<br />
#ExecStartPre=/usr/bin/smm 30a3 # uncomment to disable BIOS fan control<br />
#ExecStopPost=/usr/bin/smm 31a3 # ... and re-enable it afterwards<br />
ExecStart=/usr/bin/i8kmon<br />
Restart=always<br />
RestartSec=5<br />
<br />
[Install]<br />
WantedBy=multi-user.target}}<br />
<br />
== ThinkPad laptops ==<br />
<br />
The embedded controller (EC) regulates fan speed. However, in order to take control over it, add {{ic|1=fan_control=1}} to your [[kernel parameters]].<br />
<br />
Current fan control daemons available in the [[AUR]] are {{AUR|simpfand-git}} and {{AUR|thinkfan}} (recommended).<br />
<br />
=== Installation ===<br />
<br />
Install {{AUR|thinkfan}}. Optionally but recommended, install {{pkg|lm_sensors}}. Then have a look at the files:<br />
<br />
# pacman -Ql thinkfan<br />
<br />
Note that the thinkfan package installs /usr/lib/modprobe.d/thinkpad_acpi.conf, which contains<br />
<br />
options thinkpad_acpi fan_control=1<br />
<br />
So fan control is enabled by default. Alternatively, you can enable fan control as follows:<br />
<br />
$ echo "options thinkpad_acpi fan_control=1" > /etc/modprobe.d/thinkfan.conf<br />
<br />
Now, load the module: <br />
<br />
$ su<br />
# modprobe thinkpad_acpi<br />
# cat /proc/acpi/ibm/fan<br />
<br />
You should see that the fan level is "auto" by default, but you can echo a level command to the same file to control the fan speed manually. The thinkfan daemon will do this automatically.<br />
<br />
Set thinkfan to run at startup by editing {{ic|/etc/default/thinkfan}} and adding the following line:<br />
<br />
START=yes<br />
<br />
Finally, enable the thinkfan systemd service:<br />
<br />
$ systemctl enable thinkfan<br />
<br />
To configure the temperature thresholds, you will need to copy one of the example config files (e.g. /usr/share/doc/thinkfan/examples/thinkfan.conf.simple) to /etc/thinkfan.conf, and modify to taste. This file specifies which sensors to read, and which interface to use to control the fan. Some systems have /proc/acpi/ibm/fan available; on others, you will need to specify something like<br />
<br />
hwmon /sys/devices/virtual/thermal/thermal_zone0/temp<br />
<br />
to use generic hwmon sensors instead of thinkpad-specific ones.<br />
<br />
=== Running ===<br />
<br />
You can test your configuration first by running thinkfan manually (as root):<br />
<br />
# thinkfan -n<br />
<br />
and see how it reacts to the load level of whatever other programs you have running.<br />
<br />
When you have it configured correctly, [[start/enable]] {{ic|thinkfan.service}}.<br />
<br />
=== Old packages which have gone missing ===<br />
{{Remove|What value does this section have?}}<br />
{{AUR|tpfand}}{{Broken package link|{{aur-mirror|tpfand}}}} and a version that does not require [[HAL]] {{AUR|tpfand-no-hal}}{{Broken package link|{{aur-mirror|tpfand-no-hal}}}} are not actively developed anymore, and no longer available. An additional GTK+ frontend was provided in the {{AUR|tpfan-admin}}{{Broken package link|{{aur-mirror|tpfan-admin}}}} package in the [[AUR]] which enables the monitoring of temperatures as well as the graphical adjustment of trigger points.<br />
<br />
Due to tpfand not beeing actively developed anymore, there was a fork called tpfanco (which in fact uses the same names for the executables as tpfand): {{AUR|tpfanco-svn}}{{Broken package link|{{aur-mirror|tpfanco-svn}}}}.<br />
<br />
The configuration file for tpfand (same for tpfanco) was {{ic|/etc/tpfand.conf}}.<br />
<br />
Additionally, the {{AUR|tpfand-profiles}}{{Broken package link|{{aur-mirror|tpfand-profiles}}}} package in the [[AUR]] provided the latest fan profiles for various thinkpad models.<br />
<br />
== Asus laptops ==<br />
<br />
This topic will cover drivers configuration on Asus laptops '''for [[#Fancontrol_.28lm-sensors.29|Fancontrol (lm-sensors)]]'''.<br />
<br />
=== Kernel modules overview ===<br />
<br />
* [[#asus-nb-wmi]] is a kernel module, which is included in mainstream Linux kernel and is loaded automatically in Asus laptops. It will only allow to control a single fan and if there is a second fan - you will not have any controls over it. Blacklisting this module will prevent keyboard backlight to work.<br />
* [[#asus_fan]] is a kernel module, which allows to control both fans on some older Asus laptops. Does not work with the most recent models.<br />
<br />
In configuration files, we are going to use full paths to sysfs files (e.g. {{ic|/sys/devices/platform/asus-nb-wmi/hwmon/hwmon<nowiki>[[:print:]]*</nowiki>/pwm1}}). This is because hwmon'''1''' might change to any other number after reboot. [[#Fancontrol_.28lm-sensors.29|Fancontrol (lm-sensors)]] is written in [[Bash]], so using these paths in configuration file is completely acceptable. You can find complete {{ic|/etc/fancontrol}} configuration file examples at [[ASUS N550JV#Fan control]].<br />
<br />
=== asus-nb-wmi ===<br />
<br />
Kernel module {{ic|asus-nb-wmi}} is already included in Linux kernel and should already be loaded to your kernel.<br />
<br />
Below are the commands to control it. Check if you have any controls over your fan:<br />
<br />
# echo 255 > /sys/devices/platform/asus-nb-wmi/hwmon/hwmon<nowiki>[[:print:]]*</nowiki>/pwm1 # Full fan speed (Value: 255)<br />
# echo 0 > /sys/devices/platform/asus-nb-wmi/hwmon/hwmon<nowiki>[[:print:]]*</nowiki>/pwm1 # Fan is stopped (Value: 0)<br />
# echo 2 > /sys/devices/platform/asus-nb-wmi/hwmon/hwmon[<nowiki>[[:print:]]*</nowiki>/pwm1_enable # Change fan mode to automatic<br />
# echo 1 > /sys/devices/platform/asus-nb-wmi/hwmon/hwmon<nowiki>[[:print:]]*</nowiki>/pwm1_enable # Change fan mode to manual<br />
<br />
If you were able to modify fan speed with above commands, then continue with [[#Generate config file with pmwconfig]].<br />
<br />
=== asus_fan ===<br />
<br />
Install {{Aur|asus-fan-dkms-git}}. Load kernel module:<br />
<br />
# modprobe asus_fan<br />
<br />
{{Note|For unknown reasons this is likely going to fail (no asus_fan module found in your system). [[Mkinitcpio#Image creation and activation]] and system reboot usually fix this issue.}}<br />
<br />
Check if you have any control over both fans:<br />
<br />
# echo 255 > /sys/devices/platform/asus_fan/hwmon/hwmon<nowiki>[[:print:]]*</nowiki>/pwm1 # Full CPU fan speed (Value: 255)<br />
# echo 0 > /sys/devices/platform/asus_fan/hwmon/hwmon<nowiki>[[:print:]]*</nowiki>/pwm1 # CPU fan is stopped (Value: 0)<br />
# echo 255 > /sys/devices/platform/asus_fan/hwmon/hwmon<nowiki>[[:print:]]*</nowiki>/pwm2 # Full GFX fan speed (Value: 255)<br />
# echo 0 > /sys/devices/platform/asus_fan/hwmon/hwmon<nowiki>[[:print:]]*</nowiki>/pwm2 # GFX fan is stopped (Value: 0)<br />
# echo 2 > /sys/devices/platform/asus_fan/hwmon/hwmon<nowiki>[[:print:]]*</nowiki>/pwm1_enable # Change CPU fan mode to automatic<br />
# echo 1 > /sys/devices/platform/asus_fan/hwmon/hwmon<nowiki>[[:print:]]*</nowiki>/pwm1_enable # Change CPU fan mode to manual<br />
# echo 2 > /sys/devices/platform/asus_fan/hwmon/hwmon<nowiki>[[:print:]]*</nowiki>/pwm2_enable # Change GFX fan mode to automatic<br />
# echo 1 > /sys/devices/platform/asus_fan/hwmon/hwmon<nowiki>[[:print:]]*</nowiki>/pwm2_enable # Change GFX fan mode to manual<br />
# cat /sys/devices/platform/asus_fan/hwmon/hwmon<nowiki>[[:print:]]*</nowiki>/temp1_input # Display GFX temperature (will always be 0 when GFX is disabled/unused)<br />
<br />
If everything works, you might want to load this kernel module on boot:<br />
<br />
{{hc|/etc/modules-load.d/asus_fan.conf|2=<nowiki><br />
# Load asus_fan module on boot:<br />
asus_fan<br />
</nowiki>}}<br />
<br />
Continue with [[#Generate config file with pmwconfig]].<br />
<br />
=== Generate config file with pmwconfig ===<br />
<br />
If you get an error {{ic|There are no working fan sensors, all readings are 0}} while generating config file with {{ic|pwmconfig}}, open first console and execute:<br />
<br />
# watch -n 1 "echo 2 > /sys/devices/platform/'''<kernel_module>'''/hwmon/hwmon<nowiki>[[:print:]]*</nowiki>/pwm'''1'''_enable"<br />
<br />
If you use {{ic|asus_fan}} kernel module and have 2nd fan, in second console:<br />
<br />
# watch -n 1 "echo 2 > /sys/devices/platform/'''<kernel_module>'''/hwmon/hwmon<nowiki>[[:print:]]*</nowiki>/pwm'''2'''_enable"<br />
<br />
And finally, in the third console:<br />
<br />
# pwmconfig<br />
<br />
Once you are done and the configuration file is generated, you should stop the first and second consoles. Continue with [[#Fancontrol_.28lm-sensors.29|Fancontrol (lm-sensors)]]. After config file is generated, you might need to manually replace PWM values with full sysfs paths as they are used in these steps, because hwmon number values might change after reboot.<br />
<br />
== AMDGPU sysfs fan control ==<br />
[[AMDGPU]] kernel driver offers fan control for graphics cards via hwmon in sysfs.<br />
<br />
=== Configuration of manual control ===<br />
To switch to manual fan control from automatic, run<br />
# echo "1" > /sys/class/drm/card0/device/hwmon/hwmon0/pwm1_enable<br />
Set up fan speed to e.g. 50% (100% are 255 PWM cycles, thus calculate desired fan speed percentage by multiplying its value by 2.55):<br />
# echo "128" > /sys/class/drm/card0/device/hwmon/hwmon0/pwm1<br />
To reset to automatic fan control, run<br />
# echo "2" > /sys/class/drm/card0/device/hwmon/hwmon0/pwm1_enable<br />
{{Warning|Resetting fan speed to auto may not work due to a driver bug and instead a restart of the driver may be required as a workaround.}}<br />
<br />
=== fancurve script ===<br />
Not just fan controls are offered via hwmon in sysfs, but also GPU temperature reading:<br />
cat /sys/class/drm/card0/device/hwmon/hwmon0/temp1_input<br />
This outputs GPU temperature in °C + three zeroes, e.g. {{ic|33000}} for 33°C.<br />
<br />
The bash script [https://github.com/grmat/amdgpu-fancontrol amdgpu-fancontrol] by grmat offers a fully automatic fan control by using the described sysfs hwmon functionality.<br />
It also allows to comfortably adjust the fancurve's temperature/PWM cycles assignments and a hysteresis by offering abstracted configuration fields at the top of the script.<br />
{{Tip| In order to function correctly, the script needs at least three defined temperature/PWM cycles assignments.}}<br />
<br />
For safety reasons, the script sets fan control again to auto when shutting down. This may cause spinning up of fans, which can be worked around at cost of security by setting {{ic|set_fanmode 1}} in the section {{ic|function reset_on_fail}}.<br />
<br />
==== Setting up fancurve script ====<br />
To start the script, it is recommend to do so via [[systemd]] init system. This way the script's verbose output can be read via [[journalctl]]/systemctl status. For this purpose, a .service configuration file is already included in the GitHub repository.<br />
<br />
It may also be required to restart the script via a [[Power_management#Sleep_hooks|root-resume.service]] after hibernation in order to make it automatically function properly again:<br />
{{hc|/etc/systemd/system/root-resume.service|<nowiki><br />
[Unit]<br />
Description=Local system resume actions<br />
After=suspend.target<br />
<br />
[Service]<br />
Type=simple<br />
ExecStart=/usr/bin/systemctl restart amdgpu-fancontrol.service<br />
<br />
[Install]<br />
WantedBy=suspend.target</nowiki>}}</div>Filol