[Galaxy S Advance I9070 Android Development] Shaaan:
How to tweak the kernel furthermore :

In short :

Same as CoCore E

In long :

Here are some intructions/tips about how to play with the kernel.

Terminal is needed.

If you want to change the values,it needs su permission.

If you get 'Permisson denied',you need su permisson.

You can cd to the folder first,then do echos.

( Boot time )

CoCore-E boots faster than stock normally.

How to check boottime?

* TWRP kernel boottime is longer(around 8000ms).Because of that big ramdisk!

( Bootanimation )

Put bootanimation.zip in /system/media/.

Recommend you changing the permission to 0666.

If there is no bootanimation.zip,kernel will show you Samsung's.

( CPU governors )

* OnDemand has been patched cpu idle detection

* PegasusQ is taken from SiyahKernel (new version)

* Personaly,I use PegasusQ/OnDemand(Q)/HotPlug

* To be honest,most of custom governors are based on ondemand/interactive

* OndemandQ is a new governor.It will hotplug cpu when screen turns off only.

* If you mind the battery life time,choose HotPlug.It hotplugs cpu frequently.

* Interactive updated to linux-android-3.4 [Thanks!Aditya!]

* Zzmoove is new version(0.3),i havent tested fully.

( IO schedulers )

* Please choose them by yourself

* Personaly.i use SIO.

( Deepest sleep state )

Stock deepest is 3.Now it is 4 by default.

Deepest supported is 5.

To change:

* PegasusQ(hotplug governors) works badly with 5

* OnDemand works well with 5

* Please note that it wont increase the using time but standby time.

To check the cpuidle state:

( zRAM SWAP )

[zRAM]

zRAM is optimized for Android.

It is not lazy anymore.

Using zRAM will take a little CPU,because it needs to compress/decompress memory.

Setup disksize first: (example: 96mb= 96×1024×1024)

* Lager size more RAM will be compressed.

Enable:

mkswap /dev/block/zram0
swapon /dev/block/zram0

To check how many does it use:

* You can get other info in its sysfs

[SWAP]

Format/resize your SdCard via computer first.

Enable:

( Init.d script )

Please install busybox in system first

I recommend you install busybox via apps

Create a new folder named 'init.d' in /system/etc

Set the permisson of init.d foler to 0777(rwxrwxrwx) (at least has read and exec permission)

Set the owner to 0.0 (root root)

Put some scripts (any name you like) in init.d folder with permisson 0777 (rwxrwxrwx) (at least has read and exec permission)

Scripts with right permisson will be runned when system boots.

( Charger control )

Please note that this control can damage your battery/phone.

If your battery/phone damaged,read the top of #1 post. :p

Lower current makes the charging longer,but protects battery.

Too high current can burn your battery!

I recommend you that dont set the max limited current over 900mA.

To change the AC max limited current: (range: 100 - 1100) (default: 600)

To change the USB max limited current: (range: 50 - 1100) (default: 500)

* Your values wont be applied immediately.They will be applied when plug charger.

* I recommend you input some values like 300,350,600...

* The value(s) that is not in range will be reverted to stock default value(s).

* Increase USB current properly can implement USB fast charging

To get the charging current:

When you plug charger:

( Charge cycle control )

To increase the recharge times:

(Default: 3)

* 5 is recommended.If you want more recharging.

* This probably can make phone charge deeper,do it once a month if you want.

( Real charged notification )

Well,please let me call it notification.

To be honest,it needs to check manually.

* You can use Rootexplorer to view this file.

* When it says "First full charging reached",then the UI should show you charged 100%

But it is not the real full charged.

* When it says it is the real full charged,you can unplug the charger.

* When you are charging and do a reboot will reset the counter.

* According to my experiments,it needs 1-2 hours to charge to real full.

( Sound control )

Please note that listening to too high volume music over 1 hour can damage your ears.

Or makes your speaker/headset overload.

(5.0+) Sound control has been enhanced.Please read it carefully.

