Code: #!/system/bin/sh bb=busybox echo "[defcon] Welcome to Ultimate Kernel Series" | tee /dev/kmsg # Disable mpdecision & thermald stop thermald stop mpdecision echo 1 > /sys/module/msm_thermal/parameters/enabled echo "[defcon] thermald & mpdecision disabled" | tee /dev/kmsg echo "[defcon] Intelli-Thermal Enabled!" | tee /dev/kmsg # Set default hotplug here: echo 0 > /sys/module/autosmp/parameters/enabled echo 0 > /sys/module/dyn_hotplug/parameters/enabled echo 1 > /sys/kernel/intelli_plug/intelli_plug_active echo "[defcon] hotplug options set!" | tee /dev/kmsg # Neobuddy Intelliplug options # profile selections for full_mode_profile # 0 balanced 4 cores (default) # 1 performance 4 cores # 2 conservative 4 cores saves battery # 3 disable # 4 Tri # 5 Eco # 6 Strict # runthreshold default is 722 # hystersis choice 0 thru 16 default is 8 # max_cpus_online <--- # cpus_boosted = max cpus boosted # max_cpus_online_susp = max cpu's while suspended echo "1" > /sys/kernel/intelli_plug/intelli_plug_active echo "0" > /sys/kernel/intelli_plug/parameters/full_mode_profile echo "4" > /sys/kernel/intelli_plug/max_cpus_online echo "1" > /sys/kernel/intelli_plug/min_cpus_online echo "3" > /sys/kernel/intelli_plug/cpus_boosted echo "1" > /sys/kernel/intelli_plug/max_cpus_online_susp echo "722" > /sys/kernel/intelli_plug/parameters/cpu_nr_run_threshold echo "8" > /sys/kernel/intelli_plug/parameters/nr_run_hysteresis echo "[defcon] Intelliplug fully optimized!" | tee /dev/kmsg # Stratosk dyn_hotplug Settings echo "4" > /sys/module/dyn_hotplug/parameters/max_online echo "10" > /sys/module/dyn_hotplug/parameters/down_timer_cnt echo "2" > /sys/module/dyn_hotplug/parameters/up_timer_cnt echo "25" > /sys/module/dyn_hotplug/parameters/up_threshold echo "1" > /sys/module/dyn_hotplug/parameters/min_online echo "[defcon] Dyn_hotplug fully optimized!" | tee /dev/kmsg # Tweak AutoSMP Hotplug echo "972000" > /sys/kernel/autosmp/conf/cpufreq_down echo "1242000" > /sys/kernel/autosmp/conf/cpufreq_up echo 3 > /sys/kernel/autosmp/conf/cycle_down echo 1 > /sys/kernel/autosmp/conf/cycle_up echo 4 > /sys/kernel/autosmp/conf/max_cpus echo 1 > /sys/kernel/autosmp/conf/min_cpus echo "100" > /sys/kernel/autosmp/conf/delay echo 1 > /sys/kernel/autosmp/conf/scroff_single_core echo "[defcon] autosmp fully optimized!" | tee /dev/kmsg # Set TCP westwood echo "westwood" > /proc/sys/net/ipv4/tcp_congestion_control echo "[defcon] TCP set: westwood" | tee /dev/kmsg # Set IntelliActive as default: echo "HYPER" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor echo "HYPER" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor echo "HYPER" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor echo "HYPER" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor 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 echo "[defcon] HYPER CPU Governor activated" | tee /dev/kmsg # Set Power Save Settings echo 1 > /sys/module/pm_8x60/modes/cpu0/wfi/suspend_enabled echo 1 > /sys/module/pm_8x60/modes/cpu0/power_collapse/suspend_enabled echo 1 > /sys/module/pm_8x60/modes/cpu1/power_collapse/suspend_enabled echo 1 > /sys/module/pm_8x60/modes/cpu2/power_collapse/suspend_enabled echo 1 > /sys/module/pm_8x60/modes/cpu3/power_collapse/suspend_enabled echo 1 > /sys/module/pm_8x60/modes/cpu0/standalone_power_collapse/suspend_enabled echo 1 > /sys/module/pm_8x60/modes/cpu1/standalone_power_collapse/suspend_enabled echo 1 > /sys/module/pm_8x60/modes/cpu2/standalone_power_collapse/suspend_enabled echo 1 > /sys/module/pm_8x60/modes/cpu3/standalone_power_collapse/suspend_enabled echo "[defcon] Power saving modes Enabled" | tee /dev/kmsg # Set IOSched echo "fiops" > /sys/block/mmcblk0/queue/scheduler echo "2048" > /sys/block/mmcblk0/queue/read_ahead_kb echo "[defcon] IOSched set: fiops" | tee /dev/kmsg echo "[defcon] IOSched readahead set to: 2048" | tee /dev/kmsg # Sweep2Dim default echo "0" > /sys/android_touch/sweep2wake echo "1" > /sys/android_touch/sweep2dim echo "73" > /sys/module/sweep2wake/parameters/down_kcal echo "73" > /sys/module/sweep2wake/parameters/up_kcal echo "[defcon] sweep2dim enabled!" | tee /dev/kmsg # Set RGB KCAL if [ -e /sys/devices/platform/kcal_ctrl.0/kcal ]; then sd_r=255 sd_g=255 sd_b=255 kcal="$sd_r $sd_g $sd_b" echo "$kcal" > /sys/devices/platform/kcal_ctrl.0/kcal echo "1" > /sys/devices/platform/kcal_ctrl.0/kcal_ctrl echo "[defcon] LCD_KCAL: red=[$sd_r], green=[$sd_g], blue=[$sd_b]" | tee /dev/kmsg fi # disable sysctl.conf to prevent ROM interference with tunables $bb mount -o rw,remount /system $bb [ -e /system/etc/sysctl.conf ] && $bb mv -f /system/etc/sysctl.conf /system/etc/sysctl.conf.fkbak # disable the PowerHAL since there is a kernel-side touch boost implemented $bb [ -e /system/lib/hw/power.msm8960.so.fkbak ] || $bb cp /system/lib/hw/power.msm8960.so /system/lib/hw/power.msm8960.so.fkbak $bb [ -e /system/lib/hw/power.msm8960.so ] && $bb rm -f /system/lib/hw/power.msm8960.so # create and set permissions for /system/etc/init.d if it doesn't already exist $bb mkdir /system/etc/init.d; $bb chown -R root.root /system/etc/init.d; $bb chmod -R 775 /system/etc/init.d; $bb mount -o ro,remount /system; echo "[defcon] init.d permissions set" | tee /dev/kmsg # Interactive Options echo 20000 1300000:40000 1400000:20000 > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay echo 85 1300000:90 1400000:70 > /sys/devices/system/cpu/cpufreq/interactive/target_loads # GPU Max Clock echo "400000000" > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk echo "[defcon] GPU Max Clock Set" | tee /dev/kmsg # disable debugging on some modules echo "0" > /sys/module/kernel/parameters/initcall_debug; echo "0" > /sys/module/alarm/parameters/debug_mask; echo "0" > /sys/module/alarm_dev/parameters/debug_mask; echo "0" > /sys/module/binder/parameters/debug_mask; echo "0" > /sys/module/xt_qtaguid/parameters/debug_mask; #FS DELAY WRITEBACKS MODE # This command delays auto fs writebacks or file system bits cached in RAM while Screen is ON. Enable this feature for better performance. Note this adds a slight risk of possible data loss if you phone crashes while screen is on. echo "0" > /proc/sys/vm/laptop_mode echo "0" > /sys/kernel/sched/gentle_fair_sleepers echo "1" > /sys/kernel/sched/arch_power echo "[defcon] Tweaks completed!" | tee /dev/kmsg

