blob: 76705a0bf1793f5a82855937ea976f62b76643b6 (
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# This script try to remove mod in different configurations
echo "try_rmmod : try to remove mod in different configurations"
REINSMOD=1
ANDROID_MOD_PATH=/system/modules
UBUNTU_MOD_PATH=/lib/modules/`uname -r`/kernel/drivers/cpufreq
if [ -d $ANDROID_MOD_PATH ]; then
MOD_LOCATION=$ANDROID_MOD_PATH/arm-bl-cpufreq.ko
CPU_FREQ_KM=`lsmod | busybox grep cpufreq | busybox awk '{print $1}'`
else if [ -d $UBUNTU_MOD_PATH ]; then
MOD_LOCATION=$UBUNTU_MOD_PATH/arm-bl-cpufreq.ko
CPU_FREQ_KM=`lsmod | grep cpufreq | awk '{print $1}'`
else
echo "ERROR: No arm-bl-cpufreq.ko module found"
exit 1
fi
fi
if ! [ -d /sys/devices/system/cpu/cpu0/cpufreq ]; then
insmod $MOD_LOCATION
REINSMOD=0
fi
BIG=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
LITTLE=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
switch_to_big () {
for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed
do echo $BIG > $file
done
# consider cpuinfo_transition_latency before checking
usleep 50000
for file in /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq
do freq=`cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq`
if [ "$freq" -eq "$BIG" ]
then
echo "Switch to big with success"
else
echo ERROR : $freq
exit 1
fi
done
}
switch_to_little () {
for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed
do echo $LITTLE > $file
done
# consider cpuinfo_transition_latency before checking
usleep 50000
for file in /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq
do freq=`cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq`
if [ "$freq" -eq "$LITTLE " ]
then
echo "Switch to big with success"
else
echo ERROR : $freq
exit 1
fi
done
}
switch_to_little
rmmod arm-bl-cpufreq
if lsmod | grep arm_bl_cpufreq > /dev/null
then
echo "ERROR : failed to remove module (little)"
exit 1
fi
insmod $MOD_LOCATION
switch_to_big
rmmod arm-bl-cpufreq
if lsmod | grep arm_bl_cpufreq > /dev/null
then
echo "ERROR : failed to remove module (big)"
exit 1
fi
if [ "$REINSMOD" -eq "1" ]
then
insmod $MOD_LOCATION
fi
echo "SUCCESS!!"
exit 0
|