Lenovo Thinkpad Edge E520 Linux power saving issues and kinda solution


Notebook specs:

Display: 15,6" Antiglare, 1366x768
CPU:  Intel Core i5-2450M (+ Integrated Intel HD 3000 Graphics)
GPU: AMD/ATI Radeon 6630M (Switchable graphics, muxless)
RAM: 4GB DDR3 1333Mhz
HDD: 500GB, 7.2KRPM

Initial setup:

OS: Ubuntu 11.10 + ext4 + eCryptfs /home
Kernel: Linux (according to the package in the repository `aptitude show linux-image-3.0.0-16-generic`)
BIOS: Set to switchable graphics
Estimated power usage: 28W
Estimated battery life:  about 1 hour 30min

My current setup:

OS: Ubuntu 11.10 + ext4 + eCryptfs /home Debian Wheezy (7.0)
Kernel: Linux 3.3.0 vanilla Linux 3.4.0-trunk
BIOS: Set to switchable graphics
Estimated power usage: 12.7W
Estimated battery life:  about 3 hours and 40 minutes a bit more than 4 hours


The choice of OS:

I have both Windows and Linux installed on this setup, but I tend to be more productive when running Linux. Ubuntu is my choice for workstation OS (because fglrx tends to work more often in Ubuntu, rather than in Debian/testing) and I use Windows as for entertainment. Even though I have managed to fix some issues with the power saving, I'm still not pleased with the battery life in Linux - 3h 40min vs. 5h 40 min in Windows.


What I did:

  1. Build and installed vanilla Linux Kernel 3.3.0 that addresses ASPM power regression in 2.6.38
  2. Enabled Intel Graphics RC6 power saving mode
  3. Powered down the AMD Radeon 6630M through the ACPI (~ 10W less)
  4. Did some tuning using powertop
  5. Installed `pm-utils` package
  6. Added to pm-utils scripts, a script to set the scaling_governor to 'powersave' when on battery

 Tip: You can check your power usage and remaining battery life in the commandline

dstat --time --power --battery --battery-remain 15


1. How to build the new Linux Kernel 3.3.0

There are many tutorials how to do this. Just google "Build Linux Kernel 3.3 in Ubuntu", or something like that.

What I did in short:

Downloaded latest kernel tarball from kernel.org. Extracted it to /usr/src. I did `menu oldconfig`. Added manually CONFIG_IWLWIFI=m to .config, because it seems Intel Wireless Next Gen is not enabled by default. And built it and the installed it. Something like that:
Prerequisites: apt-get install ncurses-dev build-essential

cd /tmp
wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.3.tar.bz2
tar jxf linux-3.3.tar.bz2 -C /usr/src
cd /usr/src/linux-3.3
make oldconfig
make menuconfig # Here you should select Intel Wireless Next Gen Driver to be compiled as a module
make modules_install install

2. How to enable Intel Graphics RC6 power saving mode

I'm not sure if this helped, but "Better be safe, than sorry".

There is an article that explains how to do it Improving power consumption on Ubuntu laptop with ‘Sandy Bridge’ processor

3. How to power down the AMD Radeon 6630M through the ACPI

Here is an article how to do it: Using acpi_call module to switch on/off discrete graphics card in Linux

If you are tired of recompiling acpi_call for every kernel you install. There is an article to make the module dkms (afaik. Dynamic/Dell Kernel Module Support).
Acpi call - Hybridgraphics

Important Update!

When you power down the discrete AMD Radeon HD 6630M, you also lock the fan state. That means if the fan was off at that moment, it will continue to be off till you reenable your GPU. If you notice your left part of the laptop case is getting hot, you should consider reenabling the GPU. I do this using the command:

sudo /bin/echo -n '\_SB.PCI0.PEG0.PEGP._ON' > /proc/acpi/call

The reason the the laptop is getting hot, I believe is because the CPU is still running. In my setup the cpu scaling governor is set to ondemand and the CPU can be very power hungry.

Last note:
If you restart (soft restart) the PC when you have disabled the discrete GPU you may get "Fan Error." and then automated shutdown. That is because your laptop is getting really hot and BIOS wants to activate the fan to cool it off, but it is locked by the acpi call. And that how you get the error.
The easy way to fix this is to put in a init script that disables the GPU on boot and reenables it on shutdown.