[Nexus 5 Android Development] Cl3Kener:
QUICK GUIDE TO TUNING YOUR KERNEL​

Thanks to the uber.cfg you no longer need to tune manually because you have the following already in the kernel:

1. BOOT SETTINGS

1.1 KERNEL SWITCH

1.2 GRACE TIME

1.3 WAIT TIMERS

1.4 FILE SYSTEM TRIM

2. CPU SETTINGS

2.1 CPU SETTINGS SWITCH

2.2 CPU FREQUENCY SCALING

2.2.1 CPU FREQUENCY SCALING SWITCH

2.2.2 CPU MAX FREQUENCY

2.2.3 CPU MIN FREQUENCY

2.3 CPU GOVERNOR

2.3.1 CPU GOVERNOR SWITCH

2.3.2 CPU GOVERNORS

2.4 CPU MULTICORE POWER SAVING

3. CPU VOLTAGE SETTINGS

4. HOTPLUG SETTINGS

4.1 MPDECISION SWITCH

4.1.1 MPDECISION SCREEN-OFF MAX FREQUENCY

4.1.2 MPDECISION SCREEN-OFF SINGLE CORE

4.1.3 MPDECISION TOUCHBOOST

4.1.4 MPDECISION MIN CPUS

4.1.5 MPDECISION MAX CPUS

4.1.6 MPDECISION HOTPLUG CONTROL

4.1.7 MPDECISION UNPLUG CONTROL

5. I/O SETTINGS

5.1 I/O SCHEDULER

5.2 I/O READ SPEED

5.3 I/O READ SPEED FOR SD CARD

6. GPU SETTINGS

6.1 GPU SETTINGS SWITCH

6.2 GPU FREQUENCY SCALING

6.2.1 GPU MAX FREQUENCY

6.2.2 GPU MIN FREQUENCY

6.3 GPU GOVERNOR

6.3.1 GPU GOVERNORS

6.3.2 GPU UP THRESHOLD

6.3.3 GPU DOWN THRESHOLD

7. GAMMA SETTINGS

7.1 GAMMA PRESET

7.2 BACKLIGHT DIMMER

7.2.1 BACKLIGHT DIMMER SWITCH

7.2.2 MINIMUM BRIGHTNESS

8. SOUND SETTINGS

8.1 SOUND ENGINE

8.2 FRANCO SOUND SETTINGS

8.2.1 FRANCO MIC INPUT LEVEL

8.2.2 FRANCO CALL OUTPUT LEVEL

8.2.3 FRANCO SPEAKER OUTPUT LEVEL

8.2.4 FRANCO HEADPHONE OUTPUT LEVEL

8.3 FAUX SOUND SETTINGS

8.3.1 FAUX MIC INPUT LEVEL

8.3.2 FAUX MIC INPUT LEVEL FOR CAM

8.3.3 FAUX SPEAKER OUTPUT LEVEL

8.3.4 FAUX HEADPHONE OUTPUT LEVEL

8.3.5 FAUX POWER AMP LEVEL

8.3.6 FAUX LOCK

9. MEMORY SETTINGS

9.1 ZRAM SETTINGS

9.1.1 ZRAM SWITCH

9.1.2 ZRAM COMPRESSION

9.1.3 ZRAM DISK SIZE (MB)

9.2 VIRTUAL MACHINE SETTINGS

9.2.1 SWAPPINESS

9.2.2 DIRTY RATIO

9.2.3 DIRTY BACKGROUND RATIO

9.2.4 DROP CACHES

9.2.5 FS WRITEBACK DELAY MODE

9.3 KERNEL SAMEPAGE MERGING

10. WAKE SETTINGS

10.1 WAKE CONTROL SWITCH

10.2 DOUBLE TAP TO WAKE

10.3 SWEEP TO WAKE/SLEEP

10.4 POWERKEY SUSPEND

10.5 WAKE TIMEOUT

11. MISCELLANEOUS SETTINGS

11.1 TCP CONGESTION CONTROL

11.2 DYNAMIC FSYNC

11.3 POWER SUSPEND

11.4 VIBRATION INTENSITY

11.5 USB FAST CHARGE

11.5.1 FAST CHARGE SWITCH

11.5.2 FAST CHARGE LEVEL

11.6 BATTERY LIFE EXTENDER

12. MODULES

12.1 FRANDOM

12.2 EXFAT

​

I still left these commands for people that like to see them anyways:

Set Color Profiles

See here http://xdaforums.com/showpost.php?p=52926016&postcount=866

Dynamic Fsync

To enable - echo 1 > /sys/kernel/dyn_fsync/Dyn_fsync_active

To disable - echo 0 > /sys/kernel/dyn_fsync/Dyn_fsync_active

KSM (Kernel Samepage Merging)

To enable - echo "1" > /sys/kernel/mm/ksm/run

To disable - echo "0" > /sys/kernel/mm/ksm/run

USB Fast Charge

To enable - echo 1 > /sys/kernel/fast_charge/force_fast_charge

This makes USB to computer connections transfer current the same as the wall charger. (Classical version)

Faux123 added the a ability to change currents to 500 900 1200 1500 2000. Enable by doing this

To enable custom - echo 2 > /sys/kernel/fast_charge/force_fast_charge

Then

echo 1500 > /sys/kernel/fast_charge/fast_charge_level

