Home > English, Linux > How to switch off Dell XPS 1340’s discrete video card on Linux

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

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: http://linux-hybrid-graphics.blogspot.com/

There is also a bug report on Launchpad regarding the same problem: https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/312756
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:

Makefile
xps_nv.c

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:

make
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]
	Capabilities: 
	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:

xps_nv

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.

Cheers!

Categories: English, Linux
  1. June 30, 2010 at 16:41

    Thank you! Finally!

    I’ve been using Windows 7 for too long!

  2. July 12, 2010 at 17:40

    Thanks. My dell now seems around 5-6°C cooler.

  3. Luke
    August 2, 2010 at 21:03

    This one is really great!!! Thanks very much. I hope one of these days nvidia will produce some “working” driver for their cards.

  4. cts
    August 20, 2010 at 12:16

    Hi,
    thanks for this cool patch 😀

    But are you really content with the windows drivers ?
    It’s strange, but only 3Dmark shows higher performance when activating hybrid SLI.
    All games and benchmarks have lower fps, when I enable “High-Performance-Mode” (ironic, seems they don’t support SLI …)

    Now I need to find a convincing way to undervolt my CPU like RMclock and I can finally switch to Kubuntu.
    (my processor works with 0.1V less and this reduces the heat a lot …)

    Any Ideas ? (I tried the phc kernel but it didn’t work)

    • August 22, 2010 at 04:11

      Hi!

      I’ve seen this kind of complaints about the performance. I guess most games are not really well prepared to deal with this kind of technology (well, not even nvidia is for that matter). So I guess that, when it comes to the xps 1340, it works best for the gf 210m, because it has a more powerful discrete card than the 9500m.
      Now if I am content? I don’t care, I never run Windows anyways 😀

      I haven’t tried undervolting, so I can’t really help on that, sorry 😦

  5. cts
    August 30, 2010 at 22:51

    Hi, thanks for your reply.
    I’ll go through forums and some guides in the next weeks, maybe I’ll find a solution. Don’t want to risk a pinmod atm …

    Now, after some “long term” 😉 testing, It seems that the 9200 GS is activated again, when resuming after standby mode.
    reloading the module helps …

  6. daz
    October 6, 2010 at 02:55

    you can do “lspci -v | grep VGA” to just list VGA adapters when doing lspci – Thank you very much for this!!!!!!

  7. bibby
    October 10, 2010 at 06:33

    Hey man i have a question,. i also have a dell xps 1340 and i already installed the latest nvidia drivers. but when firefox loads image on the browser, the resolution is really poor as compared to when i had windows vista installed on this computer

    im using the latest ubuntu 10.04 and i did a fresh install on my computer so its just ubuntu and no more windows. please email me if you are experiencing this low image quality as well.

    when i save the image from the browser, it saves the scaled down image and not the original image size.

  8. ubuntuuser
    June 16, 2011 at 23:27

    Hi,

    I am running the XPS13 with the 9400 – 210M combo.. and whenever I enable this module with modprobe, my computer begins locking up every 2-3 seconds for about 5 seconds. I am not sure what the problem is, do you have any ideas? I would really like a solution to this because my battery life stinks! Thanks for your help.

  9. September 7, 2012 at 15:31

    FYI, I had to add:

    #include

    in order to make it compile under Ubuntu 12.04 / kernel 3.2.x. Seems to work great otherwise! Now I’m trying to find a way to actually USE the dedicated GPU under Linux. It can be specified in the X configuration, but results in a blank screen.

    The problem seems to be that the integrated GPU gets connected to the laptop LCD while the discrete one does not. I’m trying to figure out whether there’s an ACPI method that can make this switch or whether it’s something driver-related that maybe just can’t be done without a lot of work. If you’re interested, I’m updating a thread on the hybrid-graphics list with my progress and questions: https://lists.launchpad.net/hybrid-graphics-linux/msg02295.html

    Thanks for the module!

    • September 7, 2012 at 15:33

      Hm, it didn’t escape my code properly. It should be:

      #include <linux/module.h>

      • rad stor
        October 7, 2012 at 01:01

        Thanks Luiz and Miquel! I have an XPS 1340. Following the original instructions with Miquel’s modifications I disabled my G210M in Ubuntu 12.04. I find that I have longer battery life and the laptop runs cooler.

        I would like to manually control the fan speed in Ubuntu so that it runs faster, would anyone be able to direct me on how to do this?

        Thanks!

  10. lar
    November 8, 2012 at 21:23

    Hi,

    Thanks for the solution, but fayter upgrading my system, i cant’ do it …

    I have an error when i run the “make” :

    /home/user/Doc/nv_FIX/xps_nv.c:3:16: error: expected declaration specifiers or ‘…’ before string constant
    make[2]: *** [/home/user/Doc/nv_FIX/xps_nv.o] Error 1
    make[1]: *** [_module_/home/user/Documents/nv_FIX] Error 2
    make[1]: leave the directory « /usr/src/linux-headers-3.5.0-17-generic »
    make: *** [default] Erreur 2

    i’am on Ubuntu 12.10

    any idee’s ?

    Thanks

  11. lar
    November 9, 2012 at 00:04

    ok, sorry… i’am blind

    add #include

  12. July 7, 2013 at 12:28

    I have the same problem as lar…

    make -C /lib/modules/3.8.0-19-generic/build M=/home/roddy/Downloads/Switch off GForce210M modules
    make[1]: Entering directory `/usr/src/linux-headers-3.8.0-19-generic’
    /usr/src/linux-headers-3.8.0-19-generic/arch/x86/Makefile:103: CONFIG_X86_X32 enabled but no binutils support
    make[1]: *** No rule to make target `off’. Stop.
    make[1]: Leaving directory `/usr/src/linux-headers-3.8.0-19-generic’
    make: *** [default] Error 2

  13. ananta
    May 27, 2014 at 07:48

    is this works on other, non-dell/xps laptops?
    mine is asus-a46cm, thankyou

  14. Anonymous
    May 26, 2015 at 14:43

    make sure you add #include in the xps_nv.c file

    • Anonymous
      May 26, 2015 at 14:44

      #include

  15. Anonymous
    July 28, 2016 at 15:31

    Excellent! I’ve recently revived my old 1340 with Trusty, and soon noticed this issue; with your solution, it runs much smoother too 😉

    • July 28, 2016 at 20:22

      Good to know it’s still useful even after all these years :o)

  16. September 12, 2017 at 07:44

    Can you move back files to folders I just got XPS 1340 and will do it too. Did you ever made both of them running on this laptop, I mean Nvidia-s ?

  17. ">
    April 4, 2018 at 10:38
  1. No trackbacks yet.

Leave a reply to lar Cancel reply