diff options
-rwxr-xr-x | pm/functions | 2 | ||||
-rwxr-xr-x | pm/sleep.d/94cpufreq | 44 |
2 files changed, 17 insertions, 29 deletions
diff --git a/pm/functions b/pm/functions index 805b26c..439d255 100755 --- a/pm/functions +++ b/pm/functions @@ -15,7 +15,7 @@ HIBERNATE_RESUME_POST_VIDEO=no INHIBIT=/var/run/pm-utils.inhibit PM_LOGFILE=${PM_LOGFILE:=/var/log/pm-suspend.log} SUSPEND_MODULES="" -TEMPORARY_CPUFREQ_GOVERNOR="userspace" +TEMPORARY_CPUFREQ_GOVERNOR="performance" LOCKDIR="/tmp/.suspended" # Use c sort order diff --git a/pm/sleep.d/94cpufreq b/pm/sleep.d/94cpufreq index 56648b0..0c03400 100755 --- a/pm/sleep.d/94cpufreq +++ b/pm/sleep.d/94cpufreq @@ -4,38 +4,26 @@ hibernate_cpufreq() { - [ -d /sys/devices/system/cpu/ ] || return 0 - pushd /sys/devices/system/cpu/ >/dev/null 2>&1 - for x in $(ls -1) ; do - [ -d $x/cpufreq ] || continue - [ -f $x/cpufreq/scaling_governor ] || continue - - savestate ${x}_governor $(cat $x/cpufreq/scaling_governor) - done - for x in $(ls -1) ; do - [ -d $x/cpufreq ] || continue - [ -f $x/cpufreq/scaling_governor ] || continue - - gov="$TEMPORARY_CPUFREQ_GOVERNOR" - grep -q "$GOVERNOR" $x/cpufreq/scaling_available_governors \ - || gov="userspace" - sh -c "echo \"$gov\" > $x/cpufreq/scaling_governor" - done - popd >/dev/null 2>&1 + [ -d /sys/devices/system/cpu/ ] || return 1 + ( cd /sys/devices/system/cpu/ + for x in cpu[0-9]* ; do + [ -f "$x/cpufreq/scaling_governor" ] || continue + grep -q "$TEMPORARY_CPUFREQ_GOVERNOR" \ + "$x/cpufreq/scaling_available_governors" || continue + savestate "${x}_governor" $(cat "$x/cpufreq/scaling_governor") + echo "$TEMPORARY_CPUFREQ_GOVERNOR" > \ + "$x/cpufreq/scaling_governor" + done ) } thaw_cpufreq() { - x=0 - while :; do - gov=$(restorestate $(echo cpu${x}_governor)) - [ -z "$gov" ] && break - - sh -c "echo \"$gov\" > /sys/devices/system/cpu/cpu$x/cpufreq/scaling_governor" - unset gov - x=$(($x + 1)) - done - unset x + ( cd /sys/devices/system/cpu/ + for x in cpu[0-9]* ; do + local gov=$(restorestate "${x}_governor") + [ -z "$gov" ] || continue + echo "$gov" > "$x/cpufreq/scaling_governor" + done ) } case "$1" in |