Skip to content

Commit

Permalink
overclock: boosted v2 governor and sio sched implementation
Browse files Browse the repository at this point in the history
(cpufreq governor based on smartass v2)

Add sources and module compiled from sources
Fix cpu sysfs owner to allow toggle from Android Settings

Fixed sysfs write operations and renamed to cpufreq_boosted

Change-Id: If5bc6ae696b945de08e0e21dd0c781653e8e771d
  • Loading branch information
tpruvot committed May 24, 2012
1 parent b5aa750 commit eaecf57
Show file tree
Hide file tree
Showing 18 changed files with 1,417 additions and 38 deletions.
15 changes: 15 additions & 0 deletions bootmenu/config/overclock.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ scaling 2
clk1 300
clk2 600
clk3 1000
clk4 1000
vsel1 30
vsel2 46
vsel3 58
vsel4 58
con_up_threshold 80
con_down_threshold 20
con_freq_step 5
Expand All @@ -21,3 +23,16 @@ smt_sleep_max_freq 300000
smt_up_min_freq 1000000
smt_wakeup_freq 1000000
smt_ramp_up_step 250000
bst_awake_ideal_freq 800000
bst_debug_mask 0
bst_down_rate_us 97000
bst_max_cpu_load 70
bst_min_cpu_load 40
bst_ramp_down_step 160000
bst_ramp_up_step 160000
bst_sample_rate_jiffies 2
bst_sleep_ideal_freq 300000
bst_sleep_wakeup_freq 300000
bst_up_rate_us 52000
iosched_sio 0

95 changes: 93 additions & 2 deletions bootmenu/script/overclock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ ASKED_MODE=$1
# clk1 300
# clk2 600
# clk3 1000
# clk4 1000
# vsel1 30
# vsel2 46
# vsel3 58
# vsel4 58
# con_up_threshold 80
# con_down_threshold 20
# con_freq_step 5
Expand All @@ -37,6 +39,18 @@ ASKED_MODE=$1
# smt_up_min_freq 1000000
# smt_wakeup_freq 1000000
# smt_ramp_up_step 250000
# bst_awake_ideal_freq 800000
# bst_down_rate_us 97000
# bst_max_cpu_load 70
# bst_min_cpu_load 40
# bst_ramp_down_step 160000
# bst_ramp_up_step 160000
# bst_sample_rate_jiffies 2
# bst_sleep_ideal_freq 300000
# bst_sleep_wakeup_freq 300000
# bst_up_rate_us 52000
# bst_debug_mask 0
# iosched_sio 0

param_load()
{
Expand All @@ -47,6 +61,7 @@ param_load()

param_safe()
{
echo "cpufreq: ondemand safe"
# for bootmenu operations
# enable ondemand profile
# which is in kernel
Expand All @@ -72,7 +87,7 @@ param_safe()
get_address()
{
cpufreq_table=`grep -e omap2_clk_init_cpufreq_table /proc/kallsyms | sed -e "s/\([0-9A-Fa-f]\{8\}\).*/\1/"`
stats_update=`grep -e cpufreq_stats_update /proc/kallsyms | sed -e "s/\([0-9A-Fa-f]\{8\}\).*/\1/"`
stats_update=`grep -e cpufreq_stats_update$ /proc/kallsyms | sed -e "s/\([0-9A-Fa-f]\{8\}\).*/\1/"`
}

#############################################################
Expand All @@ -93,7 +108,10 @@ install_module()
insmod $MODULE_DIR/cpufreq_stats.ko
insmod $MODULE_DIR/cpufreq_interactive.ko
insmod $MODULE_DIR/cpufreq_smartass.ko
insmod $MODULE_DIR/cpufreq_boosted.ko
fi
busybox chown -R system /sys/devices/system/cpu
busybox chown -R system /sys/class/block/mmc*/queue
}

#############################################################
Expand Down Expand Up @@ -138,6 +156,26 @@ set_scaling()
echo "powersave" > $SCALING_GOVERNOR
;;
"5" )
if [ "$load_all" -eq "0" ]; then
insmod $MODULE_DIR/symsearch.ko
insmod $MODULE_DIR/clockfix.ko
insmod $MODULE_DIR/cpufreq_boosted.ko
fi

echo boosted > $SCALING_GOVERNOR
echo $bst_debug_mask > /sys/devices/system/cpu/cpufreq/boosted/debug_mask
echo $bst_awake_ideal_freq > /sys/devices/system/cpu/cpufreq/boosted/awake_ideal_freq
echo $bst_down_rate_us > /sys/devices/system/cpu/cpufreq/boosted/down_rate_us
echo $bst_max_cpu_load > /sys/devices/system/cpu/cpufreq/boosted/max_cpu_load
echo $bst_min_cpu_load > /sys/devices/system/cpu/cpufreq/boosted/min_cpu_load
echo $bst_ramp_down_step > /sys/devices/system/cpu/cpufreq/boosted/ramp_down_step
echo $bst_ramp_up_step > /sys/devices/system/cpu/cpufreq/boosted/ramp_up_step
echo $bst_sample_rate_jiffies > /sys/devices/system/cpu/cpufreq/boosted/sample_rate_jiffies
echo $bst_sleep_ideal_freq > /sys/devices/system/cpu/cpufreq/boosted/sleep_ideal_freq
echo $bst_sleep_wakeup_freq > /sys/devices/system/cpu/cpufreq/boosted/sleep_wakeup_freq
echo $bst_up_rate_us > /sys/devices/system/cpu/cpufreq/boosted/up_rate_us
;;
"6" )
if [ $load_all -eq 0 ]; then
insmod $MODULE_DIR/symsearch.ko
insmod $MODULE_DIR/clockfix.ko
Expand All @@ -152,7 +190,7 @@ set_scaling()
echo $smt_wakeup_freq > /sys/devices/system/cpu/cpu0/cpufreq/smartass/sleep_wakeup_freq
echo $smt_ramp_up_step > /sys/devices/system/cpu/cpu0/cpufreq/smartass/ramp_up_step
;;
"6" )
"7" )
if [ $load_all -eq 0 ]; then
insmod $MODULE_DIR/cpufreq_userspace.ko
fi
Expand All @@ -163,17 +201,61 @@ set_scaling()
esac
}