Switch to sound control folder:

cd /sys/mo*/snd_soc*/p*

Use RootExplorer to view this folder,you will see a lot files.

Sound hacks wont take effects immediately.It depends on powering on/off ab8500 asoc.

Stop music for 5s to let ab8500 asoc shut down fully,then turn on music.

You need to enable XXXXX_con first,then tweak the XXXXX_bit.

After enabling XXXXX_con,it will be applied when codec powers on or it wont.

How do i check whether it has shuted down or not?

dmesg | grep codec

If you get "Disable ab850x",it has been powered off.

I will explain how to calculate the binay values below.

If we echo 0000 to something,system will consider it as 0.

But that doesnt matter.

'(default)' means that is my default setting in sound control.

[AnaGain3] (Headset audio path):

Ana stands for 'analong'.This is analong gain.

To enable control:

To tweak volume: [volume 0(default, +31dB) > 34 > 68(stock) > 85 > 87]

* Most values(except 0,34,68,85) will make the volume lost balance.

* If you hear too much noise with 0,34 is recommended.

* It is nice to use 0 with large speakers(audio output)

[HsXDigGain] (Headset Digital Gain)

HsL means left channel.HsR is the right.

To enable control:

To tweak:

* 0000: +8 dB gain (default)

* 0001: +7 dB gain

* ....: -1 dB step

* 0111: +1 dB gain

* 1000: 0 dB gain

* 1001 to 1111: -inf dB gain (mute)

* If you use +31 dB AnaGain3 + +8 dB DigGain,the result will higher than +39dB!

* Be careful,when the volume is too high,codec will power off automatically.

* Experience the differences between digital gain and analong gain by yourself.

[HsLowPow] (Headset low power mode)

This lowpow mode is enabled by driver normally.

If you want high performance audio instead of LPA(low power audio),

You can disable it.

To enable control:

To tweak:

* 0: Normal Operation (default)

* 1: Hs drivers in Low Power

[HsDacLowPow] (Headset DAC low power mode)

DAC is Digital-to-Analong Converter.

This lowpow mode is enabled by driver normally.

To enable control:

To tweak:

* 00: Normal Operation (default)

* 01: Hs DAC drivers in Low Power

* 10: Hs DAC in Low Power

* 11: Hs DAC and Hs DAC drivers in Low Power

[HsHP] (Headset high pass filter)

This high pass filter is enabled by driver normally.

If you want more low freq sound,disable it.

To enable control:

To tweak:

* 0: Headset high pass filter disabled (defualt)

* 1: Headset high pass filter enabled (offset cancellation enabled)

[ClassDDithHPGain]

ClassD is a kind of amplifier.

According to the documents,our ClassDs only relate to Handsfree(speaker).

To enable control:

To tweak:

* Gain control for the high pass component of dithering filter

* 0000: Minimum gain

* ....:

* 1010: Maximum gain (default)

[ClassDDithWGain]

* Gain control for the white component of dithering filter

* 0000: Minimum gain

* ......:

* 1010: Maximum gain

[ClassDHiVol]

