blob: 12dfc1fcb4b0bd0f21a6e5823348be5c54a647a8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#!/bin/sh
. "${PM_FUNCTIONS}"
[ -d /sys/devices/system/cpu/ ] || exit $NA
hibernate_cpufreq()
{
( cd /sys/devices/system/cpu/
for x in cpu[0-9]*/cpufreq/scaling_governor ; do
[ -f "$x" ] || continue
grep -q "$TEMPORARY_CPUFREQ_GOVERNOR" \
"${x%/*}/scaling_available_governors" || continue
savestate "${x%%/*}_governor" $(cat "$x")
echo "$TEMPORARY_CPUFREQ_GOVERNOR" > "$x"
done )
}
thaw_cpufreq()
{
( cd /sys/devices/system/cpu/
for x in cpu[0-9]*/cpufreq/scaling_governor ; do
[ -f "$x" ] || continue
local gov="$(restorestate "${x%%/*}_governor")"
[ -z "$gov" ] && continue
echo "$gov" > "$x"
done )
}
case "$1" in
suspend|hibernate)
hibernate_cpufreq
;;
resume|thaw)
thaw_cpufreq
;;
*) exit $NA
;;
esac
|