#!/bin/bash # Arch R - Performance Governor (Max) # Sets CPU, GPU, and DMC to maximum performance # Based on dArkOS perfmax for RK3326 gpu="ff400000" DMC_GOV="/sys/devices/platform/dmc/devfreq/dmc/governor" # Make governor files writable chmod 666 /sys/devices/platform/${gpu}.gpu/devfreq/${gpu}.gpu/governor 2>/dev/null chmod 666 /sys/devices/system/cpu/cpufreq/policy0/scaling_governor 2>/dev/null [ -f "$DMC_GOV" ] && chmod 666 "$DMC_GOV" 2>/dev/null if [[ "$1" == "powersave" ]]; then echo "userspace" > /sys/devices/platform/${gpu}.gpu/devfreq/${gpu}.gpu/governor echo "400000000" > /sys/devices/platform/${gpu}.gpu/devfreq/${gpu}.gpu/userspace/set_freq 2>/dev/null echo "userspace" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor echo "1008000" > /sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed 2>/dev/null [ -f "$DMC_GOV" ] && echo "userspace" > "$DMC_GOV" echo "528000000" > /sys/devices/platform/dmc/devfreq/dmc/userspace/set_freq 2>/dev/null elif [[ "$1" == "ondemand" ]]; then echo simple_ondemand > /sys/devices/platform/${gpu}.gpu/devfreq/${gpu}.gpu/governor echo ondemand > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor [ -f "$DMC_GOV" ] && echo dmc_ondemand > "$DMC_GOV" if [ "$(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor)" == "ondemand" ]; then echo 85 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold 2>/dev/null echo 150 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_down_factor 2>/dev/null fi elif [[ -n "$1" ]]; then echo "$1" > /sys/devices/platform/${gpu}.gpu/devfreq/${gpu}.gpu/governor echo "$1" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor [ -f "$DMC_GOV" ] && echo "$1" > "$DMC_GOV" else echo "performance" > /sys/devices/platform/${gpu}.gpu/devfreq/${gpu}.gpu/governor echo "performance" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor [ -f "$DMC_GOV" ] && echo "performance" > "$DMC_GOV" fi