From ba64f1abc37944d3102da377123431875f483a92 Mon Sep 17 00:00:00 2001 From: frozenMustelid <31948457+frozenMustelid@users.noreply.github.com> Date: Thu, 21 Jan 2021 23:06:58 -0500 Subject: [PATCH 1/5] Add install script Install script will replace the old fan script and service file, but will leave the cfg file alone if it already exists in /etc --- install.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 install.sh diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..7866cad --- /dev/null +++ b/install.sh @@ -0,0 +1,18 @@ +#! /bin/bash + +#Intentionally overwrites old script +cp amdgpu-fancontrol /usr/bin/ + + +#Won't overwrite existing config file +cp -n amdgpu-fancontrol.cfg /etc/amdgpu-fancontrol.cfg + + +#Copy the service to the right place +cp amdgpu-fancontrol.service /etc/systemd/system/ + +#Start the service on boot +systemctl enable amdgpu-fancontrol + + +#You can check the status of the service with "systemctl status amdgpu-fancontrol" From 17b9f47ee22b345f2d822e6eb73e3820d9768e3c Mon Sep 17 00:00:00 2001 From: frozenMustelid <31948457+frozenMustelid@users.noreply.github.com> Date: Thu, 21 Jan 2021 23:27:09 -0500 Subject: [PATCH 2/5] Updated default config file to better handle 0 RPM The default config file does not work well with GPUs that force 0 RPM mode. Specifically, a PWM value of 102 is the minimum value that the fans on the ASRock Taichi 5700 XT will respond to. If your GPU's 0 RPM mode requires an even higher PWM value to turn on the fans, please send a pull request with these higher values and the name of the card that needs them. I've also set the fan curve to be more aggressive in general. Max fan speed still isn't enough to keep hotspot (junction) temps below the throttle point of 110 C, but it will keep it low enough to stop the infamous 5700XT green flashes. --- amdgpu-fancontrol.cfg | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 amdgpu-fancontrol.cfg diff --git a/amdgpu-fancontrol.cfg b/amdgpu-fancontrol.cfg new file mode 100644 index 0000000..4babd1b --- /dev/null +++ b/amdgpu-fancontrol.cfg @@ -0,0 +1,34 @@ +# Configuration file for amdgpu fancontol service + +# Set temperature and corresponding pwm values in ascending order and with the +# same amount of values. A linear interpolation will happen for values in +# between. + +HYSTERESIS=3000 + +# Temperatures in degrees C * 1000 +# Default: ( 65000 80000 90000 ) +# +TEMPS=( 20000 40000 50000 65000 75000 80000 ) + +# Temp Fan % +# +# 20 C 40% +# 40 C 40% +# 50 C 50% +# 65 C 70% +# 75 C 80% +# 80 C 100% + +# PWM values corresponding to the defined temperatures. +# 0 will turn the fans off. +# 255 will let them spin at maximum speed. +# Default: ( 0 153 255 ) +# ASRock Taichi 5700 XT only spins fans if PWM is set to 102 or higher +# +PWMS=( 102 102 153 180 205 255 ) + +# Debug mode. +# Enabling this will make amdgpu fancontol much more verbose. +# Default: true +DEBUG=false From 773d1e40725c78cbba5e2f68aafbf3c42fc73fc0 Mon Sep 17 00:00:00 2001 From: frozenMustelid <31948457+frozenMustelid@users.noreply.github.com> Date: Fri, 22 Jan 2021 00:05:28 -0500 Subject: [PATCH 3/5] Update README.md Updated info about this particular fork --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0a36035..7d28301 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,13 @@ # amdgpu-fancontrol -Simple bash script to control AMD Radeon graphics cards fan pwm. Adjust temp/pwm values and hysteresis/interval in the script as desired. Other adjustments, such as the correct hwmon path might be required as well. +Simple bash script to control AMD Radeon graphics cards fan pwm. Adjust temp/pwm values and hysteresis/interval in the script as desired. Other adjustments, such as the correct hwmon path might be required as well. Comes with a systemd service that will start with your PC. This script was initially meant as an example. Please don't just run it naively and keep in mind that I'm not responsible for failures. -## Packages +This fork was modified to work better with an AMD RX 5700 XT. Specifically, the model I use is the ASRock Taichi 5700 XT. It will probably work just fine with other AMD (or possibly even nVidia) cards, but you should check that you a) have a /sys/class/drm/card0/device/hwmon/hwmon0/temp2 sensor, and b) that sensor is the one you want to watch ("junction" or hotspot temp on my card). If you want to watch a sensor other than temp2, it's an easy edit to make to the script. -- Arch Linux (on AUR): https://aur.archlinux.org/packages/amdgpu-fancontrol-git/ +## Fork edits + +This repo was forked from grmat. I've added an install script, edited the config file to better handle cards with forced 0 RPM/ 0dB mode, and changed the sensor being observed from temp1 ("edge"/average die temp on 5700 XT) to temp2 ("junction"/hotspot temp on 5700 XT). Depending on your card, this may not be desirable, or this path may not even exist. + +You can get a list of the temperature sensor labels by running `cat /sys/class/drm/card0/device/hwmon/hwmon0/temp*_label` . The actual sensor files are in the same directory. From 2e3866bf936850b111e9dca8611179cebc28cc2d Mon Sep 17 00:00:00 2001 From: frozenMustelid <31948457+frozenMustelid@users.noreply.github.com> Date: Fri, 22 Jan 2021 00:08:29 -0500 Subject: [PATCH 4/5] Watches temp2 ("junction"/hotspot on 5700 XT) Originally watched temp1 ("edge" or average die temperature), now watches temp2 to more quickly respond to changes. --- amdgpu-fancontrol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/amdgpu-fancontrol b/amdgpu-fancontrol index 723fb9d..66270cc 100755 --- a/amdgpu-fancontrol +++ b/amdgpu-fancontrol @@ -11,9 +11,9 @@ PWMS=( 0 153 255 ) # hwmon paths, hardcoded for one amdgpu card, adjust as needed FILE_PWM=$(echo /sys/class/drm/card0/device/hwmon/hwmon?/pwm1) FILE_FANMODE=$(echo /sys/class/drm/card0/device/hwmon/hwmon?/pwm1_enable) -FILE_TEMP=$(echo /sys/class/drm/card0/device/hwmon/hwmon?/temp1_input) +FILE_TEMP=$(echo /sys/class/drm/card0/device/hwmon/hwmon?/temp2_input) # might want to use this later -#FILE_TEMP_CRIT=$(echo /sys/class/hwmon/hwmon?/temp1_crit_hyst) +#FILE_TEMP_CRIT=$(echo /sys/class/hwmon/hwmon?/temp2_crit_hyst) # load configuration file if present [ -f /etc/amdgpu-fancontrol.cfg ] && . /etc/amdgpu-fancontrol.cfg From f241d0376d2f11f9306d656386854e4b7fc1f81c Mon Sep 17 00:00:00 2001 From: frozenMustelid <31948457+frozenMustelid@users.noreply.github.com> Date: Fri, 22 Jan 2021 00:13:41 -0500 Subject: [PATCH 5/5] Changed file name, deleting file with old name --- etc-amdgpu-fancontrol.cfg | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 etc-amdgpu-fancontrol.cfg diff --git a/etc-amdgpu-fancontrol.cfg b/etc-amdgpu-fancontrol.cfg deleted file mode 100644 index 122afbe..0000000 --- a/etc-amdgpu-fancontrol.cfg +++ /dev/null @@ -1,22 +0,0 @@ -# Configuration file for amdgpu fancontol service - -# Set temperature and corresponding pwm values in ascending order and with the -# same amount of values. A linear interpolation will happen for values in -# between. - -# Temperatures in degrees C * 1000 -# Default: ( 65000 80000 90000 ) -# -#TEMPS=( 65000 80000 90000 ) - -# PWM values corresponding to the defined temperatures. -# 0 will turn the fans off. -# 255 will let them spin at maximum speed. -# Default: ( 0 153 255 ) -# -#PWMS=( 0 153 255 ) - -# Debug mode. -# Enabling this will make amdgpu fancontol much more verbose. -# Default: true -#DEBUG=true