I had already blogged on how to limit battery charge on LG Gram in Linux. In that post, you had to manually set the threshold “80” in the file “/sys/devices/platform/lg-laptop/battery_care_limit”.
With TLP, the procedure is easier and more automatic.
First, you must install tlp (remember that tlp conflicts with power-profiles-daemon, so you have to disable the latter first or uninstall it). In Arch-based distros:
1 |
sudo pacman -S tlp tlp-rdw |
Ensure that the tlp service is enabled on boot and the first time you should start it (“sudo systemctl start tlp”).
By running “sudo tlp-stat”, you should see near the end this line:
1 2 3 4 5 6 7 |
+++ Battery Care Plugin: lg Supported features: charge threshold Driver usage: * vendor (lg_laptop) = active (charge threshold) Parameter value range: * STOP_CHARGE_THRESH_BAT0: 80(on), 100(off) -- battery care limit |
Edit the file “/etc/tlp.conf” and uncomment the following lines (note there’s one also for the start of charging, but that option doesn’t seem to be supported in this laptop):
1 2 |
START_CHARGE_THRESH_BAT0=75 STOP_CHARGE_THRESH_BAT0=80 |
Restart the service (“sudo systemctl restart tlp.service”), and it should be already active (run “tlp-stat” again):
1 |
/sys/devices/platform/lg-laptop/battery_care_limit = 80 [%] |
That’s all. This will persist on reboot. However, this will not persist if you hibernate and return from hibernation (unless you restart the tlp service as shown above).
Why would you want to set the maximum charge to 80%?
To improve battery life. Limiting the charging helps with that.
Hi, in TLP 1.6 threshold will be restored after hibernate:
https://github.com/linrunner/TLP/commit/7be4b52896e626c2aba32e49c78b288199b511be
Thank you for the update, and thank you for your software 🙂
In KDE 5.27 you can set this through “System preferences > Energy settings > Advanced energy settings”. There’s an option “Charge limit” which you can set to 80% instead of the default 100%. Setting any other value will set the default 100%.
I just found out about this option, so I still have to experiment what the starting charge threshold would be, but my first guess is that it’s 79% or even 80% by default. Anyway, as it’s mentioned in the post, the start charge threshold probably doesn’t do anything for this laptop.
Hi. KDE has had that setting for a long time, but it was not available for this laptop until a few months ago, if I remember correctly. Yes, you can set the charge limit also with that KDE setting 🙂
However, TLP sets that automatically be default, while KDE forgets about that setting if you reboot. At least, that’s what happened the last time I tried.
Thank you for the reply, Lorenzo! Indeed I noticed that same “feature” some days later, and I have just noticed today that you made a blog post about it (https://www.lorenzobettini.it/2022/03/limiting-battery-charge-on-lg-gram-in-linux/). Sadly it’s not persistent across reboots!
I’ll use your method described in this post from now on 🙂
I think that the Arch wiki shows a systemd service that you can enable at boot time so that it sets that value automatically.