Hybrid graphics on Arch Linux and Lenovo Thinkpad e520

[ note: this solution probably works for all laptops with Intel and ATI hybrid cards ]

I have noticed that my Lenovo Thinkpad e520 can work from battery up to 3 hours when on windows 7, and only lasts for about 1.5 hours when I'm using Arch LInux. The problem is that the laptop has hybrid Intel / ATI graphics cards, and Linux cannot handle that combination, so it keeps both cards turned on, that doubles the power consumprion (~ 24 wats). Here is a simple way of turning off the ATI card on Arch LInux: First you need to Install hybrid-video-ati-intel and systemd-vgaswitcheroo-units from AUR, that package will ensure that you have drivers installed for both the integrated and the discreet graphics cards, and brings 2 new BASH files /usr/bin/vgaswitcheroo_start.sh and /usr/bin/vgaswitcheroo_stop.sh.

After installing you can turn off the ATI card with

sudo vgaswitcheroo_start.sh

( After this command the power consumption goes from ~ 24w to ~ 12w... splendid :) )

and turn it back on with

sudo vgaswitcheroo_stop.sh

That's about it. What those BASH files are doing is the following:

sudo vgaswitcheroo_start.sh

modprobe radeon
echo DIGD > /sys/kernel/debug/vgaswitcheroo/switch
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch

sudo vgaswitcheroo_stop.sh

echo ON > /sys/kernel/debug/vgaswitcheroo/switch

here is the description for all the commands you can use with vga_switcheroo :

echo ON > /sys/kernel/debug/vgaswitcheroo/switch

Turns on the GPU that is disconnected (not currently driving outputs), but does not switch outputs.

echo IGD > /sys/kernel/debug/vgaswitcheroo/switch

Connects integrated graphics with outputs.

echo DIS > /sys/kernel/debug/vgaswitcheroo/switch

Connects discrete graphics with outputs.

echo OFF > /sys/kernel/debug/vgaswitcheroo/switch

Turns off the graphics card that is currently disconnected.

There are also a couple of options that are useful from inside an X-Windows session:

echo DIGD > /sys/kernel/debug/vgaswitcheroo/switch

Queues a switch to integrated graphics to occur when the X server is next restarted.

echo DDIS > /sys/kernel/debug/vgaswitcheroo/switch

Queues a switch to discrete graphics to occur when the X server is next restarted.

cat /sys/kernel/debug/vgaswitcheroo/switch

Allows you to verify the current state of the hybrid graphics. Typically, there will be two lines of output - one should indicate "Pwr" and the other should indicate "Off".