[Defy General] shadowchaos:
Easy set Vsel and instant wakeup for CM11(recent nightly built by Quarx) & TWRP 2.8

Hi，all

Recently,I‘ve upgrade defy to CM11 nightly built that Qurax released everyday.And I'm using cm-11-20160628-NIGHTLY-mb52x.zip such a great rom works almost everything and smooth.

MANY THANKS to Quarx!

The rom is using TWRP 2.8.0.0, so I can't find setting CPU Vsel at boot.After some search,it can be done by adding some scripts to /system/etc/init.d/09overclock .(or using AeroControl )

Also,the rom delays to wakeup up to 3 seconds when you click the power button .

And I tried the same CPU governor & I/O schedul that used with 4.1.2 & 4.3.1,and it worked.These two settings built in the rom setting are sometimes failed to work and back to default, so I added them to script too.

Add these scripts to /system/etc/init.d/09overclock ,remember to leave a blank line at the end and set the same right (555) to the file.

#!/system/bin/sh
#

# Module location
MODULE_DIR="/system/lib/modules"
MODULE="/system/lib/modules/overclock_defy.ko"
SYMSEARCH_MODULE="/system/lib/modules/symsearch.ko"
/system/xbin/insmod $SYMSEARCH_MODULE
/system/xbin/insmod $MODULE_DIR/cpufreq_stats.ko
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_freq_update /proc/kallsyms | sed -e "s/\([0-9A-Fa-f]\{8\}\).*/\1/"`
/system/xbin/insmod $MODULE omap2_clk_init_cpufreq_table_addr=0x$cpufreq_table
echo 0x$stats_update > /proc/overclock/cpufreq_stats_update_addr

# setVsel at boot,BACKUP your ROM first and use it caution with the stable vsel of your phone!
/system/xbin/busybox echo 55 > /proc/overclock/max_vsel
/system/xbin/busybox echo 1000000 > /proc/overclock/max_rate
/system/xbin/busybox echo 1 300000000 25 > /proc/overclock/mpu_opps
/system/xbin/busybox echo 2 600000000 35 > /proc/overclock/mpu_opps
/system/xbin/busybox echo 3 800000000 45 > /proc/overclock/mpu_opps
/system/xbin/busybox echo 4 1000000000 55 > /proc/overclock/mpu_opps
/system/xbin/busybox echo 0 1000000 > /proc/overclock/freq_table
/system/xbin/busybox echo 1 800000 > /proc/overclock/freq_table
/system/xbin/busybox echo 2 600000 > /proc/overclock/freq_table
/system/xbin/busybox echo 3 300000 > /proc/overclock/freq_table

# avoid wakeup delay when your settings fails sometime in /Settings/Performance/Processor & I/O scheduler.

sleep 60

/system/xbin/busybox echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
/system/xbin/busybox echo sio > /sys/block/mmcblk0/queue/scheduler

# Always check /Settings/Performance/Memory management/Allow purging of assets.
# While select ART runtime in Developer options and check Allow purging of assets ,using following minfree to max performance .
# Should put them below sleep 60,use as your choice.

# /system/xbin/busybox echo "0,1,2,4,7,15" > /sys/module/lowmemorykiller/parameters/adj
# /system/xbin/busybox echo "2464,3712,5632,7392,8608,9856" > /sys/module/lowmemorykiller/parameters/minfree

Also,set this to /system/build.prop ,to bring up income call interface much more fast.

ro.telephony.call_ring.delay=0

FYI,

about the last minfree part(other VM sets are ok by default ),I've done some test below.

ALL tested under ART runtime (its bugfree to me and ART is way much better than Dalvik,using Dalvik,browser crashed at 11-12 gifs no matter what ).

1.uncheck Allow purging of assets ,browser crashed loading 7 - 8 gifs picture in the webpage

2.check Allow purging of assets ,browser crashed loading 14 - 15 gifs picture (including the gifs above) in the webpage

3.check Allow purging of assets ,and using the minfree above ,browser crashed up to 24 gifs picture (including the gifs above) in the webpage（browser using nearly 320M ram...）

All behaviors the same delay switching to other apps when browser approaching to crash.

After done above ,there are only left 2 bugs to me

1.the menu & search button remap.(menu button can't be remapped to other function in the launcher ,and search button only works as search )

2.call recording not working (still searching method)