Javatpoint Logo
Javatpoint Logo

TLP Ubuntu

Introduction to TLP

TLP is a feature-rich utility of the command line for Linux, saving the battery power of the laptops without the requirement for delving deeper into logical details. The default settings of TLP are already used for battery life, so we may only install and forget it. TLP is customizable to fulfill our specific needs.

Note: TLP will take care of the bulk of the settings that powertop --autotune will.

Important: TLP is a pure utility of the command line. It doesn't include a GUI.

Working of TLP

What TLP generally does is pull kernel settings that impact power consumption.

Kernel settings

Every kernel setting is of a volatile quality. The state resides in RAM at the time of runtime and the kernel gives no endurance for them. The kernel makes a default state and modifications have to be reused on all boots by a tool, i.e., userspace upon boot. TLP is the userspace tool.

Almost all kernel settings, TLP implements, are sent to user space that are the files /sys/ (sysfs nodes). The result of tlp-stat will display the paths.

Note: Not every sysfs node displayed by tlp-stat is actually affected by TLP if using settings, a few are shown for diagnostic or information purposes only.

TLP Profiles

TLP offers two independent groups of settings known as profiles, one for AC operation and one for the battery. It means that TLP must use the appropriate profile, not just at the booting time, but also at all times the power source modifies.

Event-driven architecture

The actions of TLP are event-driven for achieving each of the above. The below events will let settings be used:

TLP Ubuntu
  • AC powered (charger plugged in)
    Uses the profile of AC settings.
  • Battery-powered (charger unplugged)
    Uses the profile of BAT settings.
  • UCB device plugged in
    Starts the auto-suspend mode of USB for the devices (when not denylisted or excluded).
  • Boot (system startup)
    Uses the settings profile related to the power source BAT/AC. Uses switches Bluetooth and charge thresholds, WWAN, and Wi-Fi devices relying on our individual settings.
  • Power off (system shutdown)
    Switches or saves the state of WWAN, Wi-Fi, and Bluetooth devices and disables the auto-suspend mode of USB relying on our individual settings.
  • System reboot
    Similar to shut down, after that proceeds with the start-up.
  • Laptop undocked/docked (Radio Device Wizard) or WWAN, Wi-Fi, LAN disconnected/connected
    Disables or enables built-in WWAN, Wi-Fi, and Bluetooth devices relying on our individual settings.
  • System resume through ACPI Sleep States S3 to S4
    Uses the settings profile related to the power source BAT/AC. Restores Bluetooth and charge thresholds, WWAN, and Wi-Fi device states relying on our individual settings.
  • System suspend through ACPI Sleep States S3 to S4
    Saves the states of WWAN, Wi-Fi, and Bluetooth device and shut down the removal of optical drives relying on our individual settings.

Important: TLP will not create adaptive or dynamic modifications to the settings behind the events is specified above. TLP will never alter the settings because of the battery charge level, CPU load, or else in particular.

Note: TLP doesn't monitor the above-mentioned events itself but depends on a variety of system daemons, such as NetworkManager, systemd, and udevd. Therefore, TLP doesn't contain a daemon and there's no permanent background process of TLP displaying up in the result of ps.

Features of TLP

The settings, i.e., power saving are organized into two different profiles, enabling us to adjust performance and savings independently for AC and battery (BAT) operation.

TLP Ubuntu
  • Dirty buffer timeouts and kernel laptop mode
  • Scaling of processor frequency containing "turbo core" and "turbo boost".
  • Limit min/max state for controlling power consumption of Intel CPUs
  • Intel CPU performance/energy policies HWP, EPB, and HWP.EPP dynamic boost
  • APM (short for advanced power management) level of hard disk and spin down timeout
  • Platform profile for controlling performance/power levels, fan, and thermal speed
  • ALPM (short for AHCI link power management) with device denylist
  • Runtime power management of AHCI for USB/SATA/NVMe disks and SATA ports
  • Runtime power management for bus devices, i.e., PCle
  • ASPM (short for Active State Power Management) of PCle
  • Frequency limits of Intel GPU
  • Wi-Fi power saver
  • AMD GPU power management
  • Disable/enable integrated WWAN, Wi-Fi, and Bluetooth devices
  • Audio power save
  • Other settings for power-saving- separate from the power source- are as follows:
  • The state of WWAN and Bluetooth is restored after hibernate/suspend
  • Immobilize Wake-on-LAN
  • Radio Device Wizard: disable/enable radio under network dock/undock and connect/disconnect
  • Restore the state of the radio device on boot (using the previous shut down)
  • Disable and enable radio devices (WWAN, Wi-Fi, and Bluetooth) upon shut down and boot
  • USB auto-suspend using device allowlist/denylist
  • I/O scheduler

