Skip to content
This repository has been archived by the owner on Apr 7, 2021. It is now read-only.

Add install script #32

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 2 additions & 2 deletions amdgpu-fancontrol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 15 additions & 3 deletions etc-amdgpu-fancontrol.cfg → amdgpu-fancontrol.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,31 @@
# 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=( 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=( 0 153 255 )
PWMS=( 102 102 153 180 205 255 )

# Debug mode.
# Enabling this will make amdgpu fancontol much more verbose.
# Default: true
#DEBUG=true
DEBUG=false
18 changes: 18 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -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"