change value 1500 to whatever you want (as long as it's one of those 5 values)

To disable - echo 0 > /sys/kernel/fast_charge/force_fast_charge

Set Default IO Scheduler

IO Acceptable values are bfq, cfq, deadline, fifo, fiops, noop, row, sio, vr, zen

echo "bfq" > /sys/block/mmcblk0/queue/scheduler

Set Default CPU Governor

Acceptablevalues are adaptive, badass, intelliactive, dancedance, wheatley, abyssplugv2, ondemandplus, intellidemand, interactive, conservative, userspace, powersave, lionheart, ondemand, performance and others mentioned in kernel features above.

echo "1" > /sys/devices/system/cpu/cpu0/online;

echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor;

echo "1" > /sys/devices/system/cpu/cpu1/online;

echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor;

echo "1" > /sys/devices/system/cpu/cpu2/online;

echo "ondemand" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor;

echo "1" > /sys/devices/system/cpu/cpu3/online;

echo "ondemand" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor;

Backlight Dimmer

N is disabled, Y is enabled.

echo "N" > /sys/module/lm3630_bl/parameters/backlight_dimmer

Touch Boost

Toggle 0 is disabled 1 is enabled.

echo "0" > /sys/kernel/msm_mpdecision/conf/boost_enabled

Double Tap To Wake

There are three options here:

0 is disabled

1 is normal dt2w (bottom half of screen)

2 is full screen dt2w

echo "0" > /sys/android_touch/doubletap2wake

Sweep2Wake/Sweep2Sleep

This one is tricky because there are two files to change. If you want both only run

echo "1" > /sys/android_touch/sweep2wake

If you only want sweep2sleep you'll have to run this as well.

echo "1" > /sys/android_touch/s2w_s2sonly

To disabled run both run these commands but with 0s instead.

GPU Governor Toggle

Acceptable values are "performance" "simple" or "ondemand". Ondemand is default so I placed simple here. Performance will freeze system is placed at full OC (at lest for me so be careful!)

echo "ondemand" > /sys/class/kgsl/kgsl-3d0/pwrscale/trustzone/governor

Frequency options (Use values on the left for init.d script)

533333000-> 533 Mhz

487500000-> 487 Mhz

450000000-> 450 Mhz

389000000-> 389 Mhz

320000000-> 320 Mhz

200000000-> 200 Mhz

150000000-> 150 Mhz

Set Max GPU:

echo "320000000" > /sys/devices/fdb00000.qcom,kgsl-3d0/kgsl/kgsl-3d0/max_gpuclk

Set Min GPU:

echo "150000000" > /sys/devices/fdb00000.qcom,kgsl-3d0/kgsl/kgsl-3d0/min_pwrlevel

Pwrkeysuspend (disables s2w, dt2w)

# 0 = disabled, 1 = enabled

echo "1" > /sys/module/qpnp_power_on/parameters/pwrkey_suspend

Wake Timeout of S2W/DT2W

Note: # is in minutes (not seconds)

echo "#" > /sys/android_touch/wake_timeout

Load ExFat Module

insmod /system/lib/modules/exfat.ko

SET DEFAULT BOTTOM CLOCK SPEEDS

(If you want to set max change crom scaling_min_freq to scaling_max_freq on bottom four) Acceptable values any of the clock speeds.

echo "96000" > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq

echo "96000" > /sys/devices/system/cpu/cpufreq/ondemand/sync_freq

echo "96000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

echo "96000" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq

echo "96000" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq

echo "96000" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq

Vibrator Level

Stock Value is 63. Range of acceptable values is 0-100

echo "63" > /sys/class/timed_output/vibrator/amp

Dirty Ratios

# dirty_background_ratio default is 10 (background meaning screen is off usually)

echo "20" > /proc/sys/vm/dirty_background_ratio

# dirty_ratio default is 20.

echo "40" > /proc/sys/vm/dirty_ratio

Set MPDecision Values

Note: Only change these values after you've played with them in your favorite kernel tuning app. I recommend figuring out your settings then finding these files with a root browser then you can fill these init.d lines in with your root browser of choice.

echo "1" > /sys/kernel/msm_mpdecision/conf/enabled

echo "0" > /sys/kernel/msm_mpdecision/conf/boost_enabled

echo "300000" > /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 "12" > /sys/kernel/msm_mpdecision/conf/nwns_threshold_0

echo "0" > /sys/kernel/msm_mpdecision/conf/nwns_threshold_1

echo "25" > /sys/kernel/msm_mpdecision/conf/nwns_threshold_2

echo "7" > /sys/kernel/msm_mpdecision/conf/nwns_threshold_3

echo "30" > /sys/kernel/msm_mpdecision/conf/nwns_threshold_4

echo "10" > /sys/kernel/msm_mpdecision/conf/nwns_threshold_5

echo "0" > /sys/kernel/msm_mpdecision/conf/nwns_threshold_6

echo "18" > /sys/kernel/msm_mpdecision/conf/nwns_threshold_7

echo "1" > /sys/kernel/msm_mpdecision/conf/scroff_single_core

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 "190" > /sys/kernel/msm_mpdecision/conf/twts_threshold_3

echo "140" > /sys/kernel/msm_mpdecision/conf/twts_threshold_4

echo "190" > /sys/kernel/msm_mpdecision/conf/twts_threshold_5

echo "0" > /sys/kernel/msm_mpdecision/conf/twts_threshold_6

echo "190" > /sys/kernel/msm_mpdecision/conf/twts_threshold_7

Set Thermal Values

Go to /sys/kernel/msm_thermal/conf/ in a root file browser and change the values

I recommend that you figure out what you like and then create your own init.d script like I did. Here is the link to my example Script. I have 99 appended to the front so that it will run last resetting any previously set settings.

https://copy.com/cyApOWNSjPs1

Here is my init.d tweak folder. https://www.dropbox.com/sh/88sqwe9q018pcne/xCzZBKAJTt Make sure to give them a number in the front if you decide to add them. Like 01_blahblah or 02_blahblah.​

​