This is a gain of speaker.But +2dB only. :(

echo 1 > classdhivol_con

Say 1(default) to enable:

* In fact,our speaker is right channel only!

[MicXGain] doesnt work...I will add more in the future.

How to calculate the binary values?

We use HsXDigGain as example.

The gain step is "+1".

In binary: So the values will like these:

0+1 = 1 | 0001: +7 dB

1+1 = 10 | 0010: +6 dB

10+1 = 11 | 0011: +5 dB

11+1 = 100 | 0100: +4 dB

..... | ......

[Experts!]:

This method can work on any ab850x codec platform!

Play music,reduce the volume.

Now we are going to edit the codec registers.

E.G:

AnaGain3:

HsDigGain: (left/right channel)

Disable all lowpow mode:

* These hacks will restore when codec power off.

( Touch Booster control )

What is touch booster?

It can jump the cpufreqs(in fact,not only cpufreqs) to high value when you touch to improve the experience of touching.

Disabling this can save some power.

To disable: (default: enable)

To change the boost freq: (default: 800000) (Vaild: 200000,400000,800000,1000000)

( Touch Sensitivity control )

If you play some games like Temple Run,higher sensitivity might help.

To change: (stock: 22) (default: 17) (range: >0)

* Lower value,higher sensitivity.

* Turn on/off screen to apply the changes

* Parameter "threshold" to check the changes

* When charging,the threshold will be forced replace by threshold_chrg

* With high sensitivity,your touches can be applied even screen coveres something.

( Fsync control )

To disable fsync: (0=disable 1=enable)

* Disabling fsync can improve io performace,

but it can make the data which hasnt been written lose when a sudden poweroff comes.

* Disabling fsync or enabling dyn_fsync will make param driver fail to store data

That means your "reboot recovery" will be failed.

To enable dynamic fsync:

* Dynamic fsync will sync all buffers when screen turns off,

* If there is a heavy io load,the screen might stick for seconds.

* This is an experiment feature.

( WiFi suspend pm control )

To enable: (default: disable)

* Enable=PM_FAST (Faster) Disable=PM_MAX (Powersave)

( Mali GPU )

Mali debug level

Disabling can speed up a bit

* Higher level,more messages will be printed in dmesg,system will slow down

Mali L2 max reads control: (Stock:28kb,Default:48kb(max))

* Some values will slow down graphics

* If not sure,keep default

Mali PM sampling rate: (Default: 1000ms)

Mali PP scheduler tweaks: (Default: disable)

* Enabling this,Some places will over ahead,choose by your self

Mali Utilization sampling rate: (Stock:500ms,Default:1000ms)

How often report a mali utilization.

* Keep this default if unsure.

Mali Utilization control

(Default: low_to_high 192 high_to_low 64)

This probably will relate to the smoothness.

Our driver will report a mali utilization frequently.

This utilization(range: 0~255) means the load of mali.

If utilization is bigger than low_to_high,driver will request higher hardware performance(highest APE/DDR OPP).

If utilization is smaller than high_to_low,the driver will store the requested OPP(uses low OPP).

OPP can be understood as freq simply.

To check mali utilization values:

Then you will see the utilization it reports.

When it says SIGNAL_HIGH,it will request highest OPP.

When it says SIGNAL_LOW,it will request lowest OPP.

Press Ctrl+C to stop printing.

In my Temple Run,it seldom reaches low_to_high(192).

That means you can reduce low_to_high to trigger higher OPP requirement.

For smoothness and less powersaving:

Set low_to_high between 100-192.

( TCP congestions )

Supported:

To check all the available options:

To change to other option:

* I use YeAh

* In fact,every congestion is disigned for different environments.

* Google to learn deeper!

( EGL Driver )

To remove sw egl driver:

Edit /system/lib/egl.cfg

To

* According to my feelings: after removing sw egl driver,UI is faster

( Service Mode )

In dialer, type:

Secret code:*#197328640*# (service mode)

Secret code:*#9900*# (SysDump)

In SysDump:

Disable fastdormancy might help 3G standby time (Depends on your mobile base station)

* Google to learn more

RAM DUMP is a debugger.Most of us wont use it.So disable it. (Tap it,every tap will make a reboot,until it shows you "Disable....",then tap disable,it is disabled)

* Google to learn more about secret code

( Multi-core scheduler )

What is it? How does it work?!

(Default: 2) (Echo 0/1/2)

0 : No power saving load balance.

1 : Fill one thread/core/package first for long running threads.

2 : Also bias task wakeups to semi-idle cpu package for power savings.

( Logcat )

Well,we have made android logger(logcat) as module to free more RAM.

Some guys request logcat.

Now we provide you a workaround:

Create a new init.d script:

Then you can use logcat command.

Almost tweaks will be restored to default after reboots.

So you can make your tweaks as init.d scripts to apply them when boots. :laugh::laugh::laugh: