Tag Archives: gnu linux

Disabling Discrete GPU in Debian GNU/Linux Wheezy

I really like using GNU/Linux, especially Debian distributions (not Debian-based, just Debian). I was doing just fine until I bought a HP Pavilion dv7-4285dx laptop a few moths ago. It has a Intel Core i5 460 CPU, 6 GB of RAM and 640 GB HDD, another interesting feature is the switchable graphics system, that means, it has an integrated Intel GPU for low power / low performance and a discrete ATI Mobility Radeon HD6370 GPU for high power/ high performance. It’s a nice feature but the problem is I never use the discrete GPU, but in a fresh installed Debian, both cards are turned on, generating a lot of heat and consuming/wasting a lot of power and therefore battery. In Virus  Windows you can select which GPU to use with the ATI configuration utility.

I googled for solutions and many people could disable one of the GPUs using a module called vgaswitcheroo, which allows to select which GPU to use as well as turn the unused GPU off. I did everything the tutotials said but I couldn’t get it to work, for some odd reason whenever I tried to turn the discrete GPU off the OS gave some kind of weird errors  and warnings.

So I started looking for another solution, and googling again I found another method to disable the discrete GPU using the acpi_call module, which I’ll describe here.

  • First you need to install the acpi_call module. I did it using this method, which I copy here.

1. Install dkms and some useful packages:

sudo apt-get install dkms git build-essential
sudo apt-get install linux-headers-$(uname -r)

2. Clone the acpi_call repository from git and copy it to where dkms will look for it. We’ll call it version 0.0.1 for now:

git clone http://github.com/mkottman/acpi_call.git
mkdir /usr/src/acpi_call-0.0.1
cp -rp acpi_call/* /usr/src/acpi_call-0.0.1

3. Create a file dkms.conf for it:

sudo gedit /usr/src/acpi_call-0.0.1/dkms.conf

and paste this into it and save it:

PACKAGE_NAME="acpi_call"
PACKAGE_VERSION="0.0.1"
CLEAN="make clean"
BUILT_MODULE_NAME[0]="acpi_call"
DEST_MODULE_NAME[0]="acpi_call"
MAKE[0]="make IGNORE_CC_MISMATCH=1 KDIR=$kernel_source_dir PWD=$dkms_tree/acpi_call/0.0.1/build"
DEST_MODULE_LOCATION[0]="/kernel/drivers/acpi"
AUTOINSTALL="yes"

4. Edit the Makefile:

sudo gedit /usr/src/acpi_call-0.0.1/Makefile

and paste this into it and save it:

obj-m := acpi_call.o
default:
 $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
 rm acpi_call.mod.o acpi_call.o acpi_call.ko

5. Add the module to dkms and build and install it:

sudo dkms add -m acpi_call -v 0.0.1
sudo dkms build -m acpi_call -v 0.0.1
sudo dkms install -m acpi_call -v 0.0.1

If all went well, you should now be able to load the module with:

sudo modprobe acpi_call

and this will give some information about it:

modinfo acpi_call
  • to try if it worked you should
sudo sh /usr/src/acpi_call-0.0.1/test_off.sh

and you should get something like this

Trying \_SB.PCI0.P0P1.VGA._OFF: failed
Trying \_SB.PCI0.P0P2.VGA._OFF: failed
Trying \_SB_.PCI0.OVGA.ATPX: failed
Trying \_SB_.PCI0.OVGA.XTPX: failed
Trying \_SB.PCI0.P0P3.PEGP._OFF: works!

now you should check if the GPU is disabled by doing

lspci | grep VGA

and you should get something like this

gary@HP-Debian:~$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 02)
01:00.0 VGA compatible controller: ATI Technologies Inc Robson CE [AMD Radeon HD 6300 Series] (rev ff)

notice the (rev ff) at the end, that means that the GPU is now disconnected

  • If you want to make these changes permanent you need to add acpi_call module to so it can load at startup

First you need to add add acpi_call to /etc/modules

sudo echo acpi_call >> /etc/modules

then create a script in /etc/init.d to run at startup

sudo nano /etc/init.d/script_name_you_want

and copy this into it and save it

#! /bin/bash
 ### BEGIN INIT INFO
 # Provides: script_name_you_want
 # Required-Start: $remote_fs $syslog
 # Required-Stop: $remote_fs $syslog
 # Default-Start: 2 3 4 5
 # Default-Stop: 0 1 6
 # Short-Description: Start daemon at boot time
 # Description: Enable service provided by daemon.
 ### END INIT INFO
 # /etc/init.d/script_name_you_want
 #
 # Carry out specific functions when asked to by the system
 case "$1" in
 start)
 echo "Disabling Discrete VGA "
 cd /usr/src/acpi_call-0.0.1/test_off.sh
 ;;
 *)
 echo "Usage: /etc/init.d/script_name_you_want {start}"
 exit 1
 ;;
 esac
 exit 0

then add the appropriate symbolic links to cause the script to be executed

sudo update-rc.d script_name_you_want defaults

If you want to remove the symbolic links

sudo update-rc.d -f script_name_you_want remove