How To Set Charge Thresholds For Some Huawei MateBooks, LG Gram, Lenovo, Samsung Or ASUS Laptops On Linux With TLP

TLP is a command line advanced Linux power management tool that helps save laptop battery power. It’s designed to install and forget about it, TLP taking care of everything automatically. TLP is highly configurable though, so you can tweak it to suit your specific needs, either to manual editing of its configuration file (/etc/tlp.conf), or by using TLPUI, a third-party GUI for TLP.

With version 1.4, TLP has added support for setting start and/or stop charge battery thresholds for some laptops: ASUS, Huawei MateBooks, LG Gram, Lenovo (now for non-Thinkpads too; Thinkpads have been supported for a while) and Samsung. This article explains how to use this TLP feature to set start and/or stop thresholds in case you own a supported laptop.

Limiting the battery charge level helps prolong battery lifespan. By setting a battery stop charge threshold, you limit the maximum charge level to below 100%. Some laptops also supports setting a battery start charge threshold, which prevents the charging process from continuing as soon as the charger is connected, after a short discharge.

According to the TLP 1.4.0 release notes, the following laptops / battery charge thresholds are supported:

  • ASUS laptops: stop threshold
  • Huawei MateBooks: start and stop threshold
  • LG Gram laptops: stop threshold at 80% aka “battery care limit”
  • Lenovo (non-ThinkPads) laptops: stop threshold at 60% aka “battery conservation mode”
  • Samsung laptops: stop threshold at 80% aka “battery life extender”

TLP already had support for Thinkpad start and stop charging thresholds. It’s also important to note that not all the laptop brands mentioned above support setting a charge threshold (you’ll also need to be using a fairly recent kernel). To see if your laptop supports this, see the prerequisites section below.

For ASUS laptops, you can also easily set charging thresholds using a command line tool called bat.

Prerequisites

Before proceeding, you’ll obviously need to have TLP 1.4.0 or newer installed on your system. See this page for installing TLP on various Linux distributions, including Arch Linux, Debian / Ubuntu (and Pop!_OS, Linux Mint, etc.), Fedora, openSUSE, etc.

To see if your ASUS, Huawei MateBooks, LG Gram, Lenovo or Samsung laptop supports start and/or stop charge battery thresholds (with TLP >= 1.4.0 installed), run:

sudo tlp-stat -b

This command displays various battery information for your laptop, including if it supports charge start and/or stop thresholds. 

For example, this is the output of this command on my ASUS Zenbook:

--- TLP 1.4.0 --------------------------------------------

+++ Battery Care
Plugin: asus
Supported features: charge threshold
Driver usage:
* natacpi (asus_wmi) = active (charge threshold)
Parameter value range:
* STOP_CHARGE_THRESH_BAT0/1: 0(off)..100(default)
...........................................

As you can see from this output, the laptop supports stop charge thresholds (STOP_CHARGE_THRESH), which can have a value between 0 and 100 (with 0 meaning to disable this feature).

It’s also worth noting that some ASUS laptops silently ignore charge thresholds other than 40, 60 or 80, so if setting a different value doesn’t work for you, try one of these 3 values.

Now that we know the laptop supports setting a battery stop charge threshold and the supported values, we can proceed to set battery charge thresholds.

How to set battery charge thresholds for ASUS, Huawei MateBooks, LG Gram, Lenovo and Samsung laptops on Linux using TLP

There are 2 ways of setting a battery charging threshold for your laptop running TLP. Either using TLPUI, a graphical user interface for TLP, or by manually editing the TLP configuration file.

Using TLPUI

If you don’t already have TLPUI installed, see its installaton page. For Ubuntu and Ubuntu-based Linux distributions (Pop!_OS, Linux Mint, etc., you can install it from the Linux Uprising Apps PPA).

In TLPUI, click on ThinkPad Battery in the sidebar. This is called like that because until version 1.4, TLP supported setting battery charge thresholds only for ThinkPads, and I guess the TLPUI developer forgot to change it. But despite its name, this is also for some ASUS, Huawei MateBooks, LG Gram, non-ThinkPad Lenovo and Samsung laptops.

TLPUI battery charge thresholds

There you can set charge thresholds for the main battery (BAT0 – this is for the main battery, even if the laptop battery is called BAT1, BATT, etc.) and/or for the auxiliary/Ultrabay battery (BAT1).

It’s important to note that you must set both a start and a stop charge battery threshold. If your laptop doesn’t support start thresholds (only Huawei MateBooks and Lenovo ThinkPads support this), or you don’t want to set a start charge battery threshold, enable (check the box next to it) the start charge threshold option but set it to 0 (disabled).

Make sure to only use a charge battery threshold value supported by your laptop, as reported by the sudo tlp-stat -b command.

Remember to click the Save button when you’re done to save the new configuration and apply it.

Editing the TLP configuration file

If you don’t use TLPUI, you can set charging thresholds for your ASUS, Huawei MateBooks, LG Gram, Lenovo and Samsung laptops on Linux by editing the TLP configuration file.

Start by opening /etc/tlp.conf as root with a text editor. Scroll down to START_CHARGE_THRESH_BAT. There’s you’ll find start and stop charge threshold settings for BAT0 and BAT1. BAT0 is the main battery, even if your laptop’s battery has a different name (e.g. BAT1, BATT, etc.), and BAT1 is for the auxiliary/Ultrabay battery.

Uncomment (remove the # symbol from the beginning of the line) for both START_CHARGE_THRESH_BATx and STOP_CHARGE_THRESH_BATx for the battery you want to enable charge thresholds for (BAT0 or BAT1), then set their values to the start/stop values you want to use. 

Important:

  • make sure the battery charge thresholds values you set are supported by your laptop (as reported by sudo tlp-stat -b)
  • if your laptop doesn’t support setting a battery start charge threshold, or you don’t want to use a start charge threshold, set the START_CHARGE_THRESH_BATx value to 0 (which disables it)

When you’re done setting the battery charge thresholds, run the following command to validate the parameters and configuration, and report any errors:

sudo tlp setcharge

Example output from my ASUS Zenbook:

Setting temporary charge threshold for BAT0:
  stop =  60 (no change)

Posted by WordPress Guru