#!/bin/bash
SYSFS=/sys/class/drm/card0/device
H=$SYSFS/hwmon/hwmon1

echo "=== FORCE DPM STATE 2 ==="
echo 2 | sudo tee $SYSFS/pp_dpm_sclk
echo "Result: $?"
echo "---"
cat $SYSFS/pp_dpm_sclk
echo "FREQ: $(cat $H/freq1_input) Hz"

echo "=== TRY profile_peak ==="
echo profile_peak | sudo tee $SYSFS/power_dpm_force_performance_level 2>&1
cat $SYSFS/power_dpm_force_performance_level
cat $SYSFS/pp_dpm_sclk
echo "FREQ: $(cat $H/freq1_input) Hz"

echo "=== TRY high ==="
echo high | sudo tee $SYSFS/power_dpm_force_performance_level 2>&1
cat $SYSFS/power_dpm_force_performance_level
cat $SYSFS/pp_dpm_sclk
echo "FREQ: $(cat $H/freq1_input) Hz"

echo "=== RESET TO AUTO ==="
echo auto | sudo tee $SYSFS/power_dpm_force_performance_level 2>&1
cat $SYSFS/power_dpm_force_performance_level

echo "=== CHECK gpu_metrics (binary) ==="
sudo cat $SYSFS/gpu_metrics | xxd | head -10
