[Galaxy S Advance I9070 Android Development] ChronoMonochrome:
Changelogs and features

Changelog

R5.9.1

Resolved (hopefully) deepsleep issues *

Fixed touchkey not working issue **

* tested in about 24 hours so far with ~6 hours of deep sleep on UltimateROM 6.0.1 without any issues with wakelocks.

** It seems that in r5.9 was introduced a bug - touch keys weren't working (at least, on 6.0.1) after device wake up.

R5.9

Bring up all the latest CK code from Codina kernel

Fix a severe performance issue on r5.8.2 build

BLN is finally FIXED! *

* Apparently, issues with BLN were related to Janice touchkey driver that was putting the device to sleep (when the display is off) regardless of a BLN wakelock usage. Reverting this behavior seemed to enable BLN to work.

R5.8.2

In-kernel vibrator fix for Android 6.0+

R5.8.1

PowerHAL fixes for 4.4.4

Experimental fix for CPU governor issue on 4.4.4

LCDCLK: revert to TeamCanjica kernel implementation

R5.8

Memory management hugely improved (finally LMK works properly)

Fixed powersave interface on JB 4.1.2 stock

Experimental fixes to PowerHAL on 4.4.4

LiveOPP: merged changes from refresh kernel (removed some CPU freq steps)

Dynamic: adjust tunables (same like in refresh kernel)

Possible vibrator fix on 6.0+ (not tested)

(old changelog)

R5.7.1

Initial build for janice (kernel sources based on LineageOS 15.1 kernel for Codina)

Fixed bluetooth issue on 4.1.2

Squash-reverted GPU-related code logic from CPU governor Dynamic

J4FS module code cleanup

Reverted forcing minimum CPU freq to 800 MHz

Enabled CONFIG_CPUSETS (required by Android 6.0.x+ ROMs to function properly)

Kernel Tweaks

:

(GPU/CPU undervolting and related tweaks)

Undervolting the CPU/GPU will bring battery savings but possible instability.

1) to undervolt CPU use ChronoKernel app or via init.d scripts:

echo *cpufreq* varm=xx > /sys/kernel/liveopp/arm_summary

for example, following sets voltage varm=0x10 for 200 MHz:

echo 200000 varm=0x10 > /sys/kernel/liveopp/arm_summary

or

echo 200000 varm-=10 > /sys/kernel/liveopp/arm_summary

(default varm voltage for 200 MHz is 0x1a but, code above sets 0x1a - 0xa(10) = 0x10 )

2) to undervolt GPU use init.d script:

echo x vape=yy > /sys/kernel/mali/mali_dvfs_config

Example:

echo 2 vape=0x1c > /sys/kernel/mali/mali_dvfs_config

"2" stands for DVFS idx (look at mali_boost_high/mali_boost_low).

To prevent overriding of such settings by ChronoKernel app, add line to your init.d script after GPU undervolting

chmod 444 /sys/kernel/mali/mali_dvfs_config

Don't change voltage of both GPU/CPU at the same time - otherwise if you'll get reboot if won't know what it caused. The same is for different frequencies - if you'll change voltage of too many steps you won't know which frequency caused reboot. It's not easy process, though, following method simplifies it: https://github.com/mkaluza/i9070_kernel_CoCore-E/wiki/Undervolting-janice .

3) Custom LiveOPP table.

By default some LiveOPP steps such as 100, 200, 500 ... MHz aren't used. You can re-enable those by following way:

echo 200000 enable=1 > /sys/kernel/liveopp/arm_summary

Or use CK app instead. Don't enable it unless it uses the same voltage as 400 MHz. The same is for the rest frequencies - until some of them uses same voltage, no point to enable steps with lower freq. I've added 100 MHz just to further make some tests with it once again. It can't use lower varm than 200 MHz - that's why it's disabled by default. Furthermore, not all phones well keep undervoltage, that's why 100-400 MHz steps uses same stock voltage varm=0x1a.

UPD. thanks to [MENTION=5151049]borkins[/MENTION] for this nice editor LiveOPP ARM steps: http://xdaforums.com/showpost.php?p=60311291&postcount=2921

(CPU freq management tweaks)

CPU freq. limiter for screen OFF, adjust it via:

SYSFS=/sys/kernel/cpufreq/cpufreq_limits_on_suspend
echo min=100000 > $SYSFS
echo max=400000 > $SYSFS
echo on > $SYSFS

Too low frequency may cause freezes after wakeup and sound scrathes. If you use Dynamic govermor, it make no sense to use cpufreq limiter, because Dynamic already takes care about CPUfreq usage optimization. For more, read wiki.

Input boost

This feature has been originally written by zwliew.

Not all governors support input boost. Supported governors: ondemand, interactive, conservative, ZenX, lionheart and some others. Dynamic governor has its own boost interface.

Default boost frequency is 400 MHz.

echo 450000 > /sys/kernel/cpufreq/input_boost_freq # echo '0' to disable
echo 35 /sys/kernel/cpufreq/input_boost_ms

(BackLight Notification)

To configure time intervals of BLN blinking type(bln_ondelay stands for time of blink and bln_offdelay - delay between two blinks):

echo bln_ondelay=500 > /sys/kernel/bln/blink_mode
echo bln_offdelay=6000 > /sys/kernel/bln/blink_mode

Make sure BLN enabled:

echo 1 > /sys/class/misc/backlightnotification/enabled

# to enable bln_wakelock.
echo on > /sys/kernel/bln/bln_wakelock

Use /sys/devices/virtual/misc/backlightnotification/blink_mode to changes modes.

Blink modes:

0 = no blinking

1 = blink backlight only

2 = blink backlight + rear cam flash

3 = blink rear cam flash only

(Module autoload)

Now there is a simple way to load modules at boot. Just move needed modules to /system/lib/modules/autoload and reboot device(or execute /etc/init.d/00autoload)

(DDR overclock)

This feature has been developed by me and allows you to improve DDR and GPU performance. Please note, that DDR OC might work unstable and cause filesystem corruption. Though, DDR clock of 975 MHz has been highly tested and should work fairly stable on most devices.

Overclocking DDR over 975 MHz is highly NOT recommended, especially in case if you not sure that you can deal with possible consequences.

How to OC DDR:

1) by using

this script .

2) by using Terminal Emulator(in example below 975 MHz):

echo 0x5017f > /sys/kernel/liveopp/pllddr_oc_on_suspend

This setting will be applied right after disabling screen.

(Minimum APE/DDR OPP on screen on)

This feature has been developed by me and allows to set minimum APE/DDR OPP states which are used when screen is ON. APE controls many systems such as an image, video, audio system etc. DDR OPP determines performance of DDR. Default values are APE50 and DDR50. Lower states(APE25/DDR25) reduces power consumption, but may cause graphical glitches like screen blinking or filling it by vertical grey lines. If you don't have mentioned effects, it's recommended to use APE25/DDR25:

echo ddropp=25 > /sys/devices/pri_lcd_ws2401.0/mcde_screenon_opp
echo apeopp=25 > /sys/devices/pri_lcd_ws2401.0/mcde_screenon_opp

* if you don't have folder /sys/devices/pri_lcd_ws2401.0, use /sys/devices/pri_lcd_s6d27a1 instead.

(Screen refresh rate)

This feature has been developed by cocafe and modified by me. Lower lcdclk frequency cause less power usage, but too low values makes system unusable.

Following command allows to change screen refresh rate:

echo x > /sys/kernel/mcde/lcdclk

use

cat /sys/kernel/mcde/lcdclk

to see supported lcdclk modes. Default mode is 60 Hz which is recommended in most typical cases. If you've screen tearings, blinking etc. change resresh rate mode to "60+ Hz":

echo 0 > /sys/kernel/mcde/lcdclk

(ABB charger tweaks)

added tweakable interfaces for termination current. To adjust it type(just an example):

echo 90 > /sys/kernel/abb-chargalg/termination_curr_1st
echo 70 > /sys/kernel/abb-chargalg/termination_curr_2nd

curr_2nd should be less or same as curr_1st. Lower values prolongs battery lifetime, but also slows battery charging.

Default values are curr_1st == curr_2nd == 150 mA. Please note, too low values maybe aren't usable.

(Dynamic FSync)

(Software CRCs)

(Dynamic dirty page writebacks)

This feature has been developed by Christopher83 and allows to dynamically manage the dirty page writebacks with two different intervals, one when the screen is on and another when the screen is off.

It is based on a commit of Francisco Franco, but instead of using hard coded values and of disabling at all the dirty page writebacks while the screen is on (possibility of data loss).

By using a higher interval we have better performance and less battery consumption, with a very low risk of data loss.

How to customize the dynamic dirty page writebacks feature (default disabled):

Three new procfs parameters are exposed inside /proc/sys/vm path:

- dynamic_dirty_writeback is the activation status of this feature, set 1 to enable it, set 0 to disable it and use the standard behaviour

- dirty_writeback_active_centisecs is the interval for the dirty page writebacks when the system is active (screen on), the default value is 1500 centisecs (15 seconds)

- dirty_writeback_suspend_centisecs is the interval for the dirty page writebacks when the system is suspended (screen off), the default value is 500 centisecs (5 seconds)

1) By directly editing one of the file written above inside /proc/sys/vm and setting the preferred value (note that set value will be lost after a reboot/shutdown)

2) By using Terminal Emulator (note that set value will be lost after a reboot/shutdown)

- Open Terminal Emulator

- Run this command to disable the dynamic dirty page writebacks feature

echo 0 > /proc/sys/vm/dynamic_dirty_writeback

- Or run this command to re-enable the dynamic dirty page writebacks feature

echo 1 > /proc/sys/vm/dynamic_dirty_writeback

- Run this command to set customize the two intervals (30 seconds while the screen is on, 10 seconds when the screen is off)

echo "3000" > /proc/sys/vm/dirty_writeback_active_centisecs
echo "1000" > /proc/sys/vm/dirty_writeback_suspend_centisecs

(Tweak app)

ChronoKernel settings

Thanks mars_army for this app!

Bug reports:

after experiencing a random reboot, type in terminal:

su
cat /proc/last_kmsg > /storage/sdcard0/last_kmsg.txt

report it in the thread and attach the last_kmsg.txt