[Kernel][CM12.1][CM13.0][LOS14.1][J500FN/F][07.10]Hotplug enabled kernel

Koloses

Senior Member
Jul 29, 2011
530
1,073
0
Zielona Góra
Code:
Your warranty is now void.
I'm not responsible for bricked devices, dead SD cards,
thermonuclear war, or you getting fired, because the alarm app failed. Please
do some research if you have any concerns about features included
before flashing it! YOU are choosing to make these modifications, and if
you point the finger at me for messing up your device, I will laugh at you.

So here it is. After testing for a few days I've decided to give out builds of CM 12.1 kernel with a little bit better CPU management.You may see improvement especially when you're not using 3G/LTE as it seems to drain battery almost as fast as before (depending on the use ofc). You'll get much better battery life on wifi though. You may tweak the settings using some kernel control apps but the recommended setup is already applied.


Features:

+ Bricked hotplug driver - turns off CPU cores if the CPU load is not big enough to need them.
+ Powersuspend - a driver that should turn off unused hardware components when screen is off
+ Quickwakeup driver - it allows some tasks to wake up the system to perform certain actions without fully resuming it
+ Min. CPU freq 200MHz (CM12.1 has it set to 800MHz but it seems we don't need it that high after disabling CRC checks)
+ Revised interactive governor target_loads to clock CPU more efficiently

Download:
Kernel:

CM12.1:


CM13:



LOS14.1:



GPU Max Frequency Limiting Scripts:
400 Mhz
475 Mhz
550 Mhz
650 Mhz

Installation:
Just flash the zip for your device in TWRP.

Changelog:

Code:
07.10.2017:
- First release rebased on @vince2678 kernel source and device trees (Will work only with his Los14.1 builds from now on, don't even try any older ROMs available)
- Added some tweaks by @Bulgaricus

24.07.2017:
- Rebased on newest LOS kernel
- Reimplemented some of tweaks previously reverted due to conflict (The most important being Display driver update, refresh rate should be better now)

30.05.2017:
- Merged upstream changes (new power hal compability etc.)

19.05.2017:
- Merged base kernel updates
- Enabled thermal core control
- Change throttling cpu temperature from 60°C to 80°C to avoid performance loss
- Enabled CPU_BOOST config
- Kernel now should boot on both LL and MM bootloaders (needs testing)

18.05.2017:
- First release for Lineage OS 14.1
- Rebased on @SoUnd001 kernel source (LOS 14.1 only)
- Drop CM1300/LOS13.0 support

02.03.2017:
- Fixed slow charging
- Cpusets tweaks for hotplug (multitasking related)


25.01.2017:
- Squashed update to 3.10.104
- Additional CPU & Battery tweaks
- Faster boot

16.01.2017:
- Major cleanup
- Tweaked recommended values
- Final release for CM12.1
- First release for CM13.0


08.01.2017:
- Added GPU OC up to 720MHz (you may change max frequency if you don't like OC or want it to be a little less thanks to the scripts included in downloads. Previous default freq was 400 MHz)
- Changed default gpu governor to simple_ondemand to avoid frequency bug described in #16

06.01.2017
- Initial release
- Added bricked hotplug driver
- Added powersuspend driver
- Added quickwakeup driver
- Changed CPU min freq. to 200MHz instead of 800MHz
- Optimized interactive's target_load

XDA:DevDB Information
Hotplug enabled kernel for Cyanogenmod 12.1/13.0, LOS 14.1, Kernel for the Samsung Galaxy J5

Contributors
Koloses, Nick Verse, ganesh varma, #Henkate, SoUnd001, vince2678, Bulgaricus
Source Code: https://github.com/hotplugj5

Kernel Special Features:

Version Information
Status: Stable

Created 2017-01-06
Last Updated 2017-10-07
 

Attachments

updesh94

Senior Member
Dec 5, 2012
500
449
83
Noida
Since most if not all of custom ROMs are similiar, this should work on RR, just try it. I'll look into overclocking later on since it's not the most needed feature and I wanted to release stable kernel first. I also plan adding adreno idler.
Yep, it's confirmed working on RR..
 

Koloses

Senior Member
Jul 29, 2011
530
1,073
0
Zielona Góra
Well, GPU overclock seems to work (3D score) . We'll see about CPU later on as it doesn't seem to have any impact other than showing time in state. I'll add GPU OC to the next build.

First screenshot is without GPU overclock, second is overclocked GPU.


Screenshot_2017-01-07-15-20-30.pngScreenshot_2017-01-07-15-12-13.png

Sent from SM-J500 CM12.1
 
Last edited:
  • Like
Reactions: JosephDM

#Henkate

Senior Member
Feb 1, 2012
3,485
3,120
253
25
フェアリーテイル
Well, GPU overclock seems to work (3D score) . We'll see about CPU later on as it doesn't seem to have any impact other than showing time in state. I'll add GPU OC to the next build.


View attachment 3994178View attachment 3994179

Sent from SM-J500 CM12.1
I got higher GPU score without overclock (879).
Benchmarks may or may not reflect the real phone performance. Personally im against OC.

Any CM kernel should work on RR as well, since RR is using cm kernel.
 

Koloses

Senior Member
Jul 29, 2011
530
1,073
0
Zielona Góra
Oh I didn't mention: First ss shows the score without OC (860) The second is OC'd (979) :D I'll test it further though because antutu is rather heavy benchmark. OC possibility will be included anyway but I'm thinking about making it enabled out of the box or not.

I did repeat it several times and just took 2 random screenshots from before and after. I'll edit the post to include that.

Sent from SM-J500 CM12.1
 
Last edited:

#Henkate

Senior Member
Feb 1, 2012
3,485
3,120
253
25
フェアリーテイル
Oh I didn't mention: First ss shows the score without OC (860) The second is OC'd (979) :D

I did repeat it several times and just took 2 random screenshots from before and after. I'll edit the post to include that.

Sent from SM-J500 CM12.1

Oh well, thats clearly an improvement :D
But im still against OC. I didnt experience any game lag when ive been playing.

OC will lead to higher temperature & battery drain. Personally, i prefer to use phone without OC, since it performs well.

Perhaps you can do a test with temperature when using CPU/GPU OC?
 

Amarius1

Senior Member
Aug 7, 2016
612
181
0
Craiova
Alright tested this kernel and it works outstanding! My battery life has been improved and I really like that I can see how the cores turn themselves off when they are not needed, in Kernel Adiutor.

Works perfectly on RR :cool:

Sent from my SM-J500FN using XDA Labs
 

Koloses

Senior Member
Jul 29, 2011
530
1,073
0
Zielona Góra
OC will lead to higher temperature & battery drain. Personally, i prefer to use phone without OC, since it performs well.
We'll see. Adreno Idler may compensate GPU OC battery drain, I need to test the temperatures too. It's only a matter of setting up default settings though because I also want to let people configure things to fit them while providing recommended configuration out of the box.


I could always apply OC out of the box and add flashable zip with init.d script to set stock frequency on boot so I won't have to build boot image twice for all the devices. Sounds fair to me.

Sent from SM-J500 CM12.1
 
Last edited:

#Henkate

Senior Member
Feb 1, 2012
3,485
3,120
253
25
フェアリーテイル
We'll see. Adreno Idler may compensate GPU OC battery drain, I need to test the temperatures too. It's only a matter of setting up default settings though because I also want to let people configure things to fit them while providing recommended configuration out of the box.


I could always apply OC out of the box and add flashable zip with init.d script to set stock frequency on boot so I won't have to build boot image twice for all the devices. Sounds fair to me.

Sent from SM-J500 CM12.1
I have tested Adreno Idler and according to latest Kernel Adiutor, it goes to 200mhz when phone is in idle so it is working fine and also i think there are less switches between GPU frequencies than before. Just like the other people, i have noticed battery improvement too using Adreno Idler. But read msm-adreno-tz governor bug below.

The GPU governor called simple_ondemand is working nice too. I searched for 1080p youtube video and GPU frequency stays at 200 always when watching a video (assuming the screen is not touched), which is great and can improve the battery alot for that task and also for reading.

Unlike simple_ondemand, msm-adreno-tz used to stay at 300-400mhz when watching same video. I havent tested yet with Adreno Idler though, but simple_ondemand seems a great choice for tasks like watching a video or reading something long.

When i tested msm-adreno-tz frequencies for first time (with the command from adreno idler thread, but the path is different for J5), i have found that msm-adreno-tz:

- use 300mhz freq when phone is in idle with screen on and on homescreen
- when you touch/keep sweeping with the finger on the screen (e.g. on homescreen), the GPU frequency goes to 200. It gets lowered instead higher LOL.


GPU MSM-ADRENO-TZ BUG, default on all kernels, both on stock and cm based roms.


If screen goes off (or you turn the screen off), then you turn it on, and then it goes off again (or you power it off) WITHOUT UNLOCKING THE PHONE AND TOUCHING THE SCREEN AFTER UNLOCK the GPU will stay at 400mhz until you turn the screen on, unlock and touch it.. This doesnt happen with simple_ondemand, where GPU stays at 200mhz always when screen is off or phone is in idle with screen on. Even if you dont have a lockscreen, the bug still persist.

GPU staying at 400mhz when screen is off, means that it will use power useless, for no reason. And also, it can lead to slower charging. I dont know how much power it use, but i know that it counts.

Unfortunately, even with Adreno Idler i see that the bug is still present. Or perhaps i havent implemented Adreno Idler properly? But i think i did.


This is the governor bug i wanted to talk about. I wanted to make a thread under general section.


I recommend simple_ondemand governor, although i see that it has more switches between GPU frequencies, it can lead to higher battery backup for tasks like watching a video or reading something long.


Im sorry for going a bit off-topic :D



EDIT:
@Koloses:

Run following commands in terminal to see the current GPU frequency, updated constantly:

PHP:
adb shell
cd /sys/devices/soc.0/1c00000.qcom,kgsl-3d0/devfreq/1c00000.qcom,kgsl-3d0
while true; do cat trans_stat; busybox sleep 0.1; done

The "*" shows the current frequency.
Total transitions = the number of total switches between frequencies.
 
Last edited:

Koloses

Senior Member
Jul 29, 2011
530
1,073
0
Zielona Góra

#Henkate

Senior Member
Feb 1, 2012
3,485
3,120
253
25
フェアリーテイル
Development talk is never ever an offtopic to me ;)

Anyway, where did you get Adreno Idler from? https://forum.xda-developers.com/an...dreno-idler-idling-algorithm-devfreq-t3134872 This seems to be an official thread regarding it and explanation of how it works seems fine. It needs powersuspend, but we have that in kernel already. I'll look into implementing it after getting home.

Sent from SM-J500 CM12.1

I got Adreno Idler 1.1 from other msm8916 kernel, as i had some troubles with the commits from the official thread ( i dont remember what troubles lol). I got PowerSuspend 1.5 from same kernel.

Im not sure if PowerSuspend is working. I enabled the debug mode, but i cant find any PowerSuspend line in dmesg, kmesg, neither logcat. But i have power_suspend folder & lib, and also i see that it is on hybrid mode, both in Kernel Adiutor and system file.

Also, in logcat (taken since boot), i see following error:

PHP:
W/libsuspend(  942): Error writing 'on' to /sys/power/state: Invalid argument
I/libsuspend(  942): Selected wakeup count
It is trying to write "on" to state file.
/sys/power/state file has two words: frezee mem.
 

#Henkate

Senior Member
Feb 1, 2012
3,485
3,120
253
25
フェアリーテイル
I got Adreno Idler 1.1 from other msm8916 kernel, as i had some troubles with the commits from the official thread ( i dont remember what troubles lol). I got PowerSuspend 1.5 from same kernel.

Im not sure if PowerSuspend is working. I enabled the debug mode, but i cant find any PowerSuspend line in dmesg, kmesg, neither logcat. But i have power_suspend folder & lib, and also i see that it is on hybrid mode, both in Kernel Adiutor and system file.

Also, in logcat (taken since boot), i see following error:

PHP:
W/libsuspend(  942): Error writing 'on' to /sys/power/state: Invalid argument
I/libsuspend(  942): Selected wakeup count
It is trying to write "on" to state file.
/sys/power/state file has two words: frezee mem.

@Koloses

I have found this in ramdisk:

init.zygote32.rc:

Code:
service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server
    class main
    socket zygote stream 660 root system
    onrestart write /sys/android_power/request_state wake
    [B][COLOR="Red"]onrestart write /sys/power/state on[/COLOR][/B]
    onrestart restart media
    onrestart restart netd

Thats why i got that error while booting, but i dont know why libsuspend is mentioned at the error. Also, there is no android_power folder.
This is on stock kernel 5.1.1.
 

JosephDM

Senior Member
Dec 12, 2016
777
358
0
Good work @Koloses !!! Keep up buddy:) Just to notify I had 31.800+ benchmark score with the well known kernel 5.1.1. of dj steve, without overheating... Personally I prefer more performance instead of battery life, so if you keep on tweak and overclock your kernel would be nice maybe a separate zip. To enable it. Have a nice day man!