Improve Laptop Power Management in Ubuntu 13.04 Raring/12.10 Quantal/12.04 Precise/10.04 Lucid/Linux Mint 15/14/13/and related Ubuntu derivatives
TLP is a power management tool for Linux. TLP is a pure command line tool with automated background tasks, It does not contain a GUI. It brings you the benefits of advanced power management without the need to understand every technical detail. TLP does not replace but enhance the existing power management of your Linux installation. TLP applies it's settings upon system startup and on every change of the power source.
Settings depending on the Power Source:
- Kernel laptop mode and dirty buffer timeouts
- Processor frequency scaling including "turbo boost" / "turbo core"
- Power aware process scheduler for multi-core/hyper-threading
- Hard disk advanced power magement level and spin down timeout (per disk)
- SATA aggressive link power management (ALPM)
- PCI Express active state power management (PCIe ASPM) – Linux 2.6.35 and above
- Runtime power management for PCI(e) bus devices – Linux 2.6.35 and above
- Radeon KMS power management – Linux 2.6.35 and above, not fglrx
- Wifi power saving mode – depending on kernel/driver
- Power off optical drive in drive bay (on battery)
Additional functions:
- I/O scheduler (per disk)
- USB autosuspend with blacklist
- Audio power saving mode – hda_intel, ac97
- Enable or disable integrated wifi, bluetooth or wwan devices upon system startup and shutdown
- Restore radio device state on system startup (from previous shutdown).
- Radio device wizard: switch radios upon network connect/disconnect and dock/undock
- Disable Wake On LAN
- WWAN state is restored after suspend/hibernate
- Untervolting of Intel processors – requires kernel with PHC-Patch
- Battery charge thresholds – ThinkPads only
- Recalibrate battery – ThinkPads only
Every new Linux kernel brings improvements regarding laptop power management. TLP offers many power management benefits to Linuxbased laptops without any complicated instructions. Basically TLP doesn't replace any existing power management in Linux but it improves current power management.
To install TLP in Ubuntu/Linux Mint open Terminal (Press Ctrl+Alt+T) and copy the following commands in the Terminal:
If you are using IBM Thinkpad then use following command to install (first add above PPA):
To start TLP service use following command:
To check if TLP service is working properly, use following command:
You will see such output:
+++ System Status
TLP power save = enabled
power source = ...
Complete configuration instruction are available here.
TLP Settings
Contents
- General
- File System
- Processor and Frequency Scaling
- Kernel
- Undervolting
- Disks and Controllers
- PCI Express Bus
- Graphics Cards
- Networking
- Audio
- Drive Slot / Ultrabay
- Runtime Power Management
- USB
- System Start and Shutdown
- Wireless Radio Switch
- Battery Charge Thresholds
- Radio Device Wizard
- Links
Introduction
All TLP settings are stored in the config file /etc/default/tlp. The default configuration provides optimized power saving out of the box. Some advanced features like turning off the optical drive and battery thresholds need to be activated explicitly.
The config file can be changed with any text editor (root privilege is needed). For example:
gksudo gedit /etc/default/tlp
Changes to the settings take effect after a reboot, a change of the power source or directly by
sudo tlp start
Hint: when installing updates of TLP, the package manager asks for confirmation before overwriting a changed config file with an updated version.
Parameters
Power Saving
General hints:
- Parameters ending on _AC are effective with the power supply connected
- Parameters ending on _BAT are effective when running on battery
- Parameters containing blanks must be enclosed in double quotes ("")
- Some parameters are inactive by default; remove the leading '#' to activate
General
TLP_ENABLE=1
Set to 0 to disable TLP (Reboot needed).
File System
DISK_IDLE_SECS_ON_AC=0
DISK_IDLE_SECS_ON_BAT=2
DISK_IDLE_SECS_ON_BAT=2
Values > 0 activate kernel laptop mode. Do not change this setting.
MAX_LOST_WORK_SECS_ON_AC=15
MAX_LOST_WORK_SECS_ON_BAT=60
MAX_LOST_WORK_SECS_ON_BAT=60
Timeout (in seconds) for writing unsaved data in file systems buffers to disk.
Processor and Frequency Scaling
CPU_SCALING_GOVERNOR_ON_AC=ondemand
CPU_SCALING_GOVERNOR_ON_BAT=ondemand
CPU_SCALING_GOVERNOR_ON_BAT=ondemand
Selects the cpu scaling governor for automatic frequency scaling. Possible values are ondemand (default), powersave, performance and conservative.
intel_pstate: since kernel 3.9 the new scaling driver intel_pstate is available and enabled by default on Intel Sandy Bridge (or newer) hardware. intel_pstate supports the governors powersave (recommended default) and performance only. To determine the active scaling driver, refer to tlp-stat output, section "+++ Processor".
Important: to use this setting you must disable your distribution's governor settings or conflicts will occur. See the TLP FAQ.
CPU_SCALING_MIN_FREQ_ON_AC=0
CPU_SCALING_MAX_FREQ_ON_AC=0
CPU_SCALING_MIN_FREQ_ON_BAT=0
CPU_SCALING_MAX_FREQ_ON_BAT=0
CPU_SCALING_MAX_FREQ_ON_AC=0
CPU_SCALING_MIN_FREQ_ON_BAT=0
CPU_SCALING_MAX_FREQ_ON_BAT=0
Set the min/max frequency available for the scaling governor. Possible values depend on your CPU. For available frequencies consult the output of tlp-stat, section "+++ Processor". A value of 0 means to use processor defaults.
Hint: after enabling the processor defaults a restart is required to ensure that the new setting takes.
Important: lowering the max frequency on battery power does not conserve power. The best results are achieved by the ondemand governor without frequency limits.
CPU_BOOST_ON_AC=1
CPU_BOOST_ON_BAT=0
CPU_BOOST_ON_BAT=0
Disable cpu "turbo boost" (Intel) or "turbo core" (AMD) feature (0 = disable / 1 = allow).
Hints:
- Requires Linux 3.7 and above
- A value of 1 does not activate boosting, it just allows it
- This may conflict with your distribution's governor settings
SCHED_POWERSAVE_ON_AC=0
SCHED_POWERSAVE_ON_BAT=1
SCHED_POWERSAVE_ON_BAT=1
Minimize number of used cpu cores/hyper-threads under light load conditions (1 = enabled, 0 = disabled). Depends on processor model.
Kernel
NMI_WATCHDOG=0
Activate kernel NMI watchdog timer (0 = disabled/save power, 1=enabled). A value of 1 is relevant for kernel debugging only.
Undervolting
Hint: advanced Linux skills are necessary to use this feature.
PHC_CONTROLS="F:V F:V F:V F:V"
Frequency/voltage ID pairs for the undervolting of Intel processors. Assumes that a kernel with PHC patches is installed. For more information see the PHC wiki.
Disks and Controllers
Device Assignment
DISK_DEVICES="sda sdb"
Defines the disk devices the following parameters are effective for. Multiple devices are separated with blanks.
When using a 2nd disk in a swappable drive slot or the Ultrabay, the assignment of device names by the kernel (sda/sdb) can change possibly. In this case it is advisable to do the device assignment using IDs:
DISK_DEVICES="ata-INTEL_SSDSA2M160G2GC_XZY123456890 ata-HITACHI_HTS541612J9SA00_XZY123456890"
The command
tlp diskid
shows the IDs of all attached disks.
Advanced Power Management
DISK_APM_LEVEL_ON_AC="254 254"
DISK_APM_LEVEL_ON_BAT="128 128"
DISK_APM_LEVEL_ON_BAT="128 128"
Set the "Advanced Power Management Level". Possible values range between 1 and 255.
Some selected values are:
- 1 – max power saving / minimum performance – Important: this setting may lead to increased disk drive wear and tear because of excessive read-write head unloading (recognizable from the clicking noises)
- 128 – compromise between power saving and wear (TLP standard setting on battery)
- 192 – prevents excessive head unloading of some HDDs
- 254 – minimum power saving / max performance (TLP standard setting on ac)
- 255 – disable APM (not supported by some disk models)
Different values for multiple disks are separated with blanks.
Spin Down
DISK_SPINDOWN_TIMEOUT_ON_AC="0 0"
DISK_SPINDOWN_TIMEOUT_ON_BAT="0 0"
DISK_SPINDOWN_TIMEOUT_ON_BAT="0 0"
Timeout value until the spindle motor stops when the disk is idle. Valid settings:
- 0 – disabled
- 1..240 – timeouts from 5 seconds to 20 minutes (in increments of 5 seconds)
- 241..251 – timeouts from 30 minutes to 5.5 hours (in increments of 30 minutes)
Different values for multiple disks are separated with blanks.
SSDs don't have moving parts, therefore this setting is "don't care" for them and can remain disabled.
Hint: stopping the system disk for extended periods of time is unlikely to work, because applications and system daemons wake up the disk frequently. However for a 2nd disk in a swappable drive slot or the Ultrabay that is not accessed permanently, this setting may be quite useful.
Disk I/O Scheduler
DISK_IOSCHED="deadline cfq"
Sets the I/O scheduler per disk. Possible values:
- cfq – Linux default, suggestion for both conventional HDDs and SSDs
- deadline – alternative for SSDs
- noop – alternative for SSD
Different values for multiple disks are separated with blanks.
SATA Aggressive Link Power Management
SATA_LINKPWR_ON_AC=max_performance
SATA_LINKPWR_ON_BAT=min_power
SATA_LINKPWR_ON_BAT=min_power
Sets the power management mode for the SATA links connecting disk and optical drives. Possible values:
- min_power – max power saving / minimum performance
- medium_power – compromise between power saving and performance
- max_performance – minimum power saving / max performance
PCI Express Bus
Active State Power Management
PCIE_ASPM_ON_AC=performance
PCIE_ASPM_ON_BAT=powersave
PCIE_ASPM_ON_BAT=powersave
Sets PCIe ASPM power saving mode. Available with kernel 2.6.35 and above. Possible values:
- default
- performance
- powersave
Graphics Cards
Radeon (old)
RADEON_POWER_PROFILE_ON_AC=high
RADEON_POWER_PROFILE_ON_BAT=low
RADEON_POWER_PROFILE_ON_BAT=low
Controls the graphics card's clock. Available with kernel 2.6.35 and above. Supported by the radeon driver only, not fglrx. Possible values:
- low
- mid
- high
- auto – mid on battery, high on ac
- default – uses hardware defaults, clock control disabled
Hint: this setting makes the display flicker briefly upon changing the power source.
Radeon DPM (new)
Since kernel 3.11 the new radeon dynamic power management (DPM) is available. Supported by the radeon driver only, not fglrx.
Hint: needs the kernel boot option radeon.dpm=1.
RADEON_DPM_STATE_ON_AC=performance
RADEON_DPM_STATE_ON_BAT=battery
RADEON_DPM_STATE_ON_BAT=battery
Controls the power management method. Possible values:
- battery – default on battery power
- performance – default on ac power
RADEON_DPM_PERF_LEVEL_ON_AC=auto
RADEON_DPM_PERF_LEVEL_ON_BAT=auto
RADEON_DPM_PERF_LEVEL_ON_BAT=auto
Controls the performance level. Possible values:
- auto – recommended!
- low
- high
Networking
Wifi Power Management
WIFI_PWR_ON_AC=1
WIFI_PWR_ON_BAT=5
WIFI_PWR_ON_BAT=5
Sets wifi power saving mode. Adapter support depends on kernel and driver. Possible values:
- 1 – disabled
- 5 – enabled
Hint: power save can cause an unstable wifi link.
Wake On LAN
WOL_DISABLE=Y
- Y – Wake on LAN disabled
- N – Wake on LAN enabled
Hint: after enabling a restart is required to ensure that the new setting takes.
Audio
SOUND_POWER_SAVE=1
Timeout (in seconds) for the audio power saving mode (supports Intel HDA, AC97). A value of 0 disables power save.
Hint: this setting can cause slight clicks in sound output.
SOUND_POWER_SAVE_CONTROLLER=Y
- Y – powers off the controller together with the sound chip
- N – controller active permanently
Drive Slot / Ultrabay
BAY_POWEROFF_ON_BAT=0
- 1 – power off the optical drive on battery
- 0 – optical drive powered on permanently
BAY_DEVICE=sr0
Device file for the optical drive (default: /dev/sr0).
Hints:
- Re-power the drive by releasing and reinserting the drive slot/Ultrabay eject lever; on newer models push the media eject button
- Devices other than optical drives – in particular hard disk drives – are not affected by this setting
Runtime Power Management
RUNTIME_PM_ON_AC=on
RUNTIME_PM_ON_BAT=auto
RUNTIME_PM_ON_BAT=auto
Controls runtime power management for PCI(e) bus devices. Available with kernel 2.6.35 and above. Possible values:
- auto – enabled (power down idle devices)
- on – disabled (devices powered on permanently)
RUNTIME_PM_ALL=0
Controls which PCI(e) devices are considered for runtime power management:
- 0 – only selected devices (safe default)
- 1 – all devices (experimental)
Warning: RUNTIME_PM_ALL=1 is an experimental feature, it may cause problems with reboot and shutdown.
RUNTIME_PM_BLACKLIST="00:12.3 00:45.6"
Exclude listed pci(e) device addresses from runtime power management. Use lspci to lookup the addresses (first column).
USB
USB_AUTOSUSPEND=1
Set autosuspend mode for all USB devices upon system start or a change of power source. Input devices like mice and keyboards are exluded by default. Possible values:
- 1 – enable
- 0 – disable
USB_BLACKLIST="1111:2222 3333:4444"
Exclude USB devices from autosuspend mode. Useful for devices having difficulties in waking up from autosuspend. Use lsusb to determine IDs. Multiple IDs are separated with blanks.
USB_BLACKLIST_WWAN=1
Exclude builtin wwan devices from autosuspend mode:
- 0 – do not exclude
- 1 – exclude
Note: currently works for USB IDs 05c6:* (Qualcomm), 0bdb:* (Ericsson) and 1199:* (Sierra) only.
USB_AUTOSUSPEND_DISABLE_ON_SHUTDOWN=1
Disables USB autosuspend mode upon system shutdown. This is intended as a workaround if suspended USB devices disturb the shutdown process.
System Start and Shutdown
RESTORE_DEVICE_STATE_ON_STARTUP=0
Restores radio device state (builtin bluetooth, wifi, wwan) from previous shutdown on system startup:
- 0 – disable
- 1 – enable
Hint: the parameters DEVICES_TO_DISABLE_ON_STARTUP/SHUTDOWN below are ignored when this is enabled.
DEVICES_TO_DISABLE_ON_STARTUP="bluetooth wifi wwan"
Disables builtin radio devices upon system start:
- bluetooth
- wifi – Wireless LAN
- wwan – Wireless Wide Area Network (UMTS)
Multiple devices are separated with blanks.
Hint: this feature is not available for all laptops. It depends on rfkill support for your model.
DEVICES_TO_ENABLE_ON_STARTUP="bluetooth wifi wwan"
Linux enables all builtin radio devices by default. In case of exception you can use this setting to enable the missing devices upon system startup. Possible values are as above.
DEVICES_TO_DISABLE_ON_SHUTDOWN="bluetooth wifi wwan"
Disables builtin radio devices upon system shutdown. May be used as a workaround when enabled radio devices block the shutdown process. Possible values are as above.
DEVICES_TO_ENABLE_ON_SHUTDOWN="bluetooth wifi wwan"
Enables builtin radio devices upon system shutdown. May be used as a workaround to prevent other operating systems from missing disabled devices. Possible values are as above.
Wireless Radio Switch
ThinkPads / Ubuntu only
DEVICES_TO_ENABLE_ON_RADIOSW="wifi wwan"
Radio devices to enable when wireless radio switch is turned on.
Hint: this feature is only available for ThinkPads with a slide switch (not Fn+F5!) running Ubuntu.
Battery Charge Thresholds
ThinkPads only
START_CHARGE_THRESH_BAT0=75
STOP_CHARGE_THRESH_BAT0=80
STOP_CHARGE_THRESH_BAT0=80
START_CHARGE_THRESH_BAT1=75
STOP_CHARGE_THRESH_BAT1=80
STOP_CHARGE_THRESH_BAT1=80
Set ThinkPad battery charge thresholds for main battery (BAT0) and auxiliary/Ultrabay battery (BAT1). Values are given as a percentage of the full capacity.
Charging starts upon connecting AC power, but only if the remaining capacity is below the value of START_CHARGE_TRESH (lower threshold). Charging stops when reaching the STOP_CHARGE_TRESH (upper threshold) value. If, however when you connect the AC adapter, charge is above the lower threshold, then it will not charge.
The default configuration file provides sample settings designed to minimize battery wear – the battery is charged to 80% only. However these settings are disabled by default and must be enabled explicitly by the user (remove the leading '#'). Note that even the hardware defaults of 96 / 100% – effective without TLP – already prevent battery wear by blocking short charge cycles.
Hint: the charging process is not controlled by software, but by hardware. TLP just writes the thresholds to the hardware registers (via tp-smapi or tpacpi-bat).
DISABLE_TPACPIBAT=1
Disable use of tpacpi-bat – and use tp-smapi instead – for setting the charge thresholds on Sandy Bridge models (X220, T420 et al.) .
Hint: do not use this option with Ivy Bridge models (X230, T430 et al.) where tpacpi-bat is mandatory because tp-smapi does not work.
For further questions concerning battery thresholds consult the TLP FAQ.
Radio Device Wizard
The radio device wizard provides the capability to enable or disable builtin radio devices triggered by certain events. In Ubuntu and Debian it is implemented in the (optional) package tlp-rdw.
Hint: the radio device wizard needs Network Manager as a prerequisite.
Disable on Network Connect
DEVICES_TO_DISABLE_ON_LAN_CONNECT="wifi wwan"
DEVICES_TO_DISABLE_ON_WIFI_CONNECT="wwan"
DEVICES_TO_DISABLE_ON_WWAN_CONNECT="wifi"
DEVICES_TO_DISABLE_ON_WIFI_CONNECT="wwan"
DEVICES_TO_DISABLE_ON_WWAN_CONNECT="wifi"
Upon a lan, wifi or wwan connect the stated radio devices are disabled:
- bluetooth
- wifi – Wireless LAN
- wwan – Wireless Wide Area Network (UMTS)
Multiple devices are separated with blanks.
Enable on Network Disconnect
DEVICES_TO_ENABLE_ON_LAN_DISCONNECT="wifi wwan"
DEVICES_TO_ENABLE_ON_WIFI_DISCONNECT=""
DEVICES_TO_ENABLE_ON_WWAN_DISCONNECT=""
DEVICES_TO_ENABLE_ON_WIFI_DISCONNECT=""
DEVICES_TO_ENABLE_ON_WWAN_DISCONNECT=""
Upon a lan, wifi or wwan disconnect the stated radio devices are enabled.
Enable/Disable on Dock
DEVICES_TO_ENABLE_ON_DOCK=""
DEVICES_TO_DISABLE_ON_DOCK=""
DEVICES_TO_DISABLE_ON_DOCK=""
After docking the stated radio devices are enabled/disabled.
Enable/Disable on Undock
DEVICES_TO_ENABLE_ON_UNDOCK="wifi"
DEVICES_TO_DISABLE_ON_UNDOCK=""
DEVICES_TO_DISABLE_ON_UNDOCK=""
After undocking the stated radio devices are enabled/disabled.
Trace Mode
For support purposes TLP provides a trace mode. To enable it add the following line to the configuration file:
TLP_DEBUG="lock nm path pm rf run sysfs udev usb"
Default Configuration
For reference see /etc/default/tlp as contained in the installation package.
Source: TLP
http://www.noobslab.com/
http://linrunner.de/
http://linrunner.de/
0 nhận xét:
Đăng nhận xét