[Galaxy S Advance I9070 Original Android Developmen] cocafe:
3. HOW TO

( WiFi PM Mode )

We can tweak WiFi screen-off PM mode now.

PM FAST is used by default to speed up, PM MAX is used to save power

To switch to PM_MAX:

( MMC SPI CRC )

Disabling SPI CRC can improve mmc performance (10%)

But phone may freeze randomly.

( Real charged notification )

Well, please let me call it notification.

To be honest, it needs to check manually.

( 6.8-) For old versions

* You can use Root Explorer to view these files in /sys/kernel/abb-chargalg

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

But it is not the real full charged.

* When it says the real EOC reached, unplug the charger.

* According to my experiments, it needs 1-2 hours to charge to real full after it shows you 100%

( POnKey Emulator )

Because my power key is going to break, so I need this feature.

This is the software emulator of power key.

To turn off screen: ( 20 < value(ms) < 520 )

To active the power menu: ( 520 < value(ms) < ∞)

To use Vol.Up or Vol.Down key as Power Key:

* It doesn't work in suspend expect in charging.

( ABBamp Audio )

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

Too high volume can make your external speakers/headset overload or damage them.

( 6.8-) Old versions,please see here

Credit: Aditya(Adi_Pat)

First, why do i call it `AMP`?

Because most of our tweaks are about gain(volume)

Our codec is simple, It doesn't have any hardware EQ (although i want...)

ABBamp sysfs entries are in:

* Use RootExplorer to view this folder,there are lots files

Tweaks will take effects immediately!

Most tweaks will accept inputs like "on", "off" (no quotes)...

So, say "on" to enable this tweak, then this tweak will apply the value stored/inputed

View(cat) these files, most of them will give you useful infomation about this tweak.

They will show you the volume in dB of gain

`cd` to /sys/kernel/abb-codec first then do echos, will be more convenient.

[AnaGain3] (Headset analog gain path):

Enable tweaks:

Disable tweaks:

Gain control: (min:0 ,max: 15) Lower value,higher volume (default: 0[+4dB])

Write both left and right channels:

[HsLDigGain] (Headset left digital path gain)

Enable tweaks:

Disable tweaks:

Gain control: (min:0 ,max: 15) Lower value,higher volume (default: 4[+4dB])

[HsRDigGain] (Headset right digital path gain)

Enable tweaks:

Disable tweaks:

Gain control: (min:0 ,max: 15) Lower value,higher volume (default: 4[+4dB])

Headset Volume Table:

* If set up digital path +4dB, analog gain +4dB, the result will get over +8dB

[HsLowPow] (Headset driver low power mode)

This lowpow mode is enabled by device normally.

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

You can disable it.

Enable tweaks:

Disable tweaks:

To tweak the mode (0: disable LP mode, 1: enable LP mode)

[HsDacLowPow] (Headset DAC low power mode)

DAC is Digital-to-Analong Converter.

This lowpow mode is enabled by device normally.

Enable tweaks:

Disable tweaks:

To tweak the mode (0: disable LP mode, 1: enable LP mode)

[HsHpEn] (Headset high pass filter)

This high pass filter is disabled by device normally.

Enable this can reduce some sub-nosie of audio.

Enable tweaks:

Disable tweaks:

To tweak the mode (0: disable highpass filter, 1: enable highpass filter)

Besides, the file anaconf1 will shows you the status of LPA

[ClassDHPG] (ClassD high-pass gain)

ClassD is a kind of amplifier.

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

This can increase the high frequences sound of speaker

Enable tweaks:

Disable tweaks:

Gain control: (min:0 ,max: 10) higher value,higher gain (default: 10[Max gain])

[ClassDDithWGain]

Gain control for the white component of dithering filter

Enable tweaks:

Disable tweaks:

Gain control: (min:0 ,max: 10) higher value,higher gain (default: 10[Max gain])

[ADDigGain2]

This is the audio path of mic2(phone mic, not headset mic)

This tweak will enable automatically when mic2 is enabled by device

Enable tweaks:

Disable tweaks:

Gain control: (min:0 ,max: 63) lower value, higher gain (default: [+6dB], max: 00[+31dB])

