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 🙂