Initial commit
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
# ---------------- CONFIG ----------------
|
||||
# Temperature threshold in millidegrees Celsius
|
||||
# 55000 = 55°C
|
||||
TEMP_THRESHOLD=55000
|
||||
|
||||
# PWM values (0–255)
|
||||
PWM_IDLE=25 # fan speed below threshold
|
||||
PWM_HOT=90 # fan speed above threshold
|
||||
|
||||
# ---------------------------------------
|
||||
|
||||
# Find the AMD card (vendor 0x1002), then its hwmon — no hardcoded cardN.
|
||||
HWMON=""
|
||||
for c in /sys/class/drm/card[0-9]*; do
|
||||
[ "$(cat "$c/device/vendor" 2>/dev/null)" = "0x1002" ] || continue
|
||||
HWMON="$(ls -d "$c"/device/hwmon/hwmon* 2>/dev/null | head -n1)"
|
||||
break
|
||||
done
|
||||
[ -z "$HWMON" ] && exit 0
|
||||
|
||||
TEMP_FILE="$HWMON/temp1_input"
|
||||
PWM_ENABLE="$HWMON/pwm1_enable"
|
||||
PWM_FILE="$HWMON/pwm1"
|
||||
|
||||
# Enable manual fan control (always)
|
||||
echo 1 > "$PWM_ENABLE"
|
||||
|
||||
# Read temperature
|
||||
TEMP="$(cat "$TEMP_FILE")"
|
||||
|
||||
# Decide PWM
|
||||
if [ "$TEMP" -ge "$TEMP_THRESHOLD" ]; then
|
||||
PWM="$PWM_HOT"
|
||||
else
|
||||
PWM="$PWM_IDLE"
|
||||
fi
|
||||
|
||||
# Always write PWM
|
||||
echo "$PWM" > "$PWM_FILE"
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# Force the AMD GPU to "high" performance level.
|
||||
# Pins memory clock to 100% — raises idle draw (~20W) but fixes stuttering.
|
||||
# Run as root (systemd oneshot). Finds the AMD card by vendor id; no hardcoded cardN.
|
||||
for c in /sys/class/drm/card[0-9]*; do
|
||||
[ "$(cat "$c/device/vendor" 2>/dev/null)" = "0x1002" ] || continue
|
||||
echo high > "$c/device/power_dpm_force_performance_level"
|
||||
exit 0
|
||||
done
|
||||
exit 0
|
||||
Reference in New Issue
Block a user