[EarDigGain]

This is the digtal gain of earpiece

Enable tweaks:

Disable tweaks:

Gain control: (min:0 ,max: 15) lower value,higher gain (default: 4[+4dB])

* It uses the same path of HsLDigGain,please check the volume table of HsLDigGain

* +8 dB might crash the sound of earpiece

[ShortCirConf]

This is a misc tweak

View shortcir this file first

* The first ?? the slot of each option,the second ?? stands for the value to write to this slot

* View shortcir this file,you will get it ;)

[AnaConf4]

This interface controls the enables of analog path

We can use it to disable Speaker in kernel level.

So that you don't have to use the "mute all sound" in system settings,

Because, "mute all sound" will also mute Earpiece, which is inconvenient for us in calls.

Command format: Check anaconf4 first, This interface is a bit different from others:

echo [Index] [Disable?] > anaconf4

To Disable Speaker:

To Enable Speaker:

[Headset Charge Pump]

[Lower-power Audio Mode]

[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.

( Camera LED Flash )

Burning LED mode for assistive light,

turning this on for a long time will heat up your device, be careful!

Enable/Disable:

( Touch Booster control )

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

I have disabled by default to save power.

( 9.8+)

To enable: (default: disable)

To change the boost freq: (default: 400000, stock: 800000)

* I reduced this to get a balance between performance and battery.

* If you feel lagged, set it 800000

* Disabling cpufreq requirement: echo 0 > /sys/kernel/mxt224e/touchboost_freq

To disable DDR/APE requests:

To adjust the delay of canceling touch booster:

* The bigger value, the longer boost time. 500ms by default.

( Touch Parameters(Sensitivity included) control )

(7.0+)

This threshold(touch sensitivity) control is the real one.

* When the threshold value is too big, touchscreen will lose responses.

* When the threshold value is low (<10), air touches will appear!

* When the threshold value is too low (<7), mxT224E calibration will fail,

and the points may fly here and there on the screen (signal is too noisy).

TIP: Enabling `Show Point Location` in Developer Settings to debug the touches

In the same folder, numtouch_t48 is the max number of touch fingers.

Movefilter is the filter which decides move sensitivity

Advanced users:

Read the configs document of mxT224E

Check T?? config, and calculate the address of the value.

To write configs of mxT224E:

For example, T48_BASEFREQ is the value of reporting input events frequency (lower value higher freq)

Its address is 3 in config T48

( Sweep2Wake )

This is the sweep2wake implementation of mxT224E + ABB-POnKey.

Sweep2wake means, you can wake up your phone via sliding the screen.

Sweep2wake uses wakelock by default, namely, your device won't go deepsleep with it enabled.

So we recommended that use this feature in charging (Home key is too hard to press) (When in charging, phone is waking always)

Enable/Disable:

Tweak the threshold of sliding:

( Touch2Wake )

Touch touchkey to wake up device.

Touch2wake uses wakelock by default, namely, your device won't go deepsleep with it enabled.

So we recommended that use this feature in charging (Home key is too hard to press) (When in charging, phone is waking always)

Enable/Disable:

( Touchkey LED )

We can disable Touchkey LED in kernel level now.

( Fsync control )

( 6.8-) For old versions

( 6.8+)

Get current status:

FSYNC modes:

Disable FSYNC:

* Disabling fsync can improve io performace,

but it can make the data which hasnt been written lose when a sudden power cut occurs.

Enable Dynamic FSYNC:

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

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

* This is an experimental feature.

( S6E63M0 Color Tweaks )

There are three files named main_?

For example, we tweak the red color here

* RGB default values are 24(R) 8(G) 36(B)

* Valid values range from 0 to 255

* Recommend you tweak it slightly

If you want to reset the settings:

( 6.8-):

( 6.8+):

( S6E63M0 Gamma Mode )

( S6E63M0 LCD Clock )

( S6E63M0 Brightness Control )

Change directory first:

Let me clear the panel brightness for you:

The brightness of our panel is depends on gamma

The gamma is generated according to illumination value

We have 26 levels of gamma, means we have 26 illumination values too

So the brightness in system like 1 and 6 are the same brightness in kernel driver(converted),

Because 1 and 6 are in the same gamma level.

Check the file gamma_table to see, the gamma valeus are the same

Unlocked brightness:

In non power saving mode,

We allowed 255 brightness uses the maximum gamma level(25) in kernel driver

In power saving mode,

The maximum brightness can be set is around 230(not 255).

illumination:

This can control this brightness of panel

You can write any value to it, maximum proper illumination is 300

To disable tweaks:

* The minmum illumination panel supports is 1

* Illumination 0 and 3 has color issue!

illumination_table:

View this file first,there are 26 slots

Current: [??] ??? Shows you which index is using

The index0 is the minimum brightness(namely in power saving mode).

You can tweak every level of illuminations now.

Tweak index0 can modify the dimming brightness of system

For example:

Tweak index0 illumination:

* 0 is the index

* 10 is the value

* If you are in power saving mode now,the brightness will change!

Ultra low brightness: (When PowerSaving mode in System Settings is ON)

We use index 00 as brightness when PS mode is ON. You can change the index as you like.

To disable:

( Night mode / Sunlight mode )

Nightmode is darker than illumination value 1.

( 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)

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:

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.

You can reduce low_to_high to trigger higher OPP requirement.

For smoothness and less powersaving:

Set low_to_high between 100-192.

Mali max preemptive allocated max memory size:

Default is 16mb(16*1024*1024), bigger max size more throughput.

But when this value is too big, no more throughput.

For example: 48mb = 48*1024*1024

Mali OS Kernel memory allocation order:

The lower value, the higher preference of allocating OS memory.

The default value is 6, I decreased it to 9 to fix OS memory allocation failure.

If you feel laggy, try 6 (default by driver)

( TCP congestions )

Supported:

To check all the available options:

To change to other option:

* I use veno

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

* Google to learn more!

( EGL Driver )

To use Mali hardware egl driver only:

Edit /system/lib/egl.cfg

To

Then remove libGLES_android.so

* Recommend to backup these files

* In case it cannot boot,use TWRP file manager to recover changes

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

( Logcat )

( 6.8-) See here

( 6.8+) We support to load logger mode at early init now!

Just create a new file(empty file) named logger in /data

When this file exists,kernel will load logger.ko for you automatically

Member [MENTION=5093942]KINGbabasula[/MENTION] made a flashable zip to enable logger

( Vibrator )

To disable vibrator fully:

( F2FS )

Now userdata partition (/data) supports mounting by F2FS.

F2FS is designed and optimized for nand flash, normally, it is faster than EXT4 filesystem.

Recommended for experienced users, be careful, don't type a wrong partition number.

1. Reboot to recovery, connect to PC, use ADB commands:

2. Backup the data partition as a tarball

cd /data
tar -cvf /external_sd/data.tar *

3. Now umount /data, we gonna format it (umount all mount points of mmcblk0p5)

umount /data /sdcard

4. Format the data partition (Do not type a wrong partition number, it is dangerous!)

cd /dev/block
mkfs.f2fs -l userdata mmcblk0p5

5. Now restore the data tarball

mount -t f2fs -o rw /dev/block/mmcblk0p5 /data
cd /data
tar -xvf /external_sd/data.tar

6. Then reboot system

1. Reboot to recovery, connect to PC, use ADB commands:

2. Backup the data partition as a tarball

cd /data
tar -cvf /external_sd/data.tar *

3. Now umount /data, we gonna format it (umount all mount points of mmcblk0p5)

umount /data /sdcard

4. Format the userdata partition

mke2fs -T ext4 -L userdata /dev/block/mmcblk0p5

5. Mount the userdata partition, and restore the data tarball

mount -t ext4 -o rw /dev/block/mmcblk0p5 /data
cd /data
tar -xvf /external_sd/data.tar

6. Reboot system

( CRT off-screen effect )

Thanks frapeti for porting this.

You need to enable fbearlysuspend control first.

* frapeti recommended 350ms

( Miscellaneous )

To shut down phone forcefully:

To refresh battery stats:

Workaround for losing responsive Samsung Official Camera (This is not kernel related)

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: