Archive for June, 2010

How to switch off Dell XPS 1340’s discrete video card on Linux

June 29, 2010 20 comments

Finally, after months, the discrete video card of my Dell Studio XPS 1340 is switched off on Linux.

The story…

This laptop comes with two video cards and what nvidia calls Hybrid SLI.
The idea is very nice : one video card is integrated to the motherboard and is always switched on.
The other one is a discrete card and is manually switched on by the user when he/she wants more graphical processing power, consuming more power. This sounds interesting for laptop owners, who may want to save the battery as much as possible.
When the discrete card is on, both cards work together combined to provide a more powerful graphical processing device.
Even tough the idea is nice, the implementation is not, and nvidia even gave up moving on with the technology. If I am not mistaken, I read somewhere that they claim the driver implementation to control the devices together is very complicated.
The drivers for Windows Vista and Windows 7 work quite well, and is maintained by the laptop vendors, in this case, Dell.

Now if you use Linux…:
nvidia provides their proprietary driver for Linux, which is very nice, but allows us to use only the integrated card.
At first it was ok for me, as I didn’t have the need to use the power of both cards together on Linux anyway. The problem is: the Linux driver does not switch the discrete card off. Yeap, that’s right, you can’t use the discrete card, but it is always on consuming power. Ironic, uh?! The result is: on Linux my laptop always runs hotter and the battery lasts shorter than on Windows.

I researched for a long time when I bought the laptop, but I couldn’t find a way to get the discrete card off.
One good piece of news is that the project nouveau, an open source driver for nvidia cards, plans to add full support to switching these cards on/off at will. The driver is still under heavy development though… and many features are not yet implemented.

So just a few days I received an update from the sites I have been following related to the subject.
avilella has been running a great blog about switchable graphics on Linux, and quickly updating it on every new details that comes up. The address to his blog is:

There is also a bug report on Launchpad regarding the same problem:
On this bug report page they are collecting information about all different laptops with switchable cards, so that they can work on a solution for everyone.
But just yesterday a member from Launchpad named drphd found an ACPI method that can be called on the Dell XPS 1340 to disable the graphic card.

I just made a small modification on the module that avilella posted here, making it specific for the Dell XPS 1340, by using the method indicated by drphd. And, thanks to these guys, we can now switch the discrete card off.

The solution

So, to use it, just download these two files:


Before compiling the module, run: lspci -v
You should see the information for both cards, including the IRQ and the kernel modules related to them.
Now place those two files inside the same folder, cd to this folder and run:

sudo cp xps_nv.ko /lib/modules/`uname -r`/kernel/
sudo depmod
sudo modprobe xps_nv

If you run lspci -v again, you should see the detailed information only for the integrated card. On my machine the output after the module is loaded is:

02:00.0 VGA compatible controller: nVidia Corporation G98 [GeForce 9200M GS] (rev ff) (prog-if ff)
	!!! Unknown header type 7f

03:00.0 VGA compatible controller: nVidia Corporation C79 [GeForce 9400M G] (rev b1)
	Subsystem: Dell Device 0271
	Flags: bus master, fast devsel, latency 0, IRQ 23
	Memory at aa000000 (32-bit, non-prefetchable) [size=16M]
	Memory at b0000000 (64-bit, prefetchable) [size=256M]
	Memory at cc000000 (64-bit, prefetchable) [size=32M]
	I/O ports at 5000 [size=128]
	[virtual] Expansion ROM at c0000000 [disabled] [size=128K]
	Kernel driver in use: nvidia
	Kernel modules: nvidia-current, nvidiafb, nouveau

To make sure that the module is loaded every time you boot your laptop, edit the file /etc/modules and add, in the end, a new line with the text:


As you see, I have the Dell XPS 1340 with a GeForce 9400M G and a GeForce 9200M GS.
But I think that the same solution should also work for people who have the combination GeForce 9400M G + GeForce 210M.

After the module is loaded the laptop runs a bit cooler, it uses around 4W less power and the battery is estimated to last around 30-50 minutes longer.

Remember that every time you install a new kernel you will have to re-compile and re-install the module.


Categories: English, Linux