#############################################################
# Alternative I/O Schedulers
#
# Default linux I/O Schedulers are optimized for Hard disks
# The alternative ones are optimized for flash disks
#############################################################

set_ioscheduler()
{
iosched="cfq"
if [ "$iosched_sio" -eq "1" ]; then
iosched="sio"
fi

# options: 'noop cfq sio'
case "$iosched" in
"cfq" )
;;
"sio" )
insmod $MODULE_DIR/sio_iosched.ko
for i in /sys/block/mmc*/queue; do
[ -f "$i/scheduler" ] && echo $iosched > $i/scheduler

[ -f "$i/iosched/low_latency" ] && echo 1 > $i/iosched/low_latency
[ -f "$i/iosched/back_seek_penalty" ] && echo 1 > $i/iosched/back_seek_penalty
[ -f "$i/iosched/back_seek_max" ] && echo 1000000000 > $i/iosched/back_seek_max
[ -f "$i/iosched/slice_idle" ] && echo 0 > $i/iosched/slice_idle
[ -f "$i/iosched/fifo_batch" ] && echo 1 > $i/iosched/fifo_batch
[ -f "$i/iosched/quantum" ] && echo 16 > $i/iosched/quantum
[ -f "$i/nr_requests" ] && echo 512 > $i/nr_requests

[ -f "$i/rotational" ] && [ "`cat $i/rotational`" -ne "0" ] && echo 0 > $i/rotational
[ -f "$i/iostats" ] && [ "`cat $i/iostats`" -ne "0" ] && echo 0 > $i/iostats
done
;;
* )
;;
esac
}

#############################################################
# Set Clock Table
#############################################################

set_overclock_table()
{
# echo "$vsel4" > /proc/overclock/max_vsel
echo "$vsel3" > /proc/overclock/max_vsel
# echo "${clk4}000" > /proc/overclock/max_rate
echo "${clk3}000" > /proc/overclock/max_rate
# echo "4 ${clk4}000000 $vsel4" > /proc/overclock/mpu_opps
echo "3 ${clk3}000000 $vsel3" > /proc/overclock/mpu_opps
echo "2 ${clk2}000000 $vsel2" > /proc/overclock/mpu_opps
echo "1 ${clk1}000000 $vsel1" > /proc/overclock/mpu_opps
# echo "0 ${clk4}000" > /proc/overclock/freq_table
echo "0 ${clk3}000" > /proc/overclock/freq_table
echo "1 ${clk2}000" > /proc/overclock/freq_table
echo "2 ${clk1}000" > /proc/overclock/freq_table
Expand All @@ -194,9 +276,18 @@ else
fi

if [ $enable -eq 1 ]; then

get_address
install_module

echo "set scaling..."
set_scaling
echo "set overclock table..."
set_overclock_table
echo "set ioscheduler..."
set_ioscheduler

busybox chown -R system /sys/devices/system/cpu

fi

3 changes: 3 additions & 0 deletions modules/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ obj-m += clockfix/
obj-m += logcap/
obj-m += usbled/

# mb525/mb526 specific
obj-m += proximity/


PWD := $(shell pwd)

Expand Down
Binary file added modules/cpufreq_boosted.ko
Binary file not shown.
Binary file modified modules/cpufreq_conservative.ko
Binary file not shown.
Binary file modified modules/cpufreq_interactive.ko
Binary file not shown.
Binary file modified modules/cpufreq_powersave.ko
Binary file not shown.
Binary file modified modules/cpufreq_smartass.ko
Binary file not shown.
Binary file modified modules/cpufreq_stats.ko
Binary file not shown.
3 changes: 3 additions & 0 deletions modules/modules.dep
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,8 @@ overclock_defy.ko:
cpufreq_stats.ko:
cpufreq_smartass.ko: symsearch.ko
cpufreq_interactive.ko: symsearch.ko cpufreq_stats.ko
cpufreq_boosted.ko: symsearch.ko
cpufreq_conservative.ko:
sio_iosched.ko:
xt_multiport.ko:

4 changes: 2 additions & 2 deletions modules/overclock/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ menu "Defy Overclock"
config CPUFREQ_OVERCLOCK
bool "overclock"
default y
config CPUFREQ_GOV_SMARTASS
bool "smartass"
config CPUFREQ_GOV_BOOSTED
bool "smartass2 boosted variant"
default y
config CPUFREQ_GOV_INTERACTIVE
bool "interactive"
Expand Down
9 changes: 7 additions & 2 deletions modules/overclock/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#Module
# Modules

obj-m += cpufreq_conservative.o cpufreq_interactive.o cpufreq_smartass.o cpufreq_stats.o cpufreq_powersave.o
obj-m += cpufreq_conservative.o cpufreq_interactive.o cpufreq_powersave.o
obj-m += cpufreq_stats.o
obj-m += cpufreq_smartass.o cpufreq_boosted.o

sio_iosched-objs = sio-iosched.o
obj-m += sio_iosched.o

Loading

0 comments on commit eaecf57

Please sign in to comment.