[Honor 6X ROMs, Kernels, Recoveries, & Other Develo] cyclon1978:
CycloX Kernel for Honor 6X

This kernel works with Stock ROM EMUI 5.0 / 5.0.1, it should work with all other Nougat roms out there.

Features:

The kernel a.t.m. has one main goal: save your battery from wearing out early. Some other goodies are also included:

usb fastcharge

limit maximum charging voltage (reduce fastcharge to save battery life)

limit maximum battery voltage (reduce maximum charge to save battery life)

screen brightness minimum reduced to save energy in dark environment

upstream to Linux 4.1.48 for more stability and speed

gpu governor "scene aware" from mate 4.2 kernel as default instead of mali_ondemand

self-made hotplug created from the great cluster_plug

Installation:

do a TWRP backup

install kernel with TWRP

install any init.d solution (or use kernel adiutor mod to run init.d scripts after start of device)

Rollback:

Restore boot image with TWRP

delete /system/etc/init.d/00_setup_charger (optional, will not do anything on stock kernel)

The kernel "as it is" changes nothing, you need to control the flags i made for the charge control features. To do so i included an init.d script (system/etc/init.d) but there comes no init.d support with the kernel (you may already have that, if not use Kernel Adiutor/Mod init.d emulation or supersu with init.d support from xda). You can also opt to manually or automatically run it with something like $cripter, Tasker, etc.

So look into /system/etc/init.d/00_setup_charger and modify it, copy it, run it, etc.

Fastcharge

echo 1 > /sys/devices/platform/amba/fdf0d000.i2c/i2c-1/1-006b/fastcharge_enable

That enables fastcharge. But... if you have USB 2.0 and an older mainboard you will notice that the usb connection is very unstable. So if that happens use an USB 3.0 port or disable it:

echo 0 > /sys/devices/platform/amba/fdf0d000.i2c/i2c-1/1-006b/fastcharge_enable

What exactly happens? The device will consume up to 900mA from the USB port, so charging rate goes up to 686mA (device needs also some energy for running).

My tip here: use a widget to trigger the value so you can enable / disable it according to the computer you are currently using (if you have more than one and not all support this feature)

Terminal Voltage Limiter

echo 4200 > /sys/devices/platform/amba/fdf0d000.i2c/i2c-1/1-006b/limiter_terminal_voltage

This limits the maximum charge your battery gets. We have a LIHV battery, maximum is 4350mV. If you take it to 4200 (that is the limit of a normal LIPO battery) your battery will last a year longer or more...

I use 4150 to get extra long battery life. If you want to go on a trip and need a hundred percent full battery just do this to get the stock behaviour:

echo 4350 > /sys/devices/platform/amba/fdf0d000.i2c/i2c-1/1-006b/limiter_terminal_voltage

Valid values are 3950 - 4350 in steps of 50mV

As soon as the terminal voltage is reached the charging stops. The battery percentage will be set to 100%. You can view your real percentage with the shell command "cat /sys/bus/platform/devices/coul_core/real_soc".

4100 will charge to 76%

4150 will charge to 80% (the most recommended value)

4350 will charge to 100%

DPM Voltage Limiter

[MENTION=8242346]RedSkull23[/MENTION] found out that the fastcharge feature put some extra stress on the battery. Lets put an end to that!

So we want to charge slower to not wear out our battery. Caveat: we will lower our charging speed.

echo 4200 > /sys/devices/platform/amba/fdf0d000.i2c/i2c-1/1-006b/limiter_dpm_voltage

Stock value is amazing 4520mV, putting that on a LIPO battery can burn it really fast. But we have an advanced fastcharge control from huawei which only does it when it's save (not for battery life time).

So use a value here which is greater or equal to the value of Terminal Voltage Limiter:

4360 if you not use Terminal Voltage Limiter.

Valid values are 3960, 4040, 4120, 4200, 4280, 4360, 4440, 4520

Hotplug

Enable it

echo 1 > /sys/module/cluster_plug/parameters/active

All will run out of the box. If you're happy stop here.

Configure number of little cores in screen off mode (big cores are always off if screen is off) [1..4]

echo 2 > /sys/module/cluster_plug/parameters/max_cores_screenoff

Default is 1, increasing this will give you more power while screen is off - solves heavy cpu background tasks not running well - for example if bluetooth playback is stuttering (no, that works well but i have no real example)

Configure screen-on mode to low power consumption - only little cluster will be used if screen on

echo 1 > /sys/module/cluster_plug/parameters/low_power_mode

This will slow your device significantly down (4 little cpus while screen on, configured 'max_cores_screenoff' little cpus on while screen off) but save energy while using it. In low power mode the device will lag on games but you'll survive a multi day desert trip without charging.

There should be no fingerprint delay compared to stock (there is one but it is so short your eyes won't see it)

Configure hotplug

echo 20 > /sys/module/cluster_plug/parameters/load_threshold_down

echo 80 > /sys/module/cluster_plug/parameters/load_threshold_up

echo 50 > /sys/module/cluster_plug/parameters/sampling_time

echo 5 > /sys/module/cluster_plug/parameters/vote_threshold_down

echo 2 > /sys/module/cluster_plug/parameters/vote_threshold_up

This means the hotplug will check the cpu load every 50ms. If the load (0-100%) is above 80 we increase the vote-up, if it is below 50 we increase the vote-down.

If vote-up is bigger than 2 we online an additional core (big core preferred)

If vote-down is bigger than 5 we offline an additional core (big core preferred)

So you can control the intervall (higher -> energy saving, lower -> responsiveness).

You can change the tendency to offline or online cores ( 2 / 5 means more responsiveness compared to 5 / 5, 0 / 0 would tend to online/offline more cores in the same time -> energy consumption will be higher)

In theory it is better to online fast (responsiveness) and offline slow.

In theory it is better to online slow (energy saving) and offline fast.

Battery percentage is off, what can i do?

After playing much with the terminal voltage the device's battery percentage can be off a little bit. If you want a more exact display of calculated percentage you can do the following:

- set terminal voltage and dpm voltage temporary to stock values

- charge full

- execute "echo 1 > ./devices/platform/coul_core/reset" ("adb shell" - and "su" required)

Then wait some seconds until the command returns and enjoy a more exact percentage display.

And don't forget to restore your terminal and dpm voltage to keep your battery happy.

Credits

OpenKirin Team (i took some of your commits from LOS kernel)

RedSkull23 for the basic idea

petya230 for the motivation to look into overclocking

Kernel source code

https://github.com/cyclon1978/android_kernel_honor_berlin

Download

See download area of thread.

The two versions (LOS/STOCK) are nearly equal but there is a difference in the mmc card driver. If you use stock rom it is easy to determine the version you need (STOCK). If you use a custom rom it can be LOS based and use LOS mount point (use LOS version) but it can also be STOCK based and use stock mount point (use stock version). So just try it out, if sdcard works you got it right, else flash the other version.

XDA:DevDB Information

CycloX Kernel for Honor 6X, Kernel for the Honor 6X

Contributors

cyclon1978

Source Code: https://github.com/cyclon1978/android_kernel_honor_berlin

Kernel Special Features: Kernel focused on battery efficiency

Version Information

Status: Stable

Current Stable Version: 1.019

Stable Release Date: 2018-02-15

Current Beta Version: 2.000

Beta Release Date: 2018-02-16

Created 2017-11-02

Last Updated 2019-08-13