I was perusing the internets and found a init.d script to change governors based on screen state and I thought "Maybe I can take this one step further."
I originally made it just for a new Bionic Blurry JB update, but then figured I should share it with all of you!
*This script will only set CPU frequencies if Tweakerz OC Modules are installed*
*This script is currently set up with Stock Bionic frequencies.*
What does the script do?
It automatically changes the governor, scheduler, and CPU frequencies based on screen state, current battery level, and battery state. It originally had a CPU slot # check, but the razr doesnt have that problem so I removed it.
How does it work?
Note: There is a 10 second timer when the screen turns off. If turned back on within 10 seconds, it will not apply the screen off frequencies.Infinite While Loop
Battery Discharging
Battery percentage greater than 15%
Screen On
Set CPU Frequencies to (300,600,800,1000,1200)
Set Governor to HotplugX
Set Scheduler to Noop
Screen Off
Set CPU Frequencies to (300,350,450,525,600)
Set Governor to PegasusQ
Set Scheduler to SIO
Battery percentage less than or equal to 15%
Screen On
Set CPU Frequencies to (300,450,600,800,1000)
Set Governor to PegasusQ
Set Scheduler to SIO
Screen Off
Set CPU Frequencies to (300,350,450,525,600)
Set Governor to PegasusQ
Set Scheduler to SIO
Battery Charging
Screen On
Set CPU Frequencies to (300,600,800,1000,1200)
Set Governor to HotplugX
Set Scheduler to Noop
Screen Off
Set CPU Frequencies to (300,350,450,525,600)
Set Governor to PegasusQ
Set Scheduler to SIO
End Infinite While Loop
*Its purposely set up to underclock the phone when less than 15% to save battery life till you can get to a charger. Obviously this can be changed with some simple editing.*
What if I dont have the Tweakerz OC Modules Installed?
Dont fret, it will still work. Instead of having 300, 350, 450, 525, and 600Mhz as available frequencies when locked, itll only have 300 and 600Mhz when locked. It wont save as much battery, but itll save more than not having it.
Infinite While Loop... Isnt that bad for the CPU?
Traditionally yes, but this doesnt work like a traditional while loop. Thats because of the way /sys/power/wait_for_fb_wake and /sys/power/wait_for_fb_sleep work. Instead of just checking for the screen state, these files actually pause the script until that screen state is true. Basically, the script sets the awake profile then pauses until the screen turns off. Then it tries to apply the sleep profile. If the sleep profile is applied successfully, it pauses the script until the screen turns back on. Then the process repeats.
Customization:
I tried to set the script up so its fairly easy to understand and customize to your needs. Remember to change the governor, scheduler, and CPU frequencies to match your needs.
Installation:
I would include a link to the tweakerz modules but it wont let me post URLs with under 10 posts
Download the script from below and place it in /system/etc/init.d on your phone and set permissions to 0755 and owner:group to 0:2000. Reboot, and enjoy!
Download:
Attachment at bottom of post
Script Code:
Code:
#!/system/bin/sh
#Custom CPU Profiles
#By MarkusMcNugen
##################################################################################
####################Load Tweakerz Modules and Set Permissions#####################
##################################################################################
# Load Modules
insmod /system/lib/modules/symsearch.ko
insmod /system/lib/modules/cpu_control.ko
insmod /system/lib/modules/sio-iosched.ko
insmod /system/lib/modules/cpufreq_interactiveX.ko
insmod /system/lib/modules/cpufreq_smartass2.ko
insmod /system/lib/modules/cpufreq_pegasusq.ko
insmod /system/lib/modules/cpufreq_boostedASS2.ko
insmod /system/lib/modules/cpufreq_hotplugX.ko
#Scheduler Permissions
chmod 777 /sys/block/mmcblk0/queue/scheduler
chmod 777 /sys/block/mmcblk1/queue/scheduler
##################################################################################
################################Start of options##################################
##################################################################################
###################AWAKE GOVERNORS####################
#AWAKE_GOVERNOR="boostedASSv2"
#AWAKE_GOVERNOR="ondemand"
AWAKE_GOVERNOR="hotplugx"
#AWAKE_GOVERNOR="interactive"
#AWAKE_GOVERNOR="interactiveX"
#AWAKE_GOVERNOR="performance"
#AWAKE_GOVERNOR="smartassV2"
#AWAKE_GOVERNOR="pegasusq"
#AWAKE_GOVERNOR="hotplug"
###################AWAKE SCHEDULERS###################
AWAKE_SCHEDULER="noop"
#AWAKE_SCHEDULER="deadline"
#AWAKE_SCHEDULER="cfq"
#AWAKE_SCHEDULER="sio"
###################SLEEP GOVERNORS####################
#SLEEP_GOVERNOR="boostedASSv2"
SLEEP_GOVERNOR="pegasusq"
#SLEEP_GOVERNOR="ondemand"
#SLEEP_GOVERNOR="hotplugx"
#SLEEP_GOVERNOR="interactive"
#SLEEP_GOVERNOR="interactiveX"
#SLEEP_GOVERNOR="hotplug"
#SLEEP_GOVERNOR="smartassV2"
#SLEEP_GOVERNOR="performance"
#SLEEP_GOVERNOR="userspace"
###################SLEEP SCHEDULERS####################
#SLEEP_SCHEDULER="noop"
#SLEEP_SCHEDULER="deadline"
#SLEEP_SCHEDULER="cfq"
SLEEP_SCHEDULER="sio"
###################BATTERY LIMIT####################
BATTERY_LIMIT="15"
##################PAUSE VARIABLES###################
SCREEN_PAUSE=11
ALREADY_AWAKE=0
ALREADY_SLEEP=0
##################################################################################
#################################End of options###################################
##################################################################################
#Infinite while loop to make sure correct governor, scheduler, and frequencies always applied
while [ 1 ]
do
#Read the current battery status
BATTERY_STATE=`cat /sys/class/power_supply/battery/status`
##################################################################################
#####Function to set scheduler, governor, and frequencies based on variables######
##################################################################################
set_cpu_freq() {
if [ $BATTERY_STATE = "Discharging" ]; then
#Read the current battery percentage
BATTERY=`cat /sys/class/power_supply/battery/capacity`
####If current battery percentage greater then BATTERY_LIMIT apply awake and sleep profiles####
if [ $BATTERY -gt $BATTERY_LIMIT ]; then
if [ $ALREADY_AWAKE = 0 ]; then
AWAKE=`cat /sys/power/wait_for_fb_wake`
if [ $AWAKE = "awake" ]; then
awake_overblimit_freq
fi;
AWAKE=;
elif [ $ALREADY_SLEEP = 0 ]; then
SLEEPING=`cat /sys/power/wait_for_fb_sleep`
if [ $SLEEPING = "sleeping" ]; then
sleep_loop
fi;
SLEEP=;
fi;
####If current battery percentage less than or equal BATTERY_LIMIT apply awake and sleep profiles####
elif [ $BATTERY -le $BATTERY_LIMIT ]; then
if [ $ALREADY_AWAKE = 0 ]; then
AWAKE=`cat /sys/power/wait_for_fb_wake`
if [ $AWAKE = "awake" ]; then
awake_underblimit_freq
ALREADY_AWAKE=1
ALREADY_SLEEP=0
fi;
AWAKE=;
elif [ $ALREADY_SLEEP = 0 ]; then
SLEEPING=`cat /sys/power/wait_for_fb_sleep`
if [ $SLEEPING = "sleeping" ]; then
sleep_loop
fi;
SLEEP=;
fi;
fi;
##################################################
####If battery is charging then apply profiles####
##################################################
elif [ $BATTERY_STATE = "Charging" ]; then
if [ $ALREADY_AWAKE = 0 ]; then
AWAKE=`cat /sys/power/wait_for_fb_wake`
if [ $AWAKE = "awake" ]; then
awake_charge_freq
ALREADY_AWAKE=1
ALREADY_SLEEP=0
fi;
AWAKE=;
elif [ $ALREADY_SLEEP = 0 ]; then
SLEEPING=`cat /sys/power/wait_for_fb_sleep`
if [ $SLEEPING = "sleeping" ]; then
sleep_loop
fi;
SLEEP=;
fi;
BATTERY=;
fi;
}
##################################################################################
###############Function to Set Awake and Over Battery Limit Profile###############
##################################################################################
awake_overblimit_freq() {
###################AWAKE CPU FREQUENCY###################
echo 0 300 1025 > /proc/cpu_control/tweak_cpu
echo 1 600 1200 > /proc/cpu_control/tweak_cpu
echo 2 800 1325 > /proc/cpu_control/tweak_cpu
echo 3 1000 1388 > /proc/cpu_control/tweak_cpu
echo 4 1200 1398 > /proc/cpu_control/tweak_cpu
###################AWAKE CPU GOVERNOR####################
echo $AWAKE_GOVERNOR > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
###################AWAKE CPU SCHEDULER###################
echo $AWAKE_SCHEDULER > /sys/block/mmcblk0/queue/scheduler
echo $AWAKE_SCHEDULER > /sys/block/mmcblk1/queue/scheduler
#####################GOVERNOR TWEAKS#####################
if [ -e /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold ]; then
echo "95" > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold;
echo "1" > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/io_is_busy;
echo "1" > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_down_factor;
echo "10000" > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate;
elif [ -e /sys/devices/system/cpu/cpu1/cpufreq/ondemand/up_threshold ]; then
echo "95" > /sys/devices/system/cpu/cpu1/cpufreq/ondemand/up_threshold;
echo "1" > /sys/devices/system/cpu/cpu1/cpufreq/ondemand/io_is_busy;
echo "1" > /sys/devices/system/cpu/cpu1/cpufreq/ondemand/sampling_down_factor;
echo "10000" > /sys/devices/system/cpu/cpu1/cpufreq/ondemand/sampling_rate;
elif [ -e /sys/devices/system/cpu/cpufreq/ondemand/up_threshold ]; then
echo "95" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold;
echo "1" > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy;
echo "1" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor;
echo "10000" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate;
fi;
ALREADY_AWAKE=1
ALREADY_SLEEP=0
}
awake_underblimit_freq() {
###################AWAKE CPU FREQUENCY###################
echo 0 300 1025 > /proc/cpu_control/tweak_cpu
echo 1 450 1150 > /proc/cpu_control/tweak_cpu
echo 2 600 1200 > /proc/cpu_control/tweak_cpu
echo 3 800 1325 > /proc/cpu_control/tweak_cpu
echo 4 1000 1388 > /proc/cpu_control/tweak_cpu
###################AWAKE CPU GOVERNOR####################
echo $SLEEP_GOVERNOR > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
###################AWAKE CPU SCHEDULER###################
echo $SLEEP_SCHEDULER > /sys/block/mmcblk0/queue/scheduler
echo $SLEEP_SCHEDULER > /sys/block/mmcblk1/queue/scheduler
#####################GOVERNOR TWEAKS#####################
if [ -e /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/up_threshold ]; then
echo "85" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/up_threshold;
echo "10" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/down_differential;
echo "1" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/io_is_busy;
echo "1" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/sampling_down_factor;
echo "20000" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/sampling_rate;
echo "100" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/freq_step;
echo "5" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/cpu_up_rate;
echo "20" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/cpu_down_rate;
echo "100000" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/freq_for_responsiveness;
elif [ -e /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/up_threshold ]; then
echo "85" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/up_threshold;
echo "10" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/down_differential;
echo "1" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/io_is_busy;
echo "1" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/sampling_down_factor;
echo "20000" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/sampling_rate;
echo "100" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/freq_step;
echo "5" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/cpu_up_rate;
echo "20" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/cpu_down_rate;
echo "100000" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/freq_for_responsiveness;
elif [ -e /sys/devices/system/cpu/cpufreq/pegasusq/up_threshold ]; then
echo "85" > /sys/devices/system/cpu/cpufreq/pegasusq/up_threshold;
echo "10" > /sys/devices/system/cpu/cpufreq/pegasusq/down_differential;
echo "1" > /sys/devices/system/cpu/cpufreq/pegasusq/io_is_busy;
echo "1" > /sys/devices/system/cpu/cpufreq/pegasusq/sampling_down_factor;
echo "20000" > /sys/devices/system/cpu/cpufreq/pegasusq/sampling_rate;
echo "100" > /sys/devices/system/cpu/cpufreq/pegasusq/freq_step;
echo "5" > /sys/devices/system/cpu/cpufreq/pegasusq/cpu_up_rate;
echo "20" > /sys/devices/system/cpu/cpufreq/pegasusq/cpu_down_rate;
echo "100000" > /sys/devices/system/cpu/cpufreq/pegasusq/freq_for_responsiveness;
fi;
ALREADY_AWAKE=1
ALREADY_SLEEP=0
}
awake_charge_freq() {
###################AWAKE CPU FREQUENCY###################
echo 0 300 1025 > /proc/cpu_control/tweak_cpu
echo 1 600 1200 > /proc/cpu_control/tweak_cpu
echo 2 800 1325 > /proc/cpu_control/tweak_cpu
echo 3 1000 1388 > /proc/cpu_control/tweak_cpu
echo 4 1200 1398 > /proc/cpu_control/tweak_cpu
###################AWAKE CPU GOVERNOR####################
echo $AWAKE_GOVERNOR > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
###################AWAKE CPU SCHEDULER###################
echo $AWAKE_SCHEDULER > /sys/block/mmcblk0/queue/scheduler
echo $AWAKE_SCHEDULER > /sys/block/mmcblk1/queue/scheduler
#####################GOVERNOR TWEAKS#####################
if [ -e /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/up_threshold ]; then
echo "85" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/up_threshold;
echo "10" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/down_differential;
echo "1" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/io_is_busy;
echo "1" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/sampling_down_factor;
echo "20000" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/sampling_rate;
echo "100" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/freq_step;
echo "5" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/cpu_up_rate;
echo "20" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/cpu_down_rate;
echo "100000" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/freq_for_responsiveness;
elif [ -e /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/up_threshold ]; then
echo "85" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/up_threshold;
echo "10" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/down_differential;
echo "1" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/io_is_busy;
echo "1" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/sampling_down_factor;
echo "20000" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/sampling_rate;
echo "100" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/freq_step;
echo "5" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/cpu_up_rate;
echo "20" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/cpu_down_rate;
echo "100000" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/freq_for_responsiveness;
elif [ -e /sys/devices/system/cpu/cpufreq/pegasusq/up_threshold ]; then
echo "85" > /sys/devices/system/cpu/cpufreq/pegasusq/up_threshold;
echo "10" > /sys/devices/system/cpu/cpufreq/pegasusq/down_differential;
echo "1" > /sys/devices/system/cpu/cpufreq/pegasusq/io_is_busy;
echo "1" > /sys/devices/system/cpu/cpufreq/pegasusq/sampling_down_factor;
echo "20000" > /sys/devices/system/cpu/cpufreq/pegasusq/sampling_rate;
echo "100" > /sys/devices/system/cpu/cpufreq/pegasusq/freq_step;
echo "5" > /sys/devices/system/cpu/cpufreq/pegasusq/cpu_up_rate;
echo "20" > /sys/devices/system/cpu/cpufreq/pegasusq/cpu_down_rate;
echo "100000" > /sys/devices/system/cpu/cpufreq/pegasusq/freq_for_responsiveness;
fi;
ALREADY_AWAKE=1
ALREADY_SLEEP=0
}
##################################################################################
###################Function to Initiate the 10 Second Sleep Timer#################
##################################################################################
sleep_loop() {
SEC_COUNT=0
while [ $SEC_COUNT -lt 10 ]
do
sleep 1
SEC_COUNT=$((SEC_COUNT+1))
####Write dumpsys of window policy to /data/governordumpsys####
dumpsys window policy > /data/governordumpsys
grep -q "mScreenOnFully=true" /data/governordumpsys
SCREEN=$?
####If /data/governordumpsys returns Screen On reset set_cpu_freq function and break counter####
if [ $SCREEN -eq "0" ]; then
ALREADY_AWAKE=0
ALREADY_SLEEP=0
set_cpu_freq
SCREEN=;
break
fi;
done
##################################################################################
###########################Function to Set Sleep Profile##########################
##################################################################################
sleep_set_freq() {
###################SLEEP CPU FREQUENCY###################
echo 0 300 1025 > /proc/cpu_control/tweak_cpu
echo 1 350 1087 > /proc/cpu_control/tweak_cpu
echo 2 450 1150 > /proc/cpu_control/tweak_cpu
echo 3 525 1187 > /proc/cpu_control/tweak_cpu
echo 4 600 1200 > /proc/cpu_control/tweak_cpu
###################SLEEP CPU GOVERNOR####################
echo $SLEEP_GOVERNOR > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
###################SLEEP CPU SCHEDULER###################
echo $SLEEP_SCHEDULER > /sys/block/mmcblk0/queue/scheduler
echo $SLEEP_SCHEDULER > /sys/block/mmcblk1/queue/scheduler
#####################GOVERNOR TWEAKS#####################
if [ -e /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/up_threshold ]; then
echo "85" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/up_threshold;
echo "10" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/down_differential;
echo "1" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/io_is_busy;
echo "1" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/sampling_down_factor;
echo "20000" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/sampling_rate;
echo "100" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/freq_step;
echo "5" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/cpu_up_rate;
echo "20" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/cpu_down_rate;
echo "100000" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/freq_for_responsiveness;
elif [ -e /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/up_threshold ]; then
echo "85" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/up_threshold;
echo "10" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/down_differential;
echo "1" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/io_is_busy;
echo "1" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/sampling_down_factor;
echo "20000" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/sampling_rate;
echo "100" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/freq_step;
echo "5" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/cpu_up_rate;
echo "20" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/cpu_down_rate;
echo "100000" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/freq_for_responsiveness;
elif [ -e /sys/devices/system/cpu/cpufreq/pegasusq/up_threshold ]; then
echo "85" > /sys/devices/system/cpu/cpufreq/pegasusq/up_threshold;
echo "10" > /sys/devices/system/cpu/cpufreq/pegasusq/down_differential;
echo "1" > /sys/devices/system/cpu/cpufreq/pegasusq/io_is_busy;
echo "1" > /sys/devices/system/cpu/cpufreq/pegasusq/sampling_down_factor;
echo "20000" > /sys/devices/system/cpu/cpufreq/pegasusq/sampling_rate;
echo "100" > /sys/devices/system/cpu/cpufreq/pegasusq/freq_step;
echo "5" > /sys/devices/system/cpu/cpufreq/pegasusq/cpu_up_rate;
echo "20" > /sys/devices/system/cpu/cpufreq/pegasusq/cpu_down_rate;
echo "100000" > /sys/devices/system/cpu/cpufreq/pegasusq/freq_for_responsiveness;
fi;
}
####Write dumpsys of window policy to /data/governordumpsys again####
dumpsys window policy > /data/governordumpsys
grep -q "mScreenOnFully=true" /data/governordumpsys
SCREEN=$?
####If /data/governordumpsys returns Screen Off start sleep_set_freq function####
if [ $SCREEN -eq "1" ]; then
sleep_set_freq
ALREADY_AWAKE=0
ALREADY_SLEEP=1
fi;
SCREEN=;
}
#####################Call set_cpu_freq Function#####################
set_cpu_freq
BATTERY_STATE=;
done
awesome work.thanks
Related
Code:
#!/system/bin/sh
AWAKE_CORE_STATUS="on";
SLEEP_CORE_STATUS="off";
AWAKE_GOVERNOR="pegasusq";
SLEEP_GOVERNOR="lulzactive";
(while [ 1 ];
do
AWAKE=`cat /sys/power/wait_for_fb_wake`;
if [ $AWAKE = "awake" ]; then
sleep 2 && {
echo $AWAKE_GOVERNOR > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor;
echo $AWAKE_CORE_STATUS > /sys/devices/virtual/misc/second_core/hotplug_on;
}
# ==============================================================
# Pegasusq
# ==============================================================
if [ -e /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/up_threshold ]; then
echo "85" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/up_threshold;
echo "10" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/down_differential;
#echo "1" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/io_is_busy;
echo "1" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/sampling_down_factor;
echo "20000" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/sampling_rate;
echo "100" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/freq_step;
echo "5" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/cpu_up_rate;
echo "20" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/cpu_down_rate;
echo "100000" > /sys/devices/system/cpu/cpu0/cpufreq/pegasusq/freq_for_responsiveness;
fi;
if [ -e /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/up_threshold ]; then
echo "85" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/up_threshold;
echo "10" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/down_differential;
#echo "1" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/io_is_busy;
echo "1" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/sampling_down_factor;
echo "20000" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/sampling_rate;
echo "100" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/freq_step;
echo "5" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/cpu_up_rate;
echo "20" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/down_rate;
echo "100000" > /sys/devices/system/cpu/cpu1/cpufreq/pegasusq/freq_for_responsiveness;
fi;
if [ -e /sys/devices/system/cpu/cpufreq/pegasusq/up_threshold ]; then
echo "85" > /sys/devices/system/cpu/cpufreq/pegasusq/up_threshold;
echo "10" > /sys/devices/system/cpu/cpufreq/pegasusq/down_differential;
#echo "1" > /sys/devices/system/cpu/cpufreq/pegasusq/io_is_busy;
echo "1" > /sys/devices/system/cpu/cpufreq/pegasusq/sampling_down_factor;
echo "20000" > /sys/devices/system/cpu/cpufreq/pegasusq/sampling_rate;
echo "100" > /sys/devices/system/cpu/cpufreq/pegasusq/freq_step;
echo "5" > /sys/devices/system/cpu/cpufreq/pegasusq/cpu_up_rate;
echo "20" > /sys/devices/system/cpu/cpufreq/pegasusq/cpu_down_rate;
echo "100000" > /sys/devices/system/cpu/cpufreq/pegasusq/freq_for_responsiveness;
fi;
AWAKE=;
fi;
SLEEPING=`cat /sys/power/wait_for_fb_sleep`;
if [ $SLEEPING = "sleeping" ]; then
sleep 2 && {
echo $SLEEP_GOVERNOR > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor;
echo $SLEEP_CORE_STATUS > /sys/devices/virtual/misc/second_core/hotplug_on;
echo $SLEEP_CORE_STATUS > /sys/devices/virtual/misc/second_core/second_core_on;
}
# ==============================================================
# lulzactive
# ==============================================================
if [ -e /sys/devices/system/cpu/cpufreq/lulzactive/inc_cpu_load ]; then
echo "95" > /sys/devices/system/cpu/cpufreq/lulzactive/inc_cpu_load;
#echo "1" > /sys/devices/system/cpu/cpufreq/lulzactive/pump_up_step;
echo "1" > /sys/devices/system/cpu/cpufreq/lulzactive/pump_down_step;
echo "100000" > /sys/devices/system/cpu/cpufreq/lulzactive/up_sample_time;
echo "100000" > /sys/devices/system/cpu/cpufreq/lulzactive/down_sample_time;
#echo "4" > /sys/devices/system/cpu/cpufreq/lulzactive/screen_off_min_step;
fi;
SLEEPING=;
fi;
done &);
I made this to exchange the status of hotplug and cpu governor between awake and sleepling.
I'll apply with pushing this script as init.d on latest siyah kernel.
It works well when executing manually after boot, but this makes phone unbootable when I put this in init.d.
Phone stays bootlogo and can't go to bootanimation
What should I change in this code to boots the phone and executes itself well?
don't know if under-voltage helps for battery consumption
Done the Stress test with antutu and 'stress test' from market for 2hours, after each under voltage test for each clock rate
and here is my result for 6days testing
#! 700000 712500 725000 737500 750000 762500 787500 800000 812500 825000 837500 850000 887500 900000 912500 937500 962500 987500 1000000 1012500 1037500 1062500 1087500 1112500 1125000 1162500 1200000 1250000 1275000 1325000
echo "192000 700000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "310500 712500" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "384000 725000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "432000 737500" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "486000 750000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "540000 762500" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "594000 787500" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "648000 800000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "702000 812500" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "756000 825000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "810000 837500" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "864000 850000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "918000 887500" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "972000 900000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1026000 912500" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1080000 937500" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1134000 962500" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1188000 987500" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1242000 1000000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1296000 1012500" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1350000 1037500" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1404000 1062500" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1458000 1087500" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1512000 1112500" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1566000 1125000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1620000 1162500" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1674000 1200000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1728000 1250000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1782000 1275000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
echo "1836000 1325000" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels
What kernel are you using?
Sent from my PG86100 using Tapatalk 2
bayp4amd said:
What kernel are you using?
Sent from my PG86100 using Tapatalk 2
Click to expand...
Click to collapse
CoolZ EvoG v2.3 by coolexe
While doing stuff on Fenris ( http://w11.zetaboards.com/Pwnie_Express/topic/10168884/1/#new ) i discovered a LOT of init.d scripts out there so decided to unify all the useful and working tweaks into one single bash script
EDIT.......... after a massive ammount of testing and tweaking, the result is the modifications to the script
it is mostly universal and includes functions for direct config of the elemental x kernel and glitch kernel,
The speed benefits are noticeable but not massive
Please note bin previous version since it was full of bugs inherited from script snippets had picked up from xda roms
Code:
#!/system/bin/sh
BBox="/system/xbin/busybox"
LC="log -p i -t cm"
##########################################################################################
#elemental x 2.10.1 kernel settings
elex_settings() {
$LC "Jubei-->Function--> ENTER......elementalx_kernel"
##########Set FASTCHARGE
#echo 1 > /sys/kernel/fast_charge/force_fast_charge
#$LC "Jubei-->USB Fastcharge enabled"
echo 0 > /sys/kernel/fast_charge/force_fast_charge
$LC "Jubei-->USB Fastcharge disabled"
###########Set SWEEP2WAKE
echo 0 > /sys/android_touch/sweep2wake
$LC "Jubei-->Sweep2wake disabled"
#echo 2 > /sys/android_touch/sweep2wake
#$LC "Jubei-->Sweep2sleep enabled"
#echo 1 > /sys/android_touch/sweep2wake
#$LC "Jubei-->Sweep2wake/Sweep2sleep enabled"
########Set S2W SHORTSWEEP
#echo 1 > /sys/android_touch/shortsweep;
#$LC "Jubei-->Sweep2wake shortsweep enabled"
echo 0 > /sys/android_touch/shortsweep
$LC "Jubei-->Sweep2wake shortsweep disabled"
#Set S2W ORIENTATION
#echo 1 > /sys/android_touch/orientation
#$LC "Jubei-->Disabled sweep2sleep in landscape mode"
#echo 2 > /sys/android_touch/orientation
#$LC "Jubei-->Disabled sweep2sleep in portrait mode"
echo 0 > /sys/android_touch/orientation
$LC "Jubei--> sweep2sleep disabled"
#Set DOUBLETAP2WAKE
#echo 1 > /sys/android_touch/doubletap2wake
#$LC "Jubei--> DoubleTap2Wake enabled"
echo 0 > /sys/android_touch/doubletap2wake
$LC "Jubei--> DoubleTap2Wake disabled"
#Set S2W/DT2W Power key toggle
#echo 1 > /sys/android_touch/pwrkey_suspend;
#$LC "Jubei--> Power key toggle for S2W/DT2W enabled"
echo 0 > /sys/android_touch/pwrkey_suspend
$LC "Jubei--> Power key toggle for S2W/DT2W disabled"
#Set S2W/DT2W Magnetic cover toggle
#echo 1 > /sys/android_touch/lid_suspend;
#$LC "Jubei--> Magnetic cover toggle for S2W/DT2W enabled"
echo 0 > /sys/android_touch/lid_suspend;
$LC "Jubei--> Magnetic cover toggle for S2W/DT2W disabled"
#Set Magnetic on/off
#echo 0 > /sys/module/lid/parameters/enable_lid;
#$LC "Jubei--> Magnetic on/off disabled"
echo 1 > /sys/module/lid/parameters/enable_lid;
$LC "Jubei--> Magnetic on/off enabled"
#battery life extender
#echo 4200 > /sys/devices/i2c-0/0-006a/float_voltage;
#Lower charge voltage to 4.2V
#echo 4100 > /sys/devices/i2c-0/0-006a/float_voltage;
#Lower charge voltage to 4.1V
#echo 4000 > /sys/devices/i2c-0/0-006a/float_voltage;
#Lower charge voltage to 4.0V
$LC "Jubei--> battery life extender disabled"
#max scroff
#echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/max_screen_off;
#$LC "Jubei--> Max screen off disabled"
$LC "Jubei--> Max screen off enabled"
#Set fsync
echo 0 > /sys/module/sync/parameters/fsync_enabled;
$LC "Jubei--> fsync disabled"
#echo 1 > /sys/module/sync/parameters/fsync_enabled;
#$LC "Jubei--> fsync enabled"
#exFAT support
insmod /system/lib/modules/exfat.ko;
$LC "Jubei--> exFAT module loaded"
#Color/gamma support
insmod /system/lib/modules/msm_kcal_ctrl.ko;
$LC "Jubei-->Color/gamma module loaded"
#USB Host mode charging
#echo Y > /sys/module/msm_otg/parameters/usbhost_charge_mode;
#USB OTG+Charge mode enabled
$LC "Jubei-->Function--> EXIT......elementalx_kernel"
#Backlight dimmer option
#echo 10 > /sys/module/msm_fb/parameters/backlight_dimmer;
#$LC "Jubei-->Backlight dimmer enabled\: $BLD"
#thermal settings
echo 80,82,90,100 > /sys/module/msm_thermal/parameters/limit_temp_degC;
$LC "Jubei--> run cool"
#echo 85,90,97,105 > /sys/module/msm_thermal/parameters/limit_temp_degC;
#run hot
#GPU Frequency settings
#Stock GPU
#echo 450000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
#$LC "Jubei-->GPU freq 450MHz"
echo 477000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
$LC "Jubei-->GPU freq 477MHz"
#echo 490500000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
#$LC "Jubei--> GPU freq 491MHz"
#echo 504000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
#GPU freq 504MHz
#echo 531000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
#GPU freq 531MHz
#echo 558000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
#GPU freq 558MHz
#echo 585000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
#GPU freq 585MHz
#GPU Governor settings
#echo simple > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/trustzone/governor;
#$LC "Jubei--> Simple GPU Governor"
#echo performance > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/trustzone/governor;
#$LC "Jubei--> Performance GPU Governor"
echo ondemand > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/trustzone/governor;
$LC "Jubei--> Ondemand GPU Governor"
#io scheduler settings
#echo cfq > /sys/block/mmcblk0/queue/scheduler;
#$LC "Jubei--> CFQ io scheduler"
#echo row > /sys/block/mmcblk0/queue/scheduler;
#$LC "Jubei--> ROW io scheduler"
#echo fiops > /sys/block/mmcblk0/queue/scheduler;
#$LC "Jubei--> FIOPS io scheduler"
#echo sio > /sys/block/mmcblk0/queue/scheduler;
#$LC "Jubei--> SIO io scheduler"
echo deadline > /sys/block/mmcblk0/queue/scheduler;
$LC "Jubei--> deadline io scheduler"
#ElementalX Governor
echo 1 > /sys/devices/system/cpu/cpu0/online;
echo elementalx > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor;
echo 1 > /sys/devices/system/cpu/cpu1/online;
echo elementalx > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor;
echo 1 > /sys/devices/system/cpu/cpu2/online;
echo elementalx > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor;
echo 1 > /sys/devices/system/cpu/cpu3/online;
echo elementalx > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor;
$LC "Jubei--> ElementalX CPU governor"
#Readahead settings
echo 1024 > /sys/block/mmcblk0/queue/read_ahead_kb
$LC "Jubei-->Readahead size 1024"
#gboost settings
#echo 0 > /sys/devices/system/cpu/cpufreq/elementalx/gboost;
#$LC "Jubei--> gboost disabled"
$LC "Jubei--> gboost enabled"
$LC "Jubei-->Function--> EXIT......elementalx_kernel"
}
##########################################################################################
#glitch 142 kernel settings
glitch_kernel() {
$LC "Jubei-->Function--> ENTER......glitch_kernel"
#Max CPU_FREQ
#set safe value for boot and early processes
MAXF="`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`"
$LC "Jubei-->Maximum kern freq is $MAXF"
$LC "Jubei-->Boot Maximum kern freq is 1512000hz"
echo 1512000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
echo 1512000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq;
echo 1512000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq;
echo 1512000 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq;
#Min CPU_FREQ
#set safe value for boot and early processes
MINF="`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`"
$LC "Jubei-->Min kern freq is $MINF"
$LC "Jubei-->Boot Min kern freq is 384000hz"
echo 384000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq;
echo 384000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq;
echo 384000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq;
echo 384000 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq;
#I/O scheduler
#echo "cfq" > /sys/block/mmcblk0/queue/scheduler;
#$LC "Jubei-->io scheduler: cfq"
#echo "row" > /sys/block/mmcblk0/queue/scheduler;
#$LC "Jubei-->io scheduler: row"
#echo "deadline" > /sys/block/mmcblk0/queue/scheduler;
#$LC "Jubei-->io scheduler: deadline"
#echo "fiops" > /sys/block/mmcblk0/queue/scheduler;
#$LC "Jubei-->io scheduler: fiops"
#echo "sio" > /sys/block/mmcblk0/queue/scheduler;
#$LC "Jubei-->io scheduler: sio"
echo "noop" > /sys/block/mmcblk0/queue/scheduler;
$LC "Jubei-->io scheduler: noop"
#Read-ahead
#echo 128 > /sys/block/mmcblk0/queue/read_ahead_kb;
#$LC "Jubei-->Read-ahead: 128"
echo 256 > /sys/block/mmcblk0/queue/read_ahead_kb;
$LC "Jubei-->Read-ahead: 256"
#echo 512 > /sys/block/mmcblk0/queue/read_ahead_kb;
#$LC "Jubei-->Read-ahead: 512"
#echo 1024 > /sys/block/mmcblk0/queue/read_ahead_kb;
#$LC "Jubei-->Read-ahead: 1024"
#echo 2048 > /sys/block/mmcblk0/queue/read_ahead_kb;
#$LC "Jubei-->Read-ahead: 2048"
#FAST CHARGE
#echo 1 > /sys/kernel/fast_charge/force_fast_charge;
#$LC "Jubei-->fast charge enabled"
echo 0 > /sys/kernel/fast_charge/force_fast_charge;
$LC "Jubei-->fast charge disabled"
#Set HOTPLUGDRV
#echo 1 > /sys/kernel/msm_mpdecision/conf/enabled;
#echo 0 > /sys/module/intelli_plug/parameters/intelli_plug_active;
#$LC "Jubei-->msm_mpdecision enabled"
#echo 0 > /sys/kernel/msm_mpdecision/conf/enabled;
#echo 1 > /sys/module/intelli_plug/parameters/intelli_plug_active;
#$LC "Jubei-->intelli_plug enabled"
echo 0 > /sys/kernel/msm_mpdecision/conf/enabled;
echo 0 > /sys/module/intelli_plug/parameters/intelli_plug_active;
$LC "Jubei-->qualcomm_mpdecision enabled"
#Set SWEEP2WAKE
echo 0 > /sys/android_touch/sweep2wake;
$LC "Jubei-->Sweep2wake disabled"
#echo 2 > /sys/android_touch/sweep2wake;
#$LC "Jubei-->Sweep2sleep enabled"
#echo 1 > /sys/android_touch/sweep2wake;
#$LC "Jubei-->Sweep2wake enabled"
#Set S2S_ORIENTATION
#echo 1 > /sys/android_touch/orientation;
#$LC "Jubei-->orientation portrait"
#echo 2 > /sys/android_touch/orientation;
#$LC "Jubei-->orientation landscape"
echo 0 > /sys/android_touch/orientation;
$LC "Jubei-->orientation both"
#Set PWR_TOGGLE
#echo 1 > /sys/android_touch/pwrkey_suspend;
#$LC "Jubei-->power_toggle enabled"
echo 0 > /sys/android_touch/pwrkey_suspend;
$LC "Jubei-->power_toggle disabled"
#Set SHORTSWEEP
#echo 1 > /sys/android_touch/shortsweep;
#$LC "Jubei-->Shortsweep enabled"
echo 0 > /sys/android_touch/shortsweep;
$LC "Jubei-->Shortsweep disabled"
#Set DOUBLETAP2WAKE
#echo 1 > /sys/android_touch/doubletap2wake;
#$LC "Jubei-->DoubleTap2Wake enabled"
echo 0 > /sys/android_touch/doubletap2wake;
$LC "Jubei-->DoubleTap2Wake disabled"
#Set Magnetic on/off
#echo 0 > /sys/module/lid/parameters/enable_lid;
#$LC "Jubei-->Magnetic on/off disabled"
echo 1 > /sys/module/lid/parameters/enable_lid;
$LC "Jubei-->Magnetic on/off enabled"
#USB Host mode charging
#echo Y > /sys/module/msm_otg/parameters/usbhost_charge_mode;
#$LC "Jubei-->USB OTG+Charge mode enabled"
#Input boost
#echo 0 > /sys/kernel/msm_mpdecision/conf/boost_enabled;
#$LC "Jubei-->Input-Boost disabled"
echo 1 > /sys/kernel/msm_mpdecision/conf/boost_enabled;
$LC "Jubei-->Input-Boost enabled"
#Gentle Fair Sleepers
#echo 0 > /sys/kernel/sched/gentle_fair_sleepers;
#$LC "Jubei-->Gentle Fair Sleepers disabled"
echo 1 > /sys/kernel/sched/gentle_fair_sleepers;
$LC "Jubei-->Gentle Fair Sleepers enabled"
#MC Power savings
#echo 2 > /sys/devices/system/cpu/sched_mc_power_savings;
#$LC "Jubei-->Maximum MC power savings"
$LC "Jubei-->MC power savings disabled"
#thermal settings
#echo 80,82,90,100 > /sys/module/msm_thermal/parameters/limit_temp_degC;
#$LC "Jubei-->run cool"
#echo 85,90,97,105 > /sys/module/msm_thermal/parameters/limit_temp_degC;
#$LC "Jubei-->run hot"
$LC "Jubei-->run normal"
#GPU Clock settings
#echo 320000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
#$LC "Jubei-->320MHz GPU"
echo 450000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
$LC "Jubei-->450MHz GPU"
#echo 504000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
#$LC "Jubei-->504MHz GPU"
#echo 545000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
#$LC "Jubei-->545MHz GPU"
#echo 600000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
#$LC "Jubei-->600MHz GPU"
#echo 627000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
#$LC "Jubei-->627MHz GPU"
#echo 400000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
#$LC "Jubei-->400MHz GPU"
#GPU Governor settings
#echo interactive > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/trustzone/governor;
#$LC "Jubei-->Interactive GPU Governor"
#echo performance > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/trustzone/governor;
#$LC "Jubei-->Performance GPU Governor"
echo ondemand > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/trustzone/governor;
$LC "Jubei-->Ondemand GPU Governor"
#GPU uV settings
#printf "920000\n1025000\n1125000\n" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels_GPU;
#$LC "Jubei-->-25mV GPU uV"
#printf "895000\n1000000\n1100000\n" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels_GPU;
#$LC "Jubei-->-50mV GPU uV"
#printf "870000\n975000\n1075000\n" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels_GPU;
#$LC "Jubei-->-75mV GPU uV"
#printf "845000\n950000\n1050000\n" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels_GPU;
#$LC "Jubei-->-100mV GPU uV"
#printf "820000\n925000\n1025000\n" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels_GPU;
#$LC "Jubei-->-125mV GPU uV"
#printf "795000\n900000\n1000000\n" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels_GPU;
#$LC "Jubei-->-150mV GPU uV"
printf "945000\n1050000\n1150000\n" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels_GPU;
$LC "Jubei-->Stock GPU voltage"
#max scroff
#echo 594000 > /sys/devices/system/cpu/cpu0/cpufreq/screen_off_max_freq;
#$LC "Jubei-->594MHz max screen off"
#echo 702000 > /sys/devices/system/cpu/cpu0/cpufreq/screen_off_max_freq;
#$LC "Jubei-->702MHz max screen off"
#echo 810000 > /sys/devices/system/cpu/cpu0/cpufreq/screen_off_max_freq;
#$LC "Jubei-->810MHz max screen off"
#echo 1026000 > /sys/devices/system/cpu/cpu0/cpufreq/screen_off_max_freq;
#$LC "Jubei-->1026MHz max screen off"
#echo 1242000 > /sys/devices/system/cpu/cpu0/cpufreq/screen_off_max_freq;
#$LC "Jubei-->1242MHz max screen off"
echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/screen_off_max;
$LC "Jubei-->max screen off freq disabled"
#Battery life extender
#echo 4200 > /sys/devices/i2c-0/0-006a/float_voltage;
#$LC "Jubei-->4.2V charge voltage"
#echo 4100 > /sys/devices/i2c-0/0-006a/float_voltage;
#$LC "Jubei-->4.1V charge voltage"
#echo 4000 > /sys/devices/i2c-0/0-006a/float_voltage;
#$LC "Jubei-->4.0V charge voltage"
echo 4300 > /sys/devices/i2c-0/0-006a/float_voltage;
$LC "Jubei-->Stock charge voltage"
#exFAT support
insmod /system/lib/modules/exfat.ko;
$LC "Jubei-->exFAT module loaded"
#Wait a bit before applying governor changes
sleep 2
#CPU governor
#interactive
#intellidemand
#smartmax
#ondemand
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor;
$LC "Jubei-->CPU Governor: $governor"
$LC "Jubei-->Function--> EXIT......glitch_kernel"
}
##########################################################################################
# ICUP FUNI CULURSZ
$LC "Jubei--> Vanir first"
# ICUP FUNI CULURSZ
[ -e /sys/class/misc/colorcontrol/v1_offset ] && chown system.system /sys/class/misc/colorcontrol/v1_offset && chmod 0666 /sys/class/misc/colorcontrol/v1_offset
[ -e /sys/class/misc/colorcontrol/multiplier ] && chown system.system /sys/class/misc/colorcontrol/multiplier && chmod 0666 /sys/class/misc/colorcontrol/multiplier
[ -e /sys/devices/platform/omapdss/manager0/gamma ] && chown system.system /sys/devices/platform/omapdss/manager0/gamma && chmod 0666 /sys/devices/platform/omapdss/manager0/gamma
# Expand kernel perms
[ -e /dev/cpuctl/apps/cpu.notify_on_migrate ] && chown system.system /dev/cpuctl/apps/cpu.notify_on_migrate && chmod 0666 /dev/cpuctl/apps/cpu.notify_on_migrate
#use ksm
[ -e /sys/kernel/mm/uksm ] && echo 1 > /sys/kernel/mm/uksm/run && echo 0 > /sys/kernel/mm/ksm/run || echo 1 > /sys/kernel/mm/ksm/run
$LC "Jubei--> ......merge_sysctl"
sysctl -p /system/etc/sysctl.conf
##########################################################################################crond
$LC "Jubei-->......cron_deamon"
# crond has "/bin/sh" hardcoded
mount -o remount,rw rootfs
if [ ! -h /bin ]; then
ln -s /system/bin /bin
fi
mount -o remount,ro rootfs /
# set timezone (if you're not between -0500 and -0800 you get PST)
# todo - support other timezones
local timezone=`date +%z`
if [ $timezone = "-0800" ]; then
TZ=PST8PDT
elif [ $timezone = "-0700" ]; then
TZ=MST7MDT
elif [ $timezone = "-0600" ]; then
TZ=CST6CDT
elif [ $timezone = "-0500" ]; then
TZ=EST5EDT
else
TZ=PST8PDT
fi
export TZ
# use /data/cron, call the crontab file "root"
if [ -e /data/cron/root ]; then
mkdir -p /data/cron
cat > /data/cron/root << EOF
0 20 * * * sync; echo 3 > /proc/sys/vm/drop_caches
0 20 * * * sync; fstrim -v /system
0 20 * * * sync; fstrim -v /data
0 20 * * * sync; fstrim -v /cache
0 20 * * * sync; sysctl -w vm.drop_caches=3
01 * * * * run-parts /system/etc/cron/cron.hourly
02 4 * * * run-parts /system/etc/cron/cron.daily
22 4 * * 0 run-parts /system/etc/cron/cron.weekly
EOF
fi
crond -c /data/cron
##########################################################################################
sync
mount -o remount,rw /system
$LC "Jubei-->......boost_sd"
if [ -e /sys/devices/virtual/bdi/179:0/read_ahead_kb ]; then
echo 1024 > /sys/devices/virtual/bdi/179:0/read_ahead_kb
fi
$LC "Jubei-->......vacume_sqlite"
for i in `find /data -iname "*.db"`; do
/system/xbin/sqlite3 $i 'VACUUM;'
/system/xbin/sqlite3 $i 'REINDEX;'
done
if [ -d "/dbdata" ]; then
for i in `find /dbdata -iname "*.db"`; do
/system/xbin/sqlite3 $i 'VACUUM;'
/system/xbin/sqlite3 $i 'REINDEX;'
done
fi
if [ -d "/datadata" ]; then
for i in `find /datadata -iname "*.db"`; do
/system/xbin/sqlite3 $i 'VACUUM;'
/system/xbin/sqlite3 $i 'REINDEX;'
done
fi
for i in `find /sdcard -iname "*.db"`; do
/system/xbin/sqlite3 $i 'VACUUM;'
/system/xbin/sqlite3 $i 'REINDEX;'
done
##########################################################################################setrenice
$LC "Jubei-->......set_renice"
renice 18 `pidof kswapd0`
for i in {1..20}; do
sleep 1
renice -20 `pidof mediaserver`;
renice -20 `pidof admsrv`;
renice -20 `pidof android.process.media`;
renice -19 `pidof com.android.inputmethod.latin`
renice -18 `pidof com.sec.android.app.controlpanel` # Task manager
renice -17 `pidof com.android.systemui`
renice -10 `pidof com.google.android.apps.googlevoice`
renice -9 `pidof com.android.settings`
renice -9 `pidof com.android.vending`
renice -6 `pidof com.sec.android.app.camera`
done
ionice `pidof mediaserver` rt 0;
ionice `pidof admsrv` rt 0;
ionice `pidof android.process.media` rt 0;
sleep 3
#####################################################################################selinux relable
$LC "Jubei-->......selinux relable"
LABELDATA=0
LABELDALVIKCACHE=0
# Test /data
ls -Zd /data/system | grep -q unlabeled
if [ $? -eq 0 ]; then
$LC "Jubei....userdata is unlabeled, fixing..."
LABELDATA=1
fi
# Double-check other files under /data
ls -Z /data/misc/wifi/wpa_supplicant.conf | grep -q "wifi_"
if [ $? -eq 1 ]; then
$LC "Jubei....data is mis-labeled, fixing..."
LABELDATA=1
fi
ls -Zd /data/dalvik-cache | grep -q unlabeled
if [ $? -eq 0 ]; then
$LC "Jubei....dalvik-cache is unlabeled, fixing..."
LABELDALVIKCACHE=1
fi
ls -Zd /cache/dalvik-cache | grep -q unlabeled
if [ $? -eq 0 ]; then
$LC "Jubei....dalvik-cache is unlabeled, fixing..."
LABELDALVIKCACHE=1
fi
if [ $LABELDATA = "1" ]; then
$LC "Jubei..../data relabel starting..."
restorecon -R /data
$LC "Jubei..../data relabel complete"
$LC "Jubei..../cache relabel starting..."
restorecon -R /cache
$LC "Jubei..../cache relabel complete"
fi
if [ $LABELDALVIKCACHE = "1" ]; then
$LC "Jubei....dalvik-cache relabel starting..."
restorecon -R /data/dalvik-cache
restorecon -R /cache/dalvik-cache
$LC "Jubei....dalvik-cache relabel complete"
fi
##########################################################################################
#
# General Queue Tweaks
#
$LC "Jubei-->......queue_tweaks"
for i in /sys/block/*/queue; do
echo 512 > $i/nr_requests
echo 2 > $i/rq_affinity
echo 0 > $i/nomerges
echo 0 > $i/add_random
echo 0 > $i/rotational
done
# kill iostats hardbad
for i in `find /sys/devices/platform -name iostats`; do
echo "0" > $i
done
##########################################################################################sound mod
$LC "Jubei-->......sound"
#Full Access To ALSA
chmod 777 /dev/snd/*
chown 0.0 /dev/snd/*
#Using ALSA Drivers
export AUDIODRIVER=alsa
##########################################################################################
$LC "Jubei-->......remount"
busybox mount -o remount,noatime,noauto_da_alloc,nodiratime,barrier=0 /system
for m in "/data" "/cache"; do
busybox mount -o remount,barrier=0,nomblk_io_submit,noauto_da_alloc,errors=continue,noatime,nodiratime,nosuid,nodev $m
done
sync
##########################################################################################
$LC "Jubei-->......trim_drop"
sync
fstrim -v /system
fstrim -v /data
fstrim -v /cache
sysctl -w vm.drop_caches=3
sync
Results
Noticeable increase in speed and smoothness of the ui, especially when using nova for a launcher ( gpu rendering support ? )
To emphasise DO NOT USE PREVIOUS VERSION, it has bugs inherited from foreign scripts
So I have a script I am working on and it all works expect for one line and I can figure out what is going on! I would love some advice. Anyways, here is the part that isnt working.
Code:
##SCHEDULER
if [ "$SCHED" == "bfq" ]; then
echo bfq > /sys/block/mmcblk0/queue/scheduler;
echo BFQ io scheduler >> $UBER_LOGFILE;
elif [ "$SCHED" == "cfq" ]; then
echo cfq > /sys/block/mmcblk0/queue/scheduler;
echo CFQ io scheduler >> $UBER_LOGFILE;
elif [ "$SCHED" == "deadline" ]; then
echo deadline > /sys/block/mmcblk0/queue/scheduler;
echo deadline io scheduler >> $UBER_LOGFILE;
elif [ "$SCHED" == "fifo" ]; then
echo fifo > /sys/block/mmcblk0/queue/scheduler;
echo FIFO io scheduler >> $UBER_LOGFILE;
elif [ "$SCHED" == "fiops" ]; then
echo fiops > /sys/block/mmcblk0/queue/scheduler;
echo FIOPS io scheduler >> $UBER_LOGFILE;
elif [ "$SCHED" == "sio" ]; then
echo sio > /sys/block/mmcblk0/queue/scheduler;
echo SIO io scheduler >> $UBER_LOGFILE;
elif [ "$SCHED" == "tripndroid" ]; then
echo tripndroid > /sys/block/mmcblk0/queue/scheduler;
echo tripndroid io scheduler >> $UBER_LOGFILE;
elif [ "$SCHED" == "vr" ]; then
echo vr > /sys/block/mmcblk0/queue/scheduler;
echo VR io scheduler >> $UBER_LOGFILE;
elif [ "$SCHED" == "zen" ]; then
echo zen > /sys/block/mmcblk0/queue/scheduler;
echo ZEN io scheduler >> $UBER_LOGFILE;
else
echo row > /sys/block/mmcblk0/queue/scheduler;
echo ROW io scheduler >> $UBER_LOGFILE;
fi
So I have SCHED set to bfq in
. /system/etc/uber.cfg\
However BFQ doesnt get set as the Scheduler. HOWEVER, (This is the confusing part), BFQ io scheduler is placed in the Uber log as if the command ran. so I went to /sys/block/mmcblk0/queue/scheduler and made sure that the file was there. and i deleted all the other scirpts so it is the only one. I have no apps on the device, just the rom gapps and the script. And the Set on boot command in settings menu is uncheck for all of the kernel settings. So I am super confused on what is happening here.
Device: Nexus 5
Rom: Custom Vanir
Kernel: Uber
Rest of Script:
Code:
#!/system/bin/sh
UBER_LOGFILE="/data/local/tmp/uber.log"
UBER_CFG="/system/etc/uber.cfg"
. /system/etc/uber.cfg\
if [ -f $UBER_LOGFILE ]; then
mv $UBER_LOGFILE $UBER_LOGFILE.2;
fi
echo $(date) >> $UBER_LOGFILE
if $ENABLED; then
##FRANDOM
if $FRANDOM; then
chmod 644 /dev/frandom
chmod 644 /dev/erandom
mv /dev/random /dev/random.ori
mv /dev/urandom /dev/urandom.ori
ln /dev/frandom /dev/random
chmod 644 /dev/random
ln /dev/erandom /dev/urandom
chmod 644 /dev/urandom
echo Frandom On >> $UBER_LOGFILE;
else
echo Frandom Off >> $UBER_LOGFILE;
fi
##FILE SYSTEM TRIM
if $FSTRIM; then
fstrim -v /cache| tee -a $UBER_LOGFILE;
fstrim -v /data| tee -a $UBER_LOGFILE;
echo Fstrim On >> $UBER_LOGFILE;
else
echo Fstrim Off >> $UBER_LOGFILE;
fi
##COLOR PRESET
if $COLORS; then
# Red Positive = /sys/module/dsi_panel/kgamma_rp
echo "0 12 19 30 39 48 56 72 83 105 118 126 121 114 109 102 93 73 63 54 40 33 20" > /sys/module/dsi_panel/kgamma_rp
# Red Negative = /sys/module/dsi_panel/kgamma_rn
echo "0 12 19 30 39 48 56 72 83 105 118 130 121 115 114 102 82 76 63 54 40 33 20" > /sys/module/dsi_panel/kgamma_rn
# Green Positive = /sys/module/dsi_panel/kgamma_gp
echo "0 12 19 30 39 54 61 78 84 107 123 132 117 110 108 97 90 71 61 52 45 37 21" > /sys/module/dsi_panel/kgamma_gp
# Green Negative = /sys/module/dsi_panel/kgamma_gn
echo "0 12 19 30 39 54 61 78 84 107 121 130 119 112 107 99 76 72 57 50 45 37 21" > /sys/module/dsi_panel/kgamma_gn
# Blue Positive = /sys/module/dsi_panel/kgamma_bp
echo "0 12 19 30 39 48 56 72 83 105 121 126 119 112 107 99 91 71 63 53 44 36 22" > /sys/module/dsi_panel/kgamma_bp
# Blue Negative = /sys/module/dsi_panel/kgamma_bn
echo "0 12 19 30 39 48 56 72 83 105 121 134 119 113 110 98 78 72 59 50 44 36 22" > /sys/module/dsi_panel/kgamma_bn
# White Point = /sys/module/dsi_panel/kgamma_w
echo "28" > /sys/module/dsi_panel/kgamma_w
echo Colors Cl3Keners Fav >> $UBER_LOGFILE;
else
echo Stock Colors >> $UBER_LOGFILE;
fi
##FRANCO/FAUX SOUND CONTROL
if [ "$SOUND" == "franco" ]; then
echo $CALL >> /sys/devices/virtual/misc/soundcontrol/headset_boost;
echo $MIC >> /sys/devices/virtual/misc/soundcontrol/mic_boost;
echo $SPEAKER >> /sys/devices/virtual/misc/soundcontrol/speaker_boost;
echo $VOLUME >> /sys/devices/virtual/misc/soundcontrol/volume_boost;
echo Franco Sound >> $UBER_LOGFILE;
fi
if [ "$SOUND" == "faux" ]; then
echo "$FCAM" > /sys/kernel/sound_control_3/gpl_cam_mic_gain
echo "$FHEAD $FHEAD" > /sys/kernel/sound_control_3/gpl_headphone_gain
echo "$FPOW $FPOW" > /sys/kernel/sound_control_3/gpl_headphone_pa_gain
echo "$FMIC" > /sys/kernel/sound_control_3/gpl_mic_gain
echo "$FLOCK" > /sys/kernel/sound_control_3/gpl_sound_control_locked
echo "$FSPEAKER $FSPEAKER" > /sys/kernel/sound_control_3/gpl_speaker_gain
echo Faux Sound >> $UBER_LOGFILE;
else
echo Stock Sound >> $UBER_LOGFILE;
fi
##BACKLIGHT
if $BACKLIGHT; then
echo 1 > /sys/module/lm3630_bl/parameters/backlight_dimmer
echo Backlight Dimmer Enabled >> $UBER_LOGFILE;
else
echo Backlight Dimmer Disabled >> $UBER_LOGFILE;
fi
##KSM
if $KSM; then
echo "1" > /sys/kernel/mm/ksm/run
echo KSM On >> $UBER_LOGFILE;
else
echo KSM Off >> $UBER_LOGFILE;
fi
##SCHEDULER
if [ "$SCHED" == "bfq" ]; then
echo bfq > /sys/block/mmcblk0/queue/scheduler;
echo BFQ io scheduler >> $UBER_LOGFILE;
elif [ "$SCHED" == "cfq" ]; then
echo cfq > /sys/block/mmcblk0/queue/scheduler;
echo CFQ io scheduler >> $UBER_LOGFILE;
elif [ "$SCHED" == "deadline" ]; then
echo deadline > /sys/block/mmcblk0/queue/scheduler;
echo deadline io scheduler >> $UBER_LOGFILE;
elif [ "$SCHED" == "fifo" ]; then
echo fifo > /sys/block/mmcblk0/queue/scheduler;
echo FIFO io scheduler >> $UBER_LOGFILE;
elif [ "$SCHED" == "fiops" ]; then
echo fiops > /sys/block/mmcblk0/queue/scheduler;
echo FIOPS io scheduler >> $UBER_LOGFILE;
elif [ "$SCHED" == "sio" ]; then
echo sio > /sys/block/mmcblk0/queue/scheduler;
echo SIO io scheduler >> $UBER_LOGFILE;
elif [ "$SCHED" == "tripndroid" ]; then
echo tripndroid > /sys/block/mmcblk0/queue/scheduler;
echo tripndroid io scheduler >> $UBER_LOGFILE;
elif [ "$SCHED" == "vr" ]; then
echo vr > /sys/block/mmcblk0/queue/scheduler;
echo VR io scheduler >> $UBER_LOGFILE;
elif [ "$SCHED" == "zen" ]; then
echo zen > /sys/block/mmcblk0/queue/scheduler;
echo ZEN io scheduler >> $UBER_LOGFILE;
else
echo row > /sys/block/mmcblk0/queue/scheduler;
echo ROW io scheduler >> $UBER_LOGFILE;
fi
##IO READAHEAD
echo $IOREAD >> /sys/block/mmcblk0/queue/read_ahead_kb
echo IO Read ahead size\: $IOREAD >> $UBER_LOGFILE;
##SDCARD READAHEAD
echo $SDCARD >> /sys/devices/virtual/bdi/179:0/read_ahead_kb;
echo SDCARD Read ahead size\: $SDCARD >> $UBER_LOGFILE;
##CPU SETTINGS
if $CPU; then
##GOVERNOR
if [ "$GOV" != "false" ]; then
echo "1" > /sys/devices/system/cpu/cpu0/online;
echo $GOV > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor;
echo CPU0 $GOV >> $UBER_LOGFILE;
echo "1" > /sys/devices/system/cpu/cpu1/online;
echo $GOV > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor;
echo CPU1 $GOV >> $UBER_LOGFILE;
echo "1" > /sys/devices/system/cpu/cpu2/online;
echo $GOV > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor;
echo CPU2 $GOV >> $UBER_LOGFILE;
echo "1" > /sys/devices/system/cpu/cpu3/online;
echo $GOV > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor;
echo CPU3 $GOV >> $UBER_LOGFILE;
else
echo Stock CPU GOVs >> $UBER_LOGFILE;
fi
##CPU FREQS
if $CPUFREQ; then
echo $CPUMAX > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
echo CPU0 $CPUMAX Hz >> $UBER_LOGFILE;
echo $CPUMAX > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq;
echo CPU1 $CPUMAX Hz >> $UBER_LOGFILE;
echo $CPUMAX > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq;
echo CPU2 $CPUMAX MHz >> $UBER_LOGFILE;
echo $CPUMAX > /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq;
echo CPU3 $CPUMAX Hz >> $UBER_LOGFILE;
echo $CPU0MIN > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq;
echo CPU0 $CPU0MIN Hz >> $UBER_LOGFILE;
echo $CPUMIN > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq;
echo CPU1 $CPUMIN Hz >> $UBER_LOGFILE;
echo $CPUMIN > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq;
echo CPU2 $CPUMIN Hz >> $UBER_LOGFILE;
echo $CPUMIN > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq;
echo CPU3 $CPUMIN Hz >> $UBER_LOGFILE;
else
echo Stock CPU FREQs >> $UBER_LOGFILE;
fi
##UNDERVOLTING
if $UV; then
echo "1" > /sys/devices/system/cpu/cpu0/online;
echo "730 730 755 755 755 775 785 805 815 825 845 855 890 905 935 975 1030 1045 1060 1080 1115 1130" > /sys/devices/system/cpu/cpu0/cpufreq/UV_mV_table
echo "1" > /sys/devices/system/cpu/cpu1/online;
echo "730 730 755 755 755 775 785 805 815 825 845 855 890 905 935 975 1030 1045 1060 1080 1115 1130" > /sys/devices/system/cpu/cpu1/cpufreq/UV_mV_table
echo "1" > /sys/devices/system/cpu/cpu2/online;
echo "730 730 755 755 755 775 785 805 815 825 845 855 890 905 935 975 1030 1045 1060 1080 1115 1130" > /sys/devices/system/cpu/cpu2/cpufreq/UV_mV_table
echo "1" > /sys/devices/system/cpu/cpu3/online;
echo "730 730 755 755 755 775 785 805 815 825 845 855 890 905 935 975 1030 1045 1060 1080 1115 1130" > /sys/devices/system/cpu/cpu3/cpufreq/UV_mV_table
echo Under Voltz >> $UBER_LOGFILE;
else
echo Stock Voltz >> $UBER_LOGFILE;
fi
else
echo Stock CPU Values >> $UBER_LOGFILE;
fi
##TOUCH BOOST
if $TOUCH; then
echo "1" > /sys/kernel/msm_mpdecision/conf/boost_enabled
echo Touch Boost On >> $UBER_LOGFILE;
else
echo "0" > /sys/kernel/msm_mpdecision/conf/boost_enabled
echo Touch Boost Off >> $UBER_LOGFILE;
fi
##FSYNC
if $FSYNC; then
echo "1" > /sys/kernel/dyn_fsync/Dyn_fsync_active
echo FSync Enabled >> $UBER_LOGFILE;
else
echo "0" > /sys/kernel/dyn_fsync/Dyn_fsync_active
echo FSync Disabled >> $UBER_LOGFILE;
fi
##WAKE CONTROLS
if $WAKE; then
##DOUBLETAP2WAKE
echo $DT2W > /sys/android_touch/doubletap2wake
##SWEEP2WAKE
echo $S2W > /sys/android_touch/sweep2wake
##S2W/DT2W POWER KEY TOGGLE
echo $PWRKEY > /sys/module/qpnp_power_on/parameters/pwrkey_suspend
##S2W/DT2W TIMEOUT
echo $TIMEOUT > /sys/android_touch/wake_timeout
echo S2W/DT2W Timeout\: $TIMEOUT >> $UBER_LOGFILE;
else
echo WAKE CONTROLLS Disabled >> $UBER_LOGFILE;
fi
##FASTCHARGE
if $FASTCHARGE; then
echo 1 > /sys/kernel/fast_charge/force_fast_charge
echo USB Fastcharge enabled >> $UBER_LOGFILE;
else
echo 0 > /sys/kernel/fast_charge/force_fast_charge
echo USB Fastcharge disabled >> $UBER_LOGFILE;
fi
##GPU SETTINGS
if $GPU; then
##GPU GOVERNOR SETTINGS
if $GPUPRE; then
echo performance >> /sys/class/kgsl/kgsl-3d0/pwrscale/trustzone/governor;
echo Performance GPU Governor >> $UBER_LOGFILE;
else
echo ondemand >> /sys/class/kgsl/kgsl-3d0/pwrscale/trustzone/governor;
echo Ondemand GPU Governor >> $UBER_LOGFILE;
fi
##GPU FREQUANCY
echo $GPU_FREQ > /sys/devices/fdb00000.qcom,kgsl-3d0/kgsl/kgsl-3d0/max_gpuclk
echo GPU $GPU_FREQ hz >> $UBER_LOGFILE;
else
echo GOV SETTINGS disabled >> $UBER_LOGFILE;
fi
##EXFAT
if $EXFAT; then
insmod /system/lib/modules/exfat.ko;
echo ExFAT Module Loaded >> $UBER_LOGFILE;
fi
##VIBRATOR SETTINGS
echo $VIB > /sys/class/timed_output/vibrator/amp
echo Vibration Strength\: $VIB >> $UBER_LOGFILE;
##ZRAM SETTINGS
if $ZRAM; then
echo "1" /sys/devices/virtual/block/zram0/initstate;
echo ZRAM ON >> $UBER_LOGFILE;
echo $ZRDK /sys/devices/virtual/block/zram0/size;
echo ZRAM Compression: $ZRDK >> $UBER_LOGFILE;
#ZRam compression changer
echo $ZCOM > /sys/block/zram0/comp_algorithm;
echo ZRAM Compression: $ZCOM >> $UBER_LOGFILE;
else
echo ZRAM OFF >> $UBER_LOGFILE;
fi
##HOTPLUG
if $MPD; then
echo 130 > /sys/kernel/msm_mpdecision/conf/delay
echo "1" > /sys/kernel/msm_mpdecision/conf/enabled
echo "0" > /sys/kernel/msm_mpdecision/conf/boost_enabled
echo $CPUMIN > /sys/kernel/msm_mpdecision/conf/idle_freq
echo "4" > /sys/kernel/msm_mpdecision/conf/max_cpus
echo "1" > /sys/kernel/msm_mpdecision/conf/min_cpus
echo "1" > /sys/kernel/msm_mpdecision/conf/scroff_single_core
echo "12" > /sys/kernel/msm_mpdecision/conf/nwns_threshold_0
echo "0" > /sys/kernel/msm_mpdecision/conf/nwns_threshold_1
echo "16" > /sys/kernel/msm_mpdecision/conf/nwns_threshold_2
echo "34" > /sys/kernel/msm_mpdecision/conf/nwns_threshold_3
echo "20" > /sys/kernel/msm_mpdecision/conf/nwns_threshold_4
echo "39" > /sys/kernel/msm_mpdecision/conf/nwns_threshold_5
echo "0" > /sys/kernel/msm_mpdecision/conf/nwns_threshold_6
echo "46" > /sys/kernel/msm_mpdecision/conf/nwns_threshold_7
echo "140" > /sys/kernel/msm_mpdecision/conf/twts_threshold_0
echo "0" > /sys/kernel/msm_mpdecision/conf/twts_threshold_1
echo "140" > /sys/kernel/msm_mpdecision/conf/twts_threshold_2
echo "100" > /sys/kernel/msm_mpdecision/conf/twts_threshold_3
echo "140" > /sys/kernel/msm_mpdecision/conf/twts_threshold_4
echo "100" > /sys/kernel/msm_mpdecision/conf/twts_threshold_5
echo "0" > /sys/kernel/msm_mpdecision/conf/twts_threshold_6
echo "100" > /sys/kernel/msm_mpdecision/conf/twts_threshold_7
echo MPDECISION Preset Enabled >> $UBER_LOGFILE;
else
echo MPDECISION Preset Disabled >> $UBER_LOGFILE;
fi
##DIRTY RATIOS
echo $DIRTY > /proc/sys/vm/dirty_ratio
echo $DIRTYBACK > /proc/sys/vm/dirty_background_ratio
else
echo UBER PRESETS Disabled >> $UBER_LOGFILE;
fi
exit 0
UPDATE: If I remove all the rest of the script and just have the Sched stuff it still doesnt run correctly.
UPDATE 2: Doesnt work for cfq either
UPDATE 3: This runs fine
Code:
##SCHEDULER
if [ "$SCHED" == "bfq" ]; then
echo bfq > /sys/block/mmcblk0/queue/scheduler;
echo BFQ io scheduler >> $UBER_LOGFILE
else
echo row > /sys/block/mmcblk0/queue/scheduler;
echo ROW io scheduler >> $UBER_LOGFILE;
fi
So its somehing with those elifs
SOLUTION: add sleep 1; in so rom doesnt overwrite the setting!
Here i publish my every day battery tweaks.
I use a Tasker Device Boot Task to apply these tweaks.
You need root, busybox and tasker or init.d support to use these tweaks.
I prefer the Tasker way because it is handier to modify or disable these tweaks.
You DO NOT NEED to factory reset your phone or wipe dalvik cache also a reboot is NOT REQUIRED.
Code:
setenforce 0 &
/system/xbin/daemonsu --auto-daemon &
# io scheduler
# default: noop deadline [row] cfq
echo "cfq" > /sys/block/mmcblk0/queue/scheduler
echo "cfq" > /sys/block/mmcblk1/queue/scheduler
echo ####
echo CPU Governor
echo default: interactive
echo ####
echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo ####
echo Scheduler Queue Deep
echo default: 128
echo ####
echo "192" > /sys/block/mmcblk0/queue/nr_requests
echo "192" > /sys/block/mmcblk1/queue/nr_requests
echo ####
echo Virtual memory management tweaks
echo ####
echo "4096" > /proc/sys/vm/min_free_kbytes
echo "0" > /proc/sys/vm/oom_kill_allocating_task
echo "0" > /proc/sys/vm/panic_on_oom
echo "0" > /proc/sys/vm/laptop_mode
echo "0" > /proc/sys/vm/swappiness
echo "50" > /proc/sys/vm/vfs_cache_pressure
echo "90" > /proc/sys/vm/dirty_ratio
echo "70" > /proc/sys/vm/dirty_background_ratio
echo ####
echo Strict minfree handler tweak
echo nothing changed
echo ####
#echo "256,768,1024,1792,2048,2560" > /sys/module/lowmemorykiller/parameters/minfree
#echo "1536,2048,4096,5120,5632,6144" > /sys/module/lowmemorykiller/parameters/minfree
#echo "2048,3072,6144,15360,17920,20480" > /sys/module/lowmemorykiller/parameters/minfree
#echo "1024,2048,4096,8192,12288,16384" > /sys/module/lowmemorykiller/parameters/minfree
#echo "1024,2048,2560,4096,6144,8192" > /sys/module/lowmemorykiller/parameters/minfree
echo ####
echo Internet speed tweaks
echo ####
echo "0" > /proc/sys/net/ipv4/tcp_timestamps
echo "1" > /proc/sys/net/ipv4/tcp_tw_reuse
echo "1" > /proc/sys/net/ipv4/tcp_sack
echo "1" > /proc/sys/net/ipv4/tcp_tw_recycle
echo "1" > /proc/sys/net/ipv4/tcp_window_scaling
echo "5" > /proc/sys/net/ipv4/tcp_keepalive_probes
echo "30" > /proc/sys/net/ipv4/tcp_keepalive_intvl
echo "30" > /proc/sys/net/ipv4/tcp_fin_timeout
echo "404480" > /proc/sys/net/core/wmem_max
echo "404480" > /proc/sys/net/core/rmem_max
echo "256960" > /proc/sys/net/core/rmem_default
echo "256960" > /proc/sys/net/core/wmem_default
echo "4096 16384 404480" > /proc/sys/net/ipv4/tcp_wmem
echo "4096 87380 404480" > /proc/sys/net/ipv4/tcp_rmem
echo ####
echo Battery Tweaks
echo ####
echo "500" > /proc/sys/vm/dirty_expire_centisecs
echo "1000" > /proc/sys/vm/dirty_writeback_centisecs
echo ####
echo stop market if running
echo ####
busybox killall com.android.vending