TLP Developer Documentation


  1. Get the Source Code
  2. Components
  3. Files
  4. Makefile
  5. Dependencies
  6. System Startup
  7. Architecture
  8. Installation Scripts
  9. Testing
  10. Changelog
  11. Links

This document addresses programmers and packagers and is intended to support packaging of TLP for Linux distributions.

If you just want to install and use TLP, please continue reading here.

Get the Source Code

TLP's source code is available on GitHub. The repository holds the following branches:

Obtain the current development version with

git clone git:// TLP
cd TLP

Checkout a release version with

git checkout VERSION

Download release tarballs here.

The current changelog for the development version is here.

Building Debian Packages

1. Install the package

2. Checkout the master branch (see above).

3. Populate debian/ with

git checkout debian/current -- debian ## or debian/legacy
git rm -r --cached debian

4. Edit debian/changelog to your needs (optional).

5. Build binary packages with

dpkg-buildpackage -b -tc -i.git


TLP consists – aside from manpages and docs – solely of POSIX compatible shell scripts (i.e. without bash extensions) and perl scripts.

TLP is installed as two packages:


FilePackageTarget directory or file Purpose
49tlptlp/usr/share/pm-utils/sleep.d/ Script invoked by pm-utils upon suspend and resume, calls tlp resume/suspend. Replaces 49bay and 49wwan.
de.linrunner.tlp.metainfo.xmltlp/usr/share/metainfo AppStream metadata
defaulttlp/etc/default/tlp TLP settings file for both tlp and tlp-rdw
thinkpad-radioswtlp/etc/acpi/events/ [until 0.8] Catch ThinkPad wireless radio switch (the slide switch, not the Fn+F5 key!) event. Prerequisite: kernel with CONFIG_ACPI_PROC_EVENT=y
thinkpad-radiosw.shtlp/etc/acpi/ [until 0.8] Script to handle ThinkPad wireless radio switch event
tlptlp/usr/sbin/ TLP main program
tlp.bash_completiontlp/usr/share/bash-completion/completions/tlp bash completion rules
tlp-functionstlp/usr/share/tlp-pm/ TLP main function library
tlp.inittlp/etc/init.d/tlp SysV init script to be invoked upon system start/shutdown: calls tlp init start/stop to apply power save settings, switch radio devices and set the battery thresholds.
tlp-noptlp/usr/share/tlp-pm/ Dummy script – delivers rc=0.
tlp-pcilisttlp/usr/bin/ Report runtime pm settings for PCIe devices; called by tlp-stat
Note: install to /usr/sbin/ if lspci is in /usr/sbin/
Script to turn radio devices on and off (soft links to the same file)
tlp-rf-functlp/usr/share/tlp-pm/ Function library for the radio devices
tlp.rulestlp/lib/udev/rules.d/85-tlp.rules Added usb devices: call tlp-usb-udev
Start commands conditionally depending on the power source (soft links to the same file)
tlp.servicetlp/lib/systemd/system/ Service to be invoked upon system start/shutdown by systemd: calls tlp init start/stop to apply power save settings, switch radio devices and set the battery thresholds.
tlp-sleep.servicetlp/lib/systemd/system/ Service to be invoked by systemd upon suspend and resume: calls tlp resume/suspend to apply settings.
tlp-stattlp/usr/bin/ Status report with all effective settings
tlp-usb-udevtlp/lib/udev/ Handle added usb devices: enable usb autosuspend
tlp-usblisttlp/usr/bin/ Report usb settings; called by tlp-stat
tlp.upstarttlpn/a Upstart script (currently not used)
tpacpi-battlp/usr/sbin/ ACPI calls for advanced battery functions of Sandy Bridge and newer ThinkPad models (X220, T420, et al.). Script written by Elliot Wolk.
man/*tlp distribution dependent Manpages – installation and target directory are distribution specific and therefore not included in the Makefile.
tlp-rdw.rulestlp-rdw/lib/udev/rules.d/85-tlp-rdw.rules Dock/undock events: call tlp-rdw-udev
tlp-rdw-udevtlp-rdw/lib/udev/ Handle dock/undock events
tlp-rdw-nmtlp-rdw/etc/NetworkManager/dispatcher.d/ Network manager hook for ifup/ifdown events
Makefilen/an/a Installation of scripts and config file to their respective target dirs; see section Makefile below
changelogtlpdistribution dependentChangelog for TLP – the target directory is distribution specific and therefore it is not installed by the Makefile.
READMEtlpdistribution dependent README file for TLP – the target directory is distribution specific and therefore it is not installed by the Makefile.
AUTHORSn/adistribution dependent List of developers / contributors
COPYINGn/adistribution dependent Copyright information:
– the target directory is distribution specific and therefore it is not installed by the Makefile
– Installation of this file (or inclusion in a distribution specific template) is mandatory
LICENSEn/adistribution dependent GPL v2 license text

Table 1: Contents of the source archive



install-tlpInstall files for package tlp
install-rdwInstall files for package tlp-rdw
installInstall files for tlp and tlp-rdw
install-manInstall manpages
uninstall-tlpUninstall files for package tlp
uninstall-rdwUninstall files for package tlp-rdw
uninstallUninstall files for tlp and tlp-rdw
uninstall-manUninstall manpages
checkbashismsCheck all shell scripts

Table 2: Makefile targets


The Makefile accepts the parameters below. Default values apply when a parameter is not given.

ParameterDefault valueValues / Purpose
DESTDIR(empty)Prefix for all install directories
TLP_BIN/usr/binInstall directory
TLP_SBIN/usr/sbinInstall directory
TLP_TLIB[until 0.9] /usr/share/tlp-pm
[from 1.0] /usr/share/tlp
Install directory for TLP's function libs
TLP_ULIB/lib/udevInstall directory for udev scripts
TLP_CONF/etc/default/tlpInstall directory for TLP's configuration
TLP_RUN/run/tlp[from 1.1] Directory for runtime data (volatile)
TLP_MAN/usr/share/man[from 0.9] Install directory for manpages
TLP_META/usr/share/metainfo[from 1.1] Install directory for AppStream metadata
TLP_ACPI/etc/acpi[until 0.8] Install directory for ACPI scripts
TLP_NMDSP/etc/NetworkManager/dispatcher.dInstall directory for NM scripts
TLP_SHCPL/usr/share/bash-completion/completions[from 0.8] Install directory for bash completion rules
TLP_NO_BASHCOMP01=do not install tlp.bash_completion
TLP_NO_INIT01=do not install tlp.init
TLP_NO_PMUTILS01=do not install 49tlp, tlp-nop
TLP_NO_TPACPI01=do not install tpacpi-bat
TLP_SYSD/lib/systemd/system[from 0.6] Install directory for systemd units
TLP_SYSV/etc/init.d[from 1.0] Install directory for sysvinit script
TLP_WITH_SYSTEMD0[from 0.6] 1=install systemd unit files

Table 3: Makefile parameters


TLP depends on (or conficts with) the tools described below. They should be implemented as package dependencies.

Package tlp



Kernel module needed for advanced battery functions of Sandy Bridge and newer ThinkPads models (X220, T420, et al.). Do not implement via direct package dependency.



Used to disable wake on lan.



Needed for hard disk advanced power management and to show information in tlp-stat.



Needed for wifi power save, replaces deprecated iwconfig (see wireless-tools below).



There can only be one power management tool.



Used to show distribution/release in tlp-stat.



Provides lspci used to show PCI(e) devices in tlp-stat.


conflicts or mandatory

pm-utils provides it's own set of power management scripts in /usr/lib/pm-utils/power.d/ that compete with TLP's functionality. Depending on the target distribution there are two ways to deal with this:

Important: see the Architecure section for details.



Needed for switching radio devices on and off.



Used to show hard disk drive SMART data in tlp-stat (smartctl).



Kernel modules needed to implement battery functions on ThinkPads. The implementation of the package depends considerably on the target distribution and therein on the kernel variant. It is therefore not useful to suffice the dependecy via a direct package dependency.



Provides lsusb used to show USB devices in tlp-stat.



Provides dmesg for ALPM warnings in tlp-stat.



Needed for wifi power save (iwconfig); only if iw and rfkill (see above) are not available.



Linux kernel version specific tool contained in the kernel tree (tools/power/x86). Needed to set performance versus energy savings policy for the CPU.

Hint: Ubuntu provides it via the metapackage linux-tools, the Debian package of the same name however does not contain it. Your mileage with other distributions may vary.

Package tlp-rdw



Provides libraries tlp-functions and tlp-rf-func.



Used to hook ifup/ifdown events and to determine corresponding interface type lan/wifi/wwan.

System Startup


The sources contain the unit tlp.service, which calls tlp init start/stop upon system startup/shutdown. Use the TLP_WITH_SYSTEMD Makefile switch to install it.


The package install process must link the sysvinit script tlp.init i.e. /etc/init.d/tlp to the necessary runlevels by means of the target distribution.

Other init system

In case the target distribution does support neither systemd nor sysvinit, you have to program a script that calls tlp accordingly:

tlp init start|stop|restart|force-reload|status

The parameter after init is checked by tlp.


There is no TLP daemon. TLP is event based and depends on other system daemons.

The call architecture is as follows:

Change of Power Source

udevd: detects by an udev rule in tlp.rules when the power supply is plugged or unplugged and calls tlp auto upon each change.

Suspend (Hibernate) / Resume Cycle

There are two possible variants to satisfy different distributions' requirements:

Installation Scripts

As already mentioned in the pm-utils section above, it is necessary to mask pm-utils' scripts located in /usr/lib/pm-utils/power.d/. To achieve this, an empty script with identical name is put in /etc/pm/power.d/. For transparency this is done with symlinks to /usr/share/tlp-pm/tlp-nop.

Important: the symlinks must be removed when uninstalling the tlp package.

Post Installation Script (tlp)

# Mask conflicting pm-utils hooks
if [ -d /usr/lib/pm-utils/power.d ] && [ -d /etc/pm/power.d ]; then
    for i in 95hdparm-apm disable_wol hal-cd-polling intel-audio-powersave harddrive \
             laptop-mode journal-commit pci_devices pcie_aspm readahead sata_alpm \
        if [ -x /usr/lib/pm-utils/power.d/$i ]; then
            # Executable hook in /usr/lib/pm-utils/power.d/ exists
            if [ -f /etc/pm/power.d/$i ]; then
                # Exclude symlinks to tlp-nop
                if ! readlink /etc/pm/power.d/$i | egrep -q 'tlp-nop$' ; then
                    # Move aside superseding hook of same name in /etc/pm/power.d/
                    mv -n /etc/pm/power.d/$i /etc/pm/power.d/$i.tlp-save
            # Make a soft link to tlp-nop in /etc/pm/power.d/
            # to disable corresponding hook /usr/lib/pm-utils/power.d/
            ln -sf /usr/share/tlp-pm/tlp-nop /etc/pm/power.d/$i

# Mask conflicting upstart jobs (Package rfkill in Ubuntu)
for i in /etc/init/rfkill-*.conf; do
    if [ -f "$i" ] –– [ ! -f "${i%.conf}.override" ]; then
        # Do this only when no .override exists
        echo "manual" > ${i%.conf}.override

# Mask conflicting systemd services
for i in $(ls /lib/systemd/system 2> /dev/null | egrep "systemd-rfkill"); do
    systemctl mask $i 2> /dev/null || true

Post Removal Script (tlp)

# Unmask pm-utils hooks
for i in 95hdparm-apm disable_wol hal-cd-polling intel-audio-powersave harddrive \
         laptop-mode journal-commit pci_devices pcie_aspm readahead sata_alpm \
         sched-powersave usb_bluetooth wireless xfs_buffer; do
    if readlink /etc/pm/power.d/$i | egrep -q 'tlp-nop$' ; then
        rm /etc/pm/power.d/$i

# Unmask conflicting upstart jobs (Package rfkill in Ubuntu)
for i in /etc/init/rfkill-*.override; do
    [ ! -f "$i" ] || rm -f $i

# Unmask conflicting systemd services
for i in $(ls /lib/systemd/system 2> /dev/null | egrep "systemd-rfkill"); do
    systemctl unmask $i 2> /dev/null || true


Installed packages should be tested with trace mode enabled:

TLP_DEBUG="bat disk lock nm path pm rf run sysfs udev usb"

See Trace Mode.











Dependencies, Sources