The settings for batting care are:

  • Charge recalibration and thresholds

Settings of TLP

The introduction describes how the settings of TLP are formed, the parameter syntax applied and how to modify them.

The other sections specify every setting of TLP:

TLP Ubuntu
  • Operation
  • Audio
  • Battery Care Vendor Specifics
  • Battery Care
  • Controllers and Disks
  • Drive Bay
  • Graphics
  • File System
  • Kernel
  • Platform
  • Networking
  • Processor
  • Radio Device Wizard
  • Radio Device Switching
  • USB
  • ASPM and Runtime Power Management
  • Trace Mode

Introduction

The introduction describes how the settings of TLP are formed, the Parameter Syntax, the Config File, and Making Modifications.

TLP Ubuntu

Config Files

The 1.3 and higher versions of TLP

The 1.3 version of TLP introduced and increased the configuration scheme the settings are read from the below files in the described sequence:

  • Underlying defaults
  • /etc/tlp.d/*.conf: Customization drop-in snippets, read in alphabetical (lexical) sequence
  • /etc/tlp.conf: Configuration of the user

The 1.2.2 and lower versions of TLP

  • Every setting is stored in the /etc/default/tlp config file.

Profiles

TLP applies two different profiles of settings that are automatically used relying on the power source:

  • The parameters completed with _BAT are impressive if executing on battery
  • The parameters completed with _AC are impressive if AC is connected

The parameters were completed neither with _BAT nor with _AC used for both profiles.

Parameter Defaults

Two types of parameters are available:

  • Parameters without underlying default
  • Parameters with underlying default

Parameter Syntax

Config files comprised of comment lines and parameters:

Comment lines

The line's content starting with a '#' symbol in the initial columns completely ignored:

#What is described here doesn't matter.

Clear lines are also ignored.

After parameters, comments are not permitted, the entire line will be ignored silently:

EXAMPLE="doesn't apply like it" # Parameter is informed in the front!

Parameter lines

The values of the parameter including blanks should be enclosed within the double quotes:

Making Modifications

The config file can be modified with a text editor (but root privileges are required).

For example:

Every modification should be activated by deleting the leading '#' symbol and will take impact only the below after saving a file

  • Unplugging or plugging AC
  • after a reboot
  • With the command
    $ sudo tlp start

Operation

TLP Ubuntu

TLP_ENABLE

It will be set to 0 for disabling TLP (reboot required).

Default if unconfigured: 1

TLP_DEFAULT_MODE

It defines the default operation mode (BAT or AC) of TLP when a power source can't be detected. Concerns a few embedded hardware and desktop only.

TLP_WARN_LEVEL

The 1.4 and higher versions

It manages how warnings of invalid settings are delivered:

Disabled- 0

Background tasks (resume, boot, power source change) report to the journal/syslog- 1

Shell commands informed to the terminal- 2

Combination of 1 and 2- 3

Default if unconfigured: 3

Audio

N- the controller will remain active

Y- the power of the controller using the sound chip

Default if unconfigured: Y

Battery Care

In the 1.3 and lower versions, it is known as "Battery Features".

The aim of Battery Care on several laptops is to decrease the capacity loss because of the wear from the growing battery operation, i.e., to amplify the battery lifespan. It can be done by:

  • Stop charge threshold: Limiting the level of maximum charge to below 100%
  • Stop charge threshold: Prevent the process of charging after a discharge from continuing the charger is connected
  • Recalibration: Supports keeping charge level battery runtime and readings estimates correct by setting new "full discharge" and "full charge" anchors within the battery controller

Battery Care doesn't consist of extra power saving.

Battery Care Vendor Specifics

The battery care support level relies on the laptop brand and vendor, TLP version, and Linux kernel version.

Prerequisites

To use charge control recalibration or thresholds using TLP:

  • The hardware should have the capability
  • A kernel driver should make these capabilities applicable under Linux

There are two different options to obtain kernel drivers:

  • Drivers that are managed in the mainline kernel of Linux and shipped with all distributions. Automatically, they are loaded on many supported laptops and don't need any user action.
  • "External kernel drivers" are not part of the mainline kernel of Linux and need the user for installing distribution-specific and additional packages. This case only uses to ThinkPads and is specified in installation.

Note: When the hardware doesn't have the capability or no applicable driver exists, the TLP battery care can't control it.

Controllers and Disks

DISK_APM_LEVEL_ON_AC/BAT

Set the option, i.e., "Advanced Power Management Level". Some possible values lie between 1 and 255.

A few selected values are as follows:

1- Minimum performance/maximum power saving.

Note: This setting might lead to enhanced disk drive tear and wear due to excessive head uploading of read-write.

  • 128- Compose between wear and power saving
  • 192- Prevents extreme head uploading of a few HDDs
  • 254- Maximum performance/minimum power saving
  • 255- Disable APM (doesn't supported by a few models of the disk)
  • Keep- Unique value for skipping this setting for a particular disk

Default if unconfigured: "254 254" (AC), "128 128" (BAT).

Values for more than one disk are isolated with blanks.

DISK_DEVICES

Specifies the disk devices on which the below parameters act. More than one device is isolated with blanks.

Default if unconfigured: "nvme0n1 sda"

The device name's assignment by the kernel (sdb, sda) can possibly change if using the second disk that is in the Drive Bay.

Drive Bay

This aspect enables to the shutdown of removable optical drives included in:

  • MediaBay
  • UltraBay (ThinkPads)
  • Other sorts of bay

BAY_DEVICE

It is the device for an optical drive.

Default if unconfigured: sr0

BAY_POWEROFF_ON_AC/BAT

0- the active optical drive

1- power off an optical drive

Default if unconfigured: 0

Installing TLP on Ubuntu

For Linux, TLP is a tool for Advanced Power Management. It provides a default configuration that is used for battery life. It's highly customizable to fulfill particular user requirements at a time.

TLP supplies isolate setting profiles for battery and AC power and can disable or enable WWAN and Wi-Fi radio devices under system startup. It gives a unified way for configuring the charging threshold and the battery recalibrate for every model which supports it (by acpi-call or tp-smapi) for ThinkPads.

On Ubuntu, there are three different ways of installing TLP. We can use aptitude, apt-get, and apt. In the below sections, we will specify all methods. We can select one of them.

Installing TLP with apt-get

We need to first update the database of apt with the help of the below command:


TLP Ubuntu

After updating the database of apt, we can now install TLP with apt-get by executing the below command:


TLP Ubuntu

Installing TLP with apt

We will update the database of apt with the help of the below command:


TLP Ubuntu

After updating the database of apt, we can now install TLP with apt by executing the below command:


TLP Ubuntu

Installing TLP with aptitude

We can skip this method if we already used the above methods. If we wish to follow this method, we might first require to install aptitude because aptitude is not by default installed on Ubuntu. We need to update the database of apt using aptitude with the help of the below command:

After updating the database of apt, we can install TLP with aptitude by executing the below command:

Uninstalling TLP on Ubuntu

We can run the following command for uninstalling the TLP package only:


TLP Ubuntu

Uninstalling TLP and Dependencies

We can use the following command for uninstalling TLP and all dependencies that are not required by Ubuntu:


TLP Ubuntu

Remove Data and Configuration of TLP

To remove data and configuration of TLP from Ubuntu, we can run the following command:


TLP Ubuntu

Remove Data, Configuration, and Dependencies of TLP

To remove data, configuration, and dependencies of TLP, we can execute the below command:


TLP Ubuntu





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA