[KERNEL][4.4.302] Swan2000 Kernel for the LG V20

Search This thread

ROMSG

Senior Member
Since I don't play any games anymore on my phone since Clash Royale many, many years ago, the most intensive thing that I do it's occasionally video-calling via Telegram FOSS. But let me tell about my history with this V20 H990DS

I bought this device used, and the seller said that the battery needed to be replaced, and randomly it gave me green-screen reboot messages when below 30% and the thermals wasn't great because it was the end of summer here in Brazil. Since everywhere that I searched about buying new LG batteries anyone tells that it's hard to find a real original and reliable I decided to try this one from Aliexpress, and also ordered some copper shims (0.5mm and 0.6mm) to put thermal paste and improve things. And a 128GB SDcard since it was cheap now (compared to years ago... I tested with H2testw and it works perfectly)

So the battery arrived first, and even before it arrived I installed the Lineage 19 and with the new 4.X Kernel it almost never gave me more green-screen reboots, but few random reboots when below 35%.

With Lineage 18 + SwanKernel Extreme gave the most stable scenario but only one time I did try to video-call with Telegram and it went stable, but slow (probably due underclock, maybe?)

But last Friday using the new battery I tried to video-call through Telegram some relatives that live abroad, and with only 5 minutes of calling it rebooted and was warm-ish? So the copper shims arrived early that week and I decided to do the thermal mod this week.

With the 0.6mm it pressed the LCD giving a darker spot, so I decided to replace with the 0.5mm, put new thermal paste and try again... So no dark spot on the screen.

I installed Telegram on other computer and tried to call and test the V20, but it still reboots after some time, but the strange thing it never reaches 62 or higher.

I tried the CPU Throttling Test to test the thermals and it barely reaches 60 with the Extreme+Gaming or with only Extreme as well.

So after all of this, I remember that H990DS have the reputation for drawing a lot of power:

1) Even a "compatible non OEM" battery can't provide what this device demands in terms of power consumption?

2) Having a dual-sim gives me freedom in terms of separate personal-work calls etc and not having to carry 2 phones. Could a dual sim card adapter could be a better approach?

3) There's a chance that this H990DS motherboard it's problematic/defective somehow and replacing with another H990DS would fix things (or even a H990 non-DS with that dual-sim adapter)?

4) The random reboots could give some useful information somehow for you devs? And how the best way to collect it?

5) Are video-calling that demanding, even if it don't reach the same temperatures that the pure CPU stress?

6) Any tips, suggestions?

Thanks!


PS: @xxseva44 sorry I couldn't give you the logs, but the instability/problems here are taking much more time that I initially planned.
Try using smartpack kernel manager (root required) and set the CPU frequency on the big cores to 1.8ghz and 1.5ghz on the little cores. The H990DS variant in particular tends to have higher peak power draw than other variants in situations where cell reception is poor. Which can cause instability. Underclocking the CPU seems to help.
 
  • Like
Reactions: dextructor

AShiningRay

Senior Member
Sep 1, 2021
252
223
Xiaomi Redmi Note 4
LG V20
First of all, have you checked the battery's capacity and general data through AccuBattery or another similar app? It's a good way to see if the voltages and current are right.

Charge it 5 or so times from 20% to 80% (though charging anything more than 50% should work) and see what it reports on battery health, assuming you didn't do that already of course.
 

dextructor

Senior Member
Aug 21, 2007
237
81
set the CPU frequency on the big cores to 1.8ghz and 1.5ghz on the little cores.
I did that and I couldn't tell from my type of usage that I noticed any slowdown on my device, but unfortunately didn't "solve" the issue. Underclock can help to consume less battery and I'm using the Extreme variant of this Kernel that should be undervolted , but thanks for the suggestion.

First of all, have you checked the battery's capacity and general data through AccuBattery or another similar app? It's a good way to see if the voltages and current are right.

Charge it 5 or so times from 20% to 80% (though charging anything more than 50% should work) and see what it reports on battery health, assuming you didn't do that already of course.
I've heard of AccuBattery in the past, but never really installed until now.

Well of all 3 batteries that I have (1 OEM and 2 from Aliexpress) only the OEM can really charge to 100%, the others varies, sometimes using chargers from LG, Samsung (that it's compatible with QC 2.0) and a plethora of cables the batteries reaches 70% to 85% and stop charging.

I installed the AccuBattery Pro and tested in different scenarios from the CPU Throttling Test consuming ~1400 and with AnTuTu Stress reaching ~2050, but after a while stabilized in ~1400.

When tested with video-call with Telegram the measure from AccuBattery was ~2300 even 2415 and dropped eventually to ~1900.

So this H990DS can't handle this type of power consumption, the battery that's the culprit? Or just "bad luck" in general?
 

Draknodd

Senior Member
Aug 5, 2019
51
10
Hi,

I did more test with the safe kernel variant to avoid the bcl throttling and get good performance.

First of all I set at boot with smartpack kernel manager:
1- max CPU freq 1998mhz
2- Disabled bcl running a sh script "echo disable > /sys/devices/soc/soc:qcom,bcl/mode"

In this way the CPU clock is not constantly throttled at 1036mhz (bcl is triggered despite the battery % and the battery is a 10000mah with health at 88% measured with accubattery)

The folkowing screenshits are the result with throttling test to check if temperatures are under control and the result of geekbench 6.
Compared to other lg v20 present in the geekbench database this result is above average (and very high is you consider that the phone is underclocked)
My theory is that the bcl is not reading the battery values correctly or it is not configured properly since with this setup I don't have any kind of reboot or sign of instability.

Screenshot_20230605-020309_CPU Throttling Test.png
Screenshot_20230605-023322_Geekbench 6.png
 

Attachments

  • Screenshot_20230605-020309_CPU Throttling Test.png
    Screenshot_20230605-020309_CPU Throttling Test.png
    233.6 KB · Views: 6

AShiningRay

Senior Member
Sep 1, 2021
252
223
Xiaomi Redmi Note 4
LG V20
The weird thing is that according to qcom's documentation, the way it is currently set up should throttle the phone once the battery reaches critical levels, if it is triggering no matter what and the battery in question is confirmed to be good, i think the most sensible explanation is that bcl behavior changed in 4.4, but qcom's docs weren't updated to reflect that (you'd be surprised with the amount of times this has happened before), because bcl reads from the same sensors your apps do, so what you see there is what bcl also gets.

I'll see if i can spare some time in the coming days to take another shot at BCL, something doesn't look right.
 

Draknodd

Senior Member
Aug 5, 2019
51
10
@AShiningRay Hi, I saw that you did more tweaking on the kernel (check on your github) regarding the BCL. Will there be a new beta release so that I can give some feedback?

Another thing that I noticed is that the GPU freq is stuck at 133mhz with the default governor. Setting the simple_ondemand governor with power level of 4 has reduced the animations lag and the freq now scales with the load. Do you know why this might happen?
 
  • Like
Reactions: dextructor

AShiningRay

Senior Member
Sep 1, 2021
252
223
Xiaomi Redmi Note 4
LG V20
@AShiningRay Hi, I saw that you did more tweaking on the kernel (check on your github) regarding the BCL. Will there be a new beta release so that I can give some feedback?

Another thing that I noticed is that the GPU freq is stuck at 133mhz with the default governor. Setting the simple_ondemand governor with power level of 4 has reduced the animations lag and the freq now scales with the load. Do you know why this might happen?
Those BCL tweaks were pushed fairly late in the night over here (and G5+G6 only received it right now), so i didn't have time to actually build everything yet, but yes, there will be a new build soon... probably the last one before LOS 20 arrives, given how little has been changed on the kernel lately.

As for GPU frequency, that's definitely not normal, and also doesn't happen here. If it kept stuck at 133 with the default governor, it wouldn't rank on the upper echelon of msm8996 devices on 3dmark. What does happen is that msm-adreno-tz is fairly more conservative than simple_ondemand, so most UI tasks aren't enough to ramp the GPU up... we thought of increasing the minimum frequency to 214MHz in order to improve UI performance, but it didn't seem necessary for LOS-19.1 when the phone isn't bogged down by BCL, and also because the GPU is by far the most power-hungry processor on the phone, despite the CPU being the hothead.
 
  • Like
Reactions: dextructor

Draknodd

