Skip to content

Instantly share code, notes, and snippets.

@KCCat
Last active June 23, 2019 09:52
Show Gist options
  • Save KCCat/b299b0a5a5cc6a2a24c060802ef33927 to your computer and use it in GitHub Desktop.
Save KCCat/b299b0a5a5cc6a2a24c060802ef33927 to your computer and use it in GitHub Desktop.
amdgpu_pwm_dpm_fix first add amdgpu.ppfeaturemask=0xffffffff
#!/bin/bash
enable -f /usr/lib/bash/sleep sleep
#OD_SCLK:
#0: 825mV
#1: 825mV
#2: 825mV
#3: 950mV
#4: 1000mV
#5: 950mV
#6: 1100mV
#7: 1200mV
echo manual > /sys/class/drm/card0/device/power_dpm_force_performance_level
#echo s 0 300 800 > /sys/class/drm/card0/device/pp_od_clk_voltage
#echo m 0 300 800 > /sys/class/drm/card0/device/pp_od_clk_voltage
#echo c > /sys/class/drm/card0/device/pp_od_clk_voltage
#echo r > /sys/class/drm/card0/device/pp_od_clk_voltage
echo s 1 440 830 > /sys/class/drm/card0/device/pp_od_clk_voltage
echo s 2 580 850 > /sys/class/drm/card0/device/pp_od_clk_voltage
echo s 3 720 870 > /sys/class/drm/card0/device/pp_od_clk_voltage
echo s 4 860 890 > /sys/class/drm/card0/device/pp_od_clk_voltage
echo s 5 1000 910 > /sys/class/drm/card0/device/pp_od_clk_voltage
echo s 6 1150 930 > /sys/class/drm/card0/device/pp_od_clk_voltage
echo s 7 1280 950 > /sys/class/drm/card0/device/pp_od_clk_voltage
echo c > /sys/class/drm/card0/device/pp_od_clk_voltage
echo 5 1 10 100 50 1 10 100 20 > /sys/class/drm/card0/device/pp_power_profile_mode
echo -n 1 > /sys/class/drm/card0/device/hwmon/hwmon0/pwm1_enable 2> /dev/null
pwm=64
step=4
while true
do
old_pwm=$pwm
temp=`cat /sys/class/drm/card0/device/hwmon/hwmon0/temp1_input`
if [ $temp -lt 45000 ]
then
pwm=0
elif [ $temp -lt 55000 ]
then
((pwm-=step))
pwm=$((pwm<64?64:pwm))
elif [ $temp -gt 60000 ] && [ $pwm -lt 112 ]
then
pwm=$((pwm<64?64:pwm))
((pwm+=step))
pwm=$((pwm>112?112:pwm))
elif [ $temp -lt 70000 ] && [ $pwm -gt 112 ]
then
((pwm-=step))
pwm=$((pwm<112?112:pwm))
elif [ $temp -gt 75000 ]
then
((pwm+=step))
pwm=$((pwm>160?160:pwm))
fi
if [ $old_pwm -ne $pwm ]
then
echo -n $pwm > /sys/class/drm/card0/device/hwmon/hwmon0/pwm1 2> /dev/null
echo "amdgpu:pwm = " $pwm
fi
sleep 2
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment