User Tools

Site Tools


thinkpad_battery_management

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
thinkpad_battery_management [2020/05/23 17:39]
217.62.118.23 add headings for distros
thinkpad_battery_management [2020/05/24 13:55] (current)
hankwang secure boot; suggestions for limits (40% - 75% - 80%)
Line 4: Line 4:
  
 TLP is a toolkit that can handle power saving, including support for ThinkPad-specific battery management. More info: [[https://​linrunner.de/​en/​tlp/​docs/​tlp-linux-advanced-power-management.html|TLP website]]. TLP is a toolkit that can handle power saving, including support for ThinkPad-specific battery management. More info: [[https://​linrunner.de/​en/​tlp/​docs/​tlp-linux-advanced-power-management.html|TLP website]].
 +
 +===== Recommended charge limits =====
 +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%.
 +
 +===== Secure boot =====
 +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.
  
 ===== Ubuntu, Mint, Debian ====== ===== Ubuntu, Mint, Debian ======
  
-The following steps worked on a ThinkPad E490 to set battery 1's start threshold to 75% and stop to 80%. (Mint 19.1 (based on Ubuntu 18.04), with kernel 4.15.0-48)+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   apt install tlp git wget
Line 14: Line 22:
   cp /​tmp/​tpacpi-bat-master/​tpacpi-bat /​usr/​local/​bin   cp /​tmp/​tpacpi-bat-master/​tpacpi-bat /​usr/​local/​bin
   ​   ​
-  tpacpi-bat -s start 1 75 +  tpacpi-bat -s start 1 76 
-  tpacpi-bat -s stop  1 80+  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. ​
  
-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.
  
 ===== Arch Linux ===== ===== Arch Linux =====
Line 24: Line 34:
  
   pacman -S tp_smapi   pacman -S tp_smapi
-  echo 40 > /​sys/​devices/​platform/​smapi/​BAT0/​start_charge_thresh+  echo 75 > /​sys/​devices/​platform/​smapi/​BAT0/​start_charge_thresh
   echo 80 > /​sys/​devices/​platform/​smapi/​BAT0/​stop_charge_thresh   echo 80 > /​sys/​devices/​platform/​smapi/​BAT0/​stop_charge_thresh
  
Line 31: Line 41:
   #!/bin/sh   #!/bin/sh
   # set the battery charging thresholds to extend battery lifespan   # set the battery charging thresholds to extend battery lifespan
-  echo ${2:-40} > /​sys/​devices/​platform/​smapi/​BAT${1:​-0}/​start_charge_thresh+  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   echo ${3:-80} > /​sys/​devices/​platform/​smapi/​BAT${1:​-0}/​stop_charge_thresh
  
 Make it executable and run ''​set_threshold 0 96 100''​ Make it executable and run ''​set_threshold 0 96 100''​
-Or run it with no arguments to default to BAT0, and thresholds of 40% and 80%. +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'':​ Create the systemd service in ''/​etc/​systemd/​system/​tp_smapi_set_battery_thresholds.service'':​
  
thinkpad_battery_management.1590248340.txt.gz · Last modified: 2020/05/23 17:39 by 217.62.118.23