# [SOLVED] My dedicated nvidia card drains my battery

## candamil

Hi there, guys. I have bought a laptop (Dell XPS15) and after a couple of months, I realized that the battery in Linux lasted less than it should, (about 2 hours or 2:30), so I decided to do a battery test in windows, and it lasted almost 6 hours (very disappointing).

Ok, that's the problem, grosso modo. Now, let's go to the details.

My laptop is a Dell XPS15, L502X, with the damn optimus hybrid system. It has an Intel HD3000 integrated video card, and a nvidia GT525m dedicated video card. The audio system is also an Intel HD blablabla, and the screen has a 1920x1080 resolution. The processor is an Intel core i5, and it has 4 GB of RAM memory, and a 750GB HDD (SATA).

This is the complete hardware:

```

nomada candamil # lspci 

00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)

00:01.0 PCI bridge: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port (rev 09)

00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)

00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)

00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 05)

00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 05)

00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b5)

00:1c.1 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 2 (rev b5)

00:1c.3 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 4 (rev b5)

00:1c.4 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 5 (rev b5)

00:1c.5 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 6 (rev b5)

00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 05)

00:1f.0 ISA bridge: Intel Corporation HM67 Express Chipset Family LPC Controller (rev 05)

00:1f.2 SATA controller: Intel Corporation 6 Series/C200 Series Chipset Family 6 port SATA AHCI Controller (rev 05)

00:1f.3 SMBus: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller (rev 05)

01:00.0 VGA compatible controller: nVidia Corporation GF108 [GeForce GT 540M] (rev a1)

03:00.0 Network controller: Intel Corporation Centrino Advanced-N 6230 (rev 34)

04:00.0 USB controller: NEC Corporation uPD720200 USB 3.0 Host Controller (rev 04)

05:00.0 System peripheral: JMicron Technology Corp. SD/MMC Host Controller (rev 30)

05:00.2 SD Host controller: JMicron Technology Corp. Standard SD Host Controller (rev 30)

05:00.3 System peripheral: JMicron Technology Corp. MS Host Controller (rev 30)

05:00.4 System peripheral: JMicron Technology Corp. xD Host Controller (rev 30)

06:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)

nomada candamil # lsusb

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub

Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub

Bus 001 Device 003: ID 0408:2fb1 Quanta Computer, Inc. 

Bus 002 Device 003: ID 8086:0189 Intel Corp. 

Bus 002 Device 004: ID 1c4f:0003 SiGma Micro HID controller

```

The windows version is Windows7 Home Premium. 

Regarding Linux, this is what I have:

```

nomada candamil # uname -r

3.2.12-gentoo

nomada candamil # kded4 -v

Qt: 4.7.4                                                                                                                              

Plataforma de desarrollo de KDE: 4.8.1 (4.8.1)

nomada candamil # X -version

X.Org X Server 1.11.2

nomada candamil # /etc/init.d/acpid status

 * status: started

```

And now, numbers.

For the windows test, I set all te configurations to powersave, the screen brightness to the minimum (but with the turn off option disabled, so the screen was ON the whole test). I disabled the WiFi, and the sound was UNmuted (but it was no playing, so I think it doesn't matter). I also activated the option to disable all the screen effects. Then, I opened a pdf file with acrobat reader, just to have a program running. Then, I didn't touch anything, just checked the battery level every half an hour. It lasted 5:36 until it reached 4% (that's the limit I am using), much more than I expected.

Then, I tried with Linux. I installed Optimus with this tutorial:

http://en.gentoo-wiki.com/wiki/X.Org/nVidia_Optimus

Anyway, for the first test, I disabled it. I disabled the WiFi and muted the sound, and also disabled the KDE effects. Then I opened the same pdf file with the Linux version of acrobat reader. Same configuration for the screen, brightness to the minimum and turned ON the whole test. It lasted only 2:07.

Second Linux test. Everything the same, but optimus activated. Just 2:27.

Then I tried turning OFF the screen and stuff, but, anyway, just 2:49 (and in windows it was on).

Finally, I tried with all of the powersaving tricks I found. I created this script and tried with it:

```

nomada candamil # more energia-start.sh

#!/bin/bash

mount -o remount,relatime /

hdparm -B 1 -S 12 /dev/sda

echo 5 > /proc/sys/vm/laptop_mode 

echo 40 > /proc/sys/vm/dirty_ratio

echo 10 > /proc/sys/vm/dirty_background_ratio

echo 1500 > /proc/sys/vm/dirty_writeback_centisecs

echo min_power > /sys/class/scsi_host/host0/link_power_management_policy

echo 1 > /sys/devices/system/cpu/sched_mc_power_savings

echo 1 > /sys/module/snd_hda_intel/parameters/power_save

/etc/init.d/mysql stop

/etc/init.d/ntpd stop

/etc/init.d/NetworkManager stop

/etc/init.d/cupsd stop

killall akonadiserver

killall akonadi_control

killall wpa_supplicant

```

...but, anyway, just 2:59 (and in this test, the screen was off too).

There is another important clue. In the windows test, the fan didn't turn on in the whole test, it was off all the time. In Linux, it turns on every two minutes, and it runs for several seconds.

I am pretty sure that the problem is the dedicated graphics card. Although I have installed optimus and I am not using the nvidia card during the test, I suppose that it's still enabled, and that it's draining my battery. I would like to find a method to completely disable it. It would be great if I can enable and disable it without rebooting, but if I can't do that, it doesn't matter. It doesn't matter if I need to reboot to enable it again, and even it doesn't matter if to turn it off, I need to reboot with special grub parameters. I just want my battery to last at least 5 hours in Linux, as it does in windows.

I tried also with this:

https://bbs.archlinux.org/viewtopic.php?id=132522

(it hangs the system and the fan starts spinning without control)

http://tautvidas.com/blog/2011/05/disable-nvidia-optimus-enabled-graphics-card/

(the same)

http://www.idiap.ch/~fleuret/glitches.html

(it doesn't work, it says that the methods are not valid)

Ah, I almost forget, of course, I can't disable it in BIOS, it hasn't that option.

Any ideas? tips? A gun to shoot myself?Last edited by candamil on Mon Apr 16, 2012 6:43 am; edited 1 time in total

----------

## candamil

```

/etc/init.d/optimus stop

rmmod nvidia

insmod /home/candamil/programas/acpi_call/acpi_call.ko

echo '\_SB.PCI0.PEG0.PEGP._OFF' > /proc/acpi/call

```

----------

## Mad Merlin

 *candamil wrote:*   

> 
> 
> ```
> 
> /etc/init.d/optimus stop
> ...

 

For posterity, this fully disables the Nvidia card at runtime? Is it possible to reenable it in a similar manner? What kind of battery life do you get after applying the above?

----------

## candamil

Yes, this fully disables de nvidia card at runtime, no need to reboot.

Yes, it is possible to reenable it in a similar manner, in fact, in the same manner:

```

echo '\_SB.PCI0.PEG0.PEGP._ON' > /proc/acpi/call

modprobe nvidia

/etc/init.d/optimus start

```

(of course, for the optimus server you need to install and configure it).

The battery improvement is almost an insult:

Before: 4:13 - 4:15

After: 6:45 - 6:48

2 hours and a half more.

----------

