Lenovo Thinkpad Edge E520 Linux power saving issues and kinda solution

Notebook specs:

Display: 15,6″ Antiglare, 1366×768
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.

7 Responses to “Lenovo Thinkpad Edge E520 Linux power saving issues and kinda solution”

  1. vahokif Says:

    Hi, are you getting a problem where the fan near the Esc key doesn’t work when you turn off the discrete card? I had this problem with both vga_switcheroo and acpi_call, and my laptop gets really warm.

  2. metala Says:

    vga_swicheroo is for muxed graphics configuration. Lenovo Thinkpad Edge E520 is muxless graphics config, thus only acpi_call should work.

    I had two issues with the fan so far.
    First is when you soft restart the computer after calling acpi_call to shutdown the discrete part. I get “Fan Error.” on a black screen (BIOS self-check I guess).
    I think I have to power on the discrete card before restart.

    And the second issue was that the fan was running at high speed (not max, I only got max speed when I was flashing BIOS), and it was running on high speed even when I had almost no activity.
    I had to repower the discrete part and shut it down again and it went to low speed or stopped (I don’t remember actually which one of the two states).

    And no I haven’t had any other issues so far, but I guess the fan and the discrete card are connected somehow though the ACPI.

  3. vahokif Says:

    It seems that disabling the discrete card somehow breaks the sensor that triggers the fan, so the fan stays at whatever rate it was at when you turned it off, which leads either to overheating or wasted battery.

  4. metala Says:

    Yep, It seems so.

    That’s why I installed ‘pm-utils’, and added script to change the power governer to powersave when on battery. Also another script to automatically disable/enable the integrated GPU when on battery/plugged in.

    It helps a bit. I can go up to 4 hours when working on battery and almost no heat, because the CPU is the main heat source and the scaling governor is set to ‘powersave’

  5. Norrec Says:

    you can simply install the fglrx-next driver. It has support for hybrid graphics: http://ubuntuforums.org/showthread.php?t=1930450

  6. metala Says:

    I’ll give it a try.

    I dropped Ubuntu, once again, in favour of Debian Wheezy. So my Xorg core is a bit newer, so I’ll probably take a shot on the latest fglrx. I’ll write a comment after I test it.

  7. BigNikO Says:

    Маринеее една година нищо не си писал, хвани напиши нещо :D

Leave a Reply