Senior Member
Aug 5, 2019
51
10
Those BCL tweaks were pushed fairly late in the night over here (and G5+G6 only received it right now), so i didn't have time to actually build everything yet, but yes, there will be a new build soon... probably the last one before LOS 20 arrives, given how little has been changed on the kernel lately.

As for GPU frequency, that's definitely not normal, and also doesn't happen here. If it kept stuck at 133 with the default governor, it wouldn't rank on the upper echelon of msm8996 devices on 3dmark. What does happen is that msm-adreno-tz is fairly more conservative than simple_ondemand, so most UI tasks aren't enough to ramp the GPU up... we thought of increasing the minimum frequency to 214MHz in order to improve UI performance, but it didn't seem necessary for LOS-19.1 when the phone isn't bogged down by BCL, and also because the GPU is by far the most power-hungry processor on the phone, despite the CPU being the hothead.
I'll keep an eye on the releases on github then.

About the GPU that's actually nice to ear, I noticed that ondemand is really power hungry. I'll check the gpu frequency while doing some benchmark then. If I find is still laggy I could just decrese the powerlevel from 6 which is the default to 5 (I have a perfine 10500mah battery so a bit more of battery drain does not really concern me).
 

AShiningRay

Senior Member
Sep 1, 2021
252
223
Xiaomi Redmi Note 4
LG V20
06/17/2023 build is up!

BCL should be behaving better now and random reboots will likely be far reduced in quantity (at least it is for the internal team including me), and if it isn't, there's not much else that can be done to mitigate it on the kernel, LGE's USB and power stack on stock is far too different and messy to feasibly implement on 4.4.

That BCL change will also show up on the next LOS build.
 
Last edited:

Draknodd

Senior Member
Aug 5, 2019
51
10
06/17/2023 build is up!

BCL should be behaving better now and random reboots will likely be far reduced in quantity (at least it is for the internal team including me), and if it isn't, there's not much else that can be done to mitigate it on the kernel, LGE's USB and power stack on stock is far too different and messy to feasibly implement on 4.4.

That BCL change will also show up on the next LOS build.
Everything seems to be good with this build.
I'll stress the phone in particular when the battery is low (<30%) and report back!
 

loyukfai

Senior Member
Jan 29, 2010
70
12
Those BCL tweaks were pushed fairly late in the night over here (and G5+G6 only received it right now), so i didn't have time to actually build everything yet, but yes, there will be a new build soon... probably the last one before LOS 20 arrives, given how little has been changed on the kernel lately.

As for GPU frequency, that's definitely not normal, and also doesn't happen here. If it kept stuck at 133 with the default governor, it wouldn't rank on the upper echelon of msm8996 devices on 3dmark. What does happen is that msm-adreno-tz is fairly more conservative than simple_ondemand, so most UI tasks aren't enough to ramp the GPU up... we thought of increasing the minimum frequency to 214MHz in order to improve UI performance, but it didn't seem necessary for LOS-19.1 when the phone isn't bogged down by BCL, and also because the GPU is by far the most power-hungry processor on the phone, despite the CPU being the hothead.
Sorry for off topic, but do you mean Los 20 will be available soon?
 

dextructor

Senior Member
Aug 21, 2007
237
81
I realize that when upgrading to the latest versions of Lineage there's a retention script that reinstall Magisk every time so I don't need to flash again after updates.

Did you or anyone on the team analyzed the viability of applying such methods to this custom kernel? What are the downsides?

I know that it's always a thing to balance: convenience and reliability, but I was curious about this topic.
 

AShiningRay

Senior Member
Sep 1, 2021
252
223
Xiaomi Redmi Note 4
LG V20
I realize that when upgrading to the latest versions of Lineage there's a retention script that reinstall Magisk every time so I don't need to flash again after updates.

Did you or anyone on the team analyzed the viability of applying such methods to this custom kernel? What are the downsides?

I know that it's always a thing to balance: convenience and reliability, but I was curious about this topic.
That's not possible on a kernel flashable for a variety of reasons. Magisk survives dirty flashes because its addon scripts aren't placed on /system or /boot, partitions that are usually overridden on a ROM update. The kernel on the other hand is that exact /boot partition once flashed.

So the only way to allow for a similar functionality for kernel zips would be to hard-code a path on /data where the flashable zip must go into, add that path into an addon.d script and make it so the script will only automatically reinstall the kernel after flashing a rom (how you would detect that a rom is being flashed and not another kernel or whatever, i don't know).

It's just too much work for little to no gain, with a risk of causing trouble for users on top of that.
 
  • Like
Reactions: dextructor

dextructor

Senior Member
Aug 21, 2007
237
81
It's just too much work for little to no gain, with a risk of causing trouble for users on top of that.
I've imagined that wouldn't be worth the trouble, but since the lack of technical information about this topic wasn't very clear to me.

Anyway, thanks for the clarifications as always and the good job on the kernel
 

FeNo2

Member
Feb 26, 2014
34
8
San Diego, CA
I have an H918 with stock/rooted 20h firmware. Last night I did a backup (thankfully) and tried to boot after installing this kernel and it seemed to hang at the pink Tmobile boot screen. I let it sit there for a couple minutes and nothing happened. I just did a restore and I'm back in business.

I used H918_v0.1-BETA8-Swan2000-Safe.zip
 

ROMSG

Senior Member
I have an H918 with stock/rooted 20h firmware. Last night I did a backup (thankfully) and tried to boot after installing this kernel and it seemed to hang at the pink Tmobile boot screen. I let it sit there for a couple minutes and nothing happened. I just did a restore and I'm back in business.

I used H918_v0.1-BETA8-Swan2000-Safe.zip
this kernel is for custom roms, Stock is not supported
 
  • Like
Reactions: FeNo2

Top Liked Posts

  • There are no posts matching your filters.
  • 11
    And since our V20 is the special one, it has a major feature of its own arriving soon: A completely revamped Quad-DAC Panel, including many options never seen before in any other LG device to date! (or any other device sporting an ESS DAC as far as i can tell)

    Screenshots of a bleeding edge build, courtesy of @xxseva44:
    2023-08-25-18-34-41-083.jpg
    photo_2023-08-28_21-31-16.jpg
    photo_2023-08-28_21-31-32.jpg
    photo_2023-08-28_21-31-28.jpg
    photo_2023-08-28_21-31-37.jpg
    photo_2023-08-28_21-31-19.jpg
    photo_2023-08-28_21-31-23.jpg


    I've been busy those last few days alongside him in order to pack all those features into the panel, and, so far, everything works miles better than on LOS 19.1 and the current DAC implementation on LOS 20, so stay tuned!
    8
    08/28/2023 build is up!



    Ayy, time for another one... that took a while, but it's here to (kinda) celebrate the LOS 20 release! And what better way to celebrate than with a ton of changes under the hood?

    Quick Summary:
    1. We're now using Link-Time Optimization alongside the latest GCC releases, resulting in an even smaller and more optimized kernel.​
    2. This new release now fully supports LOS 20, and that includes Bluetooth.​
    3. It now runs on the latest MSM8998 tag from lineage's repos, with a bunch of fixes on top.​
    1
    When you say Bluetooth stack changed, do you mean to Gabeldorsche? Thanks BTW, at least I've got an idea where things could be going wrong.
    No, i mean everything that does actually make a major difference on bluetooth functionality, that being kernel drivers and bluetooth firmwares.

    The only Google-centric BT changes came in with Android 13, which has a BT subsystem that's a lot stricter at enforcing capability compliance in order to simply turn it on, and it's also why we had to shuffle some BT firmwares around... just so our bluetooth firmwares and drivers weren't as much of a mess as they were before LOS 20.

    Edit: So what i'm saying is, if you're having trouble with some of your devices on anything besides LOS 19, that could very well be because we changed from BCM43xx to BRCM V4L2 from LOS 18.1 to 19.1, then back to BCM43xx on LOS 20, which is the only one that works for now.
    1
    You can read part of the discussion of the improvement and what you can expect and why.

    And of course the datasheet of our V20's DAC ES9218P that can help understand some modes and tweaks implemented, but that's not the end of your search.
    Good source. In fact, those coefficients from the custom filter are based entirely on the documentation inside that datasheet. Figured we could just expose the supported simmetries, shapes and Stage 2 coefficients to get most of the benefits without needing to explode the UI with 142 knobs to account for both stage 1's 128 coefficients and stage 2's 16. We ended up with 14 knobs since the last two Stage 2 coefficients must remain as 0 at all times.

    In short, exposing only Stage 2 coefficients allows us to give users a "default" Finite Impulse Response format provided by the pre-set Stage 1 coefficients inside the kernel driver (which are identical to the "sine phase fast roll-off" filter), while giving them the option to tune that curve for enhanced clarity, bass, mids, or a mix of those by tweaking the weights (or emphasis) the filter lays over the frequency ranges.

    By default the Stage 2 coefficients are all zeroed, so it won't apply any tweaks to the original impulse response provided by stage 1, so it will sound different from sine phase fast roll-off, which has preset values for Stage 2.
  • 11
    And since our V20 is the special one, it has a major feature of its own arriving soon: A completely revamped Quad-DAC Panel, including many options never seen before in any other LG device to date! (or any other device sporting an ESS DAC as far as i can tell)

    Screenshots of a bleeding edge build, courtesy of @xxseva44:
    2023-08-25-18-34-41-083.jpg
    photo_2023-08-28_21-31-16.jpg
    photo_2023-08-28_21-31-32.jpg
    photo_2023-08-28_21-31-28.jpg
    photo_2023-08-28_21-31-37.jpg
    photo_2023-08-28_21-31-19.jpg
    photo_2023-08-28_21-31-23.jpg


    I've been busy those last few days alongside him in order to pack all those features into the panel, and, so far, everything works miles better than on LOS 19.1 and the current DAC implementation on LOS 20, so stay tuned!
    8
    08/28/2023 build is up!



    Ayy, time for another one... that took a while, but it's here to (kinda) celebrate the LOS 20 release! And what better way to celebrate than with a ton of changes under the hood?

    Quick Summary:
    1. We're now using Link-Time Optimization alongside the latest GCC releases, resulting in an even smaller and more optimized kernel.​
    2. This new release now fully supports LOS 20, and that includes Bluetooth.​
    3. It now runs on the latest MSM8998 tag from lineage's repos, with a bunch of fixes on top.​
    6
    Swan2000KernelLogo.png


    ~~A custom kernel for (most) V20 variants~~

    Swan2000 is an android kernel based on the very latest Qualcomm 4.4 CAF sources for MSM8998 (which is also compatible with MSM8996), aiming to bring new features and updates over official kernels, and also improve LGE MSM8996 devices with some extra tuning, fixing and additional features tailored specifically for their performance characteristics and feature sets, while trying to maximize the battery life and responsiveness of those devices at the same time.

    Its name comes from a merge between Swankernel(@AShiningRay) and mk2000(@askermk2000), as they were the main heads behind this kernel's development.


    __Disclaimers__

    First and foremost: DO NOT bother official LineageOS threads with bugs if you're using this kernel, only bug reports with logs pointing to the official kernel will receive support there!!!

    Now for the usual XDA disclaimer:
    • We are not responsible for bricked devices, dead SD cards, tactical nukes being set up (with the V20 you never know), alien invasions, google spying on you, or you getting fired because the alarm app failed after you removed all traces of google services from your phone so that google couldn't spy on you.
    • YOU are choosing to make these modifications, and if you point the finger at us for somehow messing up your device despite YOU being the one explicitly making these modifications, we will laugh at you.
    • DO NOT expect support on official ROM threads if you are running this kernel. Also don't try to hide it because we will know, and we will also laugh at you.
    • Your warranty is most likely void at this point anyway, but nevertheless, it is now definitely void if you tamper with any part of your device / software.


    __Which V20 variants/models does this kernel support?__


    The kernel currently supports the following V20 variants:
    • H910 / H915
    • H918
    • H990(DS / TR)
    • LS997
    • US996
    • US996D(Dirtysanta)
    • VS995
    Those seem to cover every rootable variant thus far, but additional variants can be added in case a breakthrough happens on F800 for example.


    __What does this kernel intend to achieve?__

    The main goal here is to have a kernel that not only has extra features and improvements, but is also clean and concise, having only features that are truly needed from a kernel that will run alongside a Android 12.1-based ROMs and beyond.

    This kernel does have a battery life bias, but will still scale up to maximum performance when needed. Gaming variants basically mean that the kernel comes overclocked by default, no additional tweaking is needed.



    __Does it have any features over official?__

    Yes, quite a few. The kernel is divided into two variants and their respective gaming modes, here are the features all variants have over Lineage's 4.4 kernel:

    1. GPU and CPU/Cache Undervolt for better power efficiency on load.
    2. Almost no unnecessary debug flags on the kernel for better kernel performance.
    3. USB Fast Charge.
    4. KCAL Control (although not really needed for LOS, other custom roms might surface with the need for this)
    5. Multiple cherry-picks from different msm8996 sources with fixes and improvements to the kernel.
    6. Built with newer GCC toolchains (GCC 12) with optimized inlining and other compiler optimizations for 8996
    7. Updated LZ4 libraries for faster ZRAM
    8. Cryptographic function optimizations, slightly improving the phone's performance when calculating hashes and so on.

    The Extreme variant really only has one extra feature over the Safe variant, that being:
    1. Stronger Undervolts (i'm talking about borderline unstable undervolts here, so i really recommend that you flash the Safe variant first).

    The "Gaming" versions are basically overclocked variants of Safe and Extreme, which means they also only differ in undervolt levels.


    __Are there any bugs?__

    As of now, the only actual kernel bug the V20 and G5 have comes down to their insanely over-engineered USB ports. You can't use them as a MacBook by plugging a fully powered hub into them like you could in 3.18 yet.


    __Download & Installation__

    The folders containing each kernel variant can be found here (use Ctrl+F to search for your phone model and kernel variant, there's just too many versions to neatly organize in folders and such as it would take too much time):

    GITHUB KERNEL RELEASES

    To install the kernel, it's the standard procedure:
    1. Download the kernel you want for your device
    2. Place it into the phone's storage
    3. Boot into recovery, select it and then flash
    4. Wipe Dalvik Cache (optional, you only need to wipe it if you face random Force Closes, but it is a good practice anyway)
    5. Reboot.
    6. Use AIDA64, go into the "Android" tab and look for "Kernel Version", where it should show "4.4.302-Swan2K-...".
    7. Enjoy the experience!

    As usual, we do not take responsibility if you fail to make backups before flashing this kernel, you have been warned!


    __Changelog__

    *********** Swan2000 V0.1-BETA8+ ***********
    Small release with BCL tweaks for all devices, some msm8998 merges and minor hotspot fixes for G6.
    _________________________________________

    *********** Swan2000 V0.1-BETA8 [First Release] ***********
    This one is pretty straightforward: Basically lineage's kernel with all the features and improvements listed above, plus a few additional tweaks that would take too much space to note.


    __Closing notes__

    If you have any suggestion or idea that can possibly improve the kernel, do not hesitate to share, i will try to implement it when time allows it. If there are any problems that only happen on this version of the kernel, submit a log and i'll try to look at it.

    I'll say it again: Please DO NOT bother official Lineage with bugs if you're running this kernel, only lineage's official kernel is supported over there.
    ___________________________________

    The kernel's source code can be found here. It is also shared between G5 and G6!

    And last but not least, special thanks to those that helped this major revamp on LGE_8996 become a reality by developing, testing, and even helping things indirectly, the dev community on all three phones had to come together for this:

    4
    The weird thing is that according to qcom's documentation, the way it is currently set up should throttle the phone once the battery reaches critical levels, if it is triggering no matter what and the battery in question is confirmed to be good, i think the most sensible explanation is that bcl behavior changed in 4.4, but qcom's docs weren't updated to reflect that (you'd be surprised with the amount of times this has happened before), because bcl reads from the same sensors your apps do, so what you see there is what bcl also gets.

    I'll see if i can spare some time in the coming days to take another shot at BCL, something doesn't look right.
    3
    Well, I try my best but couldn't make the Bluetooth work on Lineage OS 20, even on a clean install. Otherwise all functions that I daily need are fully working

    So @AShiningRay how can I proper report it?

    Thanks!
    now that you mention it I'm also unable to use BT
    No need to report anything, i already know what the issue is (especially if BT works with lineage's own kernel): Swan2000 needs a new release, we changed the bluetooth drivers since the last release and that made it into Lineage's kernel, but there has been no Swan2000 release with that just yet... partly because it won't work on LOS 19.1 and also because i'm in the last stages of setting up everything for the DAC overhaul.