Most ThinkPad models since around 2011 or so support management of the battery charging system via software. Most wear of Li-ion and Li-polymer batteries is due to charging at battery levels above 80% or leaving them plugged in. (More reading: AccuBattery documentation.) Batteries will last many more charging cycles if you charge only up to 80% rather than up to 100%.
TLP is a toolkit that can handle power saving, including support for ThinkPad-specific battery management. More info: TLP website.
A good starting point is to set the thresholds to 75%/80% (start charging when at or below 75%, stop when at or above 80%). Prior to travelling without access to outlets, you could temporarily set the thresholds to 99%/100%. For a laptop that rarely needs to be away from wall power, you could consider 40%/50%.
The kernel drivers for Thinkpad battery management are not signed and will not load if the laptop is in secure boot mode. Therefore, disable secure boot if you want to use this feature.
Once the battery limits are set, they will be retained across reboots, but not if the battery is removed temporarily. (Please add more data on which conditions exactly trigger a reset of the limits.) If you need to use secure boot, you could consider booting insecurely once to set the 80% limit.
The following steps worked on a ThinkPad E490 (Tested on Mint 19.1/19.3 (based on Ubuntu 18.04), with kernel 4.15.0-48 and a newer one)
apt install tlp git wget wget https://github.com/teleshoes/tpacpi-bat/archive/master.zip unzip -d /tmp master.zip && cd /tmp/tpacpi-bat-master && ./install.pl && cd - cp /tmp/tpacpi-bat-master/tpacpi-bat /usr/local/bin tpacpi-bat -s start 1 76 tpacpi-bat -s stop 1 81
(The values 76/81 rather than 75/80 are necessary because of an apparent off-by-one error.) The two tpacpi-bat commands need to be executed at reboot; you can create /etc/rc.local (permission 755) for that purpose.
In case of a Thinkpad with two batteries, add additional commands for battery number 2.
For a T420 running arch:
pacman -S tp_smapi echo 75 > /sys/devices/platform/smapi/BAT0/start_charge_thresh echo 80 > /sys/devices/platform/smapi/BAT0/stop_charge_thresh
Then you can create a script in /usr/sbin/
, in this example called set_threshold
:
#!/bin/sh # set the battery charging thresholds to extend battery lifespan echo ${2:-75} > /sys/devices/platform/smapi/BAT${1:-0}/start_charge_thresh echo ${3:-80} > /sys/devices/platform/smapi/BAT${1:-0}/stop_charge_thresh
Make it executable and run set_threshold 0 96 100
Or run it with no arguments to default to BAT0, and thresholds of 75% and 80%.
Create the systemd service in /etc/systemd/system/tp_smapi_set_battery_thresholds.service
:
[Unit] Description=Set Battery Charge Thresholds by tp_smapi
[Service] Type=oneshot ExecStart=/usr/sbin/set_battery_thresholds RemainAfterExit=yes
[Install] WantedBy=multi-user.target
And enable it: systemctl enable tp_smapi_set_battery_thresholds.service
You can also have it run when a battery is inserted (required acpid). Edit /etc/acpi/handler.sh
:
# some ACPI code above battery) case "$2" in BAT0) case "$4" in 00000000) ;; 00000001) /usr/sbin/set_battery_thresholds ;; # some more ACPI code
Verify your settings:
cat /sys/devices/platform/smapi/BAT0/start_charge_thresh cat /sys/devices/platform/smapi/BAT0/stop_charge_thresh
You can see the battery status (and other power management details) using tlp-stat
.
More info: Arch Wiki tp_smapi