Quote: Originally Posted by maxwen Originally Posted by Well - you did it it 100% correct



Some more info



The basic idea - which comes from smartass - is the concept of an "ideal" frequency.



The following strategy is used:

1) If load is above upper-threshold and current frequency is below ideal freq

-> jump to ideal in one step

2) If load is above upper-threshold and current frequency is at or above ideal freq

->do "ramp up" steps which will include all frequencies for a specific

amount of time - so compared to ondemand no "jumping" to max frequency

3) if load is below lower-threshold and current frequency is below ideal freq

->do "ramp down" steps

4) if load is below lower-threshold and current frequency is above ideal freq

-> jump down to ideal in one step



All those thresholds ramp steps and frequency stepping times are

fully configurable using sysfs. By default I tried to create a good balance.



The ideal frequency for "us" is 475000 which is the maximal frequency

of the LP mode of the tegra chip. This will allow using LP mode as much as possible



Additional to make it "snappy" smartmax has "touch poke"

So input events from the touchscreen will boost the cpu for a specific

time to a specific frequency.

Code: [email protected]:/ # dmesg | grep defcon <4>[ 15.718968] [defcon] Welcome to Ultimate Kernel Series <4>[ 15.803906] [defcon] thermald & mpdecision disabled <4>[ 15.808911] [defcon] Intelli-Thermal Enabled! <4>[ 15.817366] [defcon] hotplug options set! <4>[ 15.822981] [defcon] Intelliplug fully optimized! <4>[ 15.831619] [defcon] Dyn_hotplug fully optimized! <4>[ 15.843338] [defcon] autosmp fully optimized! <4>[ 15.853197] [defcon] TCP set: westwood <4>[ 15.875080] [defcon] HYPER CPU Governor activated <4>[ 15.889455] [defcon] Power saving modes Enabled <4>[ 16.121379] [defcon] IOSched set: fiops <4>[ 16.126201] [defcon] IOSched readahead set to: 2048 <4>[ 16.131237] [defcon] sweep2dim enabled! <4>[ 16.136670] [defcon] LCD_KCAL: red=[255], green=[255], blue=[255] <4>[ 16.864153] [defcon] init.d permissions set <4>[ 16.867144] [defcon] GPU Max Clock Set <4>[ 16.871051] [defcon] Tweaks completed!

This Works great with Temasek CM11 here Also was especially designed and optimized for Android L here Also works with CM11/CAF based ROM's, flash the CM11 kernel.Other governors have been added so you have full control in tweaking your device:SmartMax, Wheatley and OndemandPlus are more battery efficient than Intelliactive that is default, to compensate with intelliactive, undervoltSetting a Higher Hysteresis value for IntelliPlug will help with battery, lowering it will improve performance.Lowering the Intelliactive Boost cores can save battery.99% of the Kernel features of this rom can be customized and set automatically on boot via init.d, you don't need Synapse if you are a cmd line pro and want to save a little bit of processor time/battery:contents of /system/etc/init.d/99defcon:Based off Google's Interactive governor with the following enhancements:1. self-boost capability from input drivers (no need for PowerHAL assist)2. two phase scheduling (idle/busy phases to prevent from jumping directly to max freq3. Checks for offline cpus and short circuits some unnecessary checks to improve code execution pathsIntellidemand aka Intelligent Ondemand from Faux is yet another governor that's based on ondemand. Unlike what some users believe, this governor is not the replacement for OC Daemon (Having different governors for sleep and awake). The original intellidemand behaves differently according to GPU usage. When GPU is really busy (gaming, maps, benchmarking, etc) intellidemand behaves like ondemand. When GPU is 'idling' (or moderately busy), intellidemand limits max frequency to a step depending on frequencies available in your device/kernel for saving battery. This is called browsing mode. We can see some 'traces' of interactive governor here. Frequency scale-up decision is made based on idling time of CPU. Lower idling time (<20%) causes CPU to scale-up from current frequency. Frequency scale-down happens at steps=5% of max frequency. (This parameter is tunable only in conservative, among the popular governors)To sum up, this is an intelligent ondemand that enters browsing mode to limit max frequency when GPU is idling, and (exits browsing mode) behaves like ondemand when GPU is busy; to deliver performance for gaming and such. Intellidemand does not jump to highest frequency when screen is off.The Pegasus-q is a multi-core based on the Ondemand governor and governor with integrated hot-plugging.Ongoing processes in the queue, we know that multiple processes can run simultaneously on. These processes are active in an array, which is a field called "Run Queue" queue that is ongoing, with their priority values ​​arranged (priority will be used by the task scheduler, which then decides which process to run next).To ensure that each process has its fair share of resources, each running for a certain period and will eventually stop and then again placed in the queue until it is your turn again. If a program is terminated, so that others can run the program with the highest priority in the current queue is executed.A PegasusQ modified, less aggressive and more stable. A good compromise between performance and battery.In addition to the SoD is a prevention because it usually does not hotplug.The Hyper (formerly known as kenobi) is an aggressive smart and smooth, optimized for SGS2 getweakt and, based on the Ondemand, which was getweakt of Arighi and was equipped with several features of Ondemandx suspend imoseyon. (Added by sysfs, the settings suspend_freq and suspend Imoseyon's code) is the behavior of the hyper Ondemand if he is in action, very similar. He also has the Arighi's fast_start deep_sleep and detection features. In addition, the maximum frequency is in suspend mode 500Mhz.Based of Google, CAF, CM, myfluxi and franciscofranco Interactive by @ eng.stk Building on the classic 'ondemand' governor is implemented Wheatley governor. The governor has two additional parameters:target_residency - The minimum average residency in µs which is considered acceptable for a proper efficient usage of the C4 state. Default is 10000 = 10ms.allowed_misses - The number sampling intervals in a row the average residency is allowed to be lower than target_residency before the governor reduces the frequency. This ensures that the governor is not too aggressive in scaling down the frequency and reduces it just because some background process was temporarily causing a larger number of wakeups. The default is 5.Wheatley works as planned and does not hinder the proper C4 usage for task where the C4 can be used properly .For internet browsing the time spend in C4 has increased by 10% points and the average residency has increased by about 1ms. I guess these differences are mostly due to the different browsing behaviour (I spend the last time more multi-tabbing). But at least we can say that Wheatley does not interfere with the proper use of the C4 state during 'light' tasks. For music playback with screen off the time spend in C4 is practically unchanged, however the average residency is reduced from around 30ms to around 18ms, but this is still more than acceptable.So the results show that Wheatley works as intended and ensures that the C4 state is used whenever the task allows a proper efficient usage of the C4 state. For more demanding tasks which cause a large number of wakeups and prevent the efficient usage of the C4 state, the governor resorts to the next best power saving mechanism and scales down the frequency. So with the new highly-flexible Wheatley governor one can have the best of both worlds.Obviously, this governor is only available on multi-core devices.A governor based off of OnDemand and Interactive. It provides a balance between performance, and saving battery.On boot 99defcon init.d script is executed, modify this for default settings, to override use SynapseF2FS is supported, but you need to modify the updater-script:, see here