Linux Power Saving Tweaks for HP Pavilion laptops

Less watts: environmentally friendly, longer lasting battery, less spending on energy bills.
Thanks to these tips you’ll be able to improve your Ubuntu GNU/Linux laptop lasting, maximize battery lasting and life and also our own planet Earth life expectancy!

QUESTA GUIDA È ANCHE DISPONIBILE IN LINGUA ITALIANA

Just for reference on my HP Pavilion dv6500 series laptop I managed to get battery lasting to 3h average @ ~13Watts with kernel 2.6.24 applying the sysfs fixes only typing/reading with wireless on, screen 60%, desktop effects, laptop-mode enabled BUT NO hard disk spin down / powersaving features enabled.

A relevant gain which can be further increased (I managed to get as low as 8,5Watts by enabling hard disk power saving features in laptop-mode.conf. Notice it was not spin down but only powersaving!)

Check http://lesswatts.org for further tips on how to save energy, money and life expectancy!

Note: unless specified following tips will NOT DEGRADE your system performance since they work on demand and will activate only when your system has little load.

Note2: as Harry suggested, do not leave any empty line in sysfs.conf file.

How long is your battery lasting under linux? (divide by 2 if using 12 cells)

View Results

Loading ... Loading ...

———————————

With Laptop-Mode-Tools (great set of scripts coded by Bart Samwel) you get the chance to tweak the following power related features:

in /etc/laptop-mode/laptop-mode.conf

  • Hard Disk related settings: readahead, cache, realtime, powersaving, spindown
  • Cache related settings: dirty ratio, etc.

in /etc/laptop-mode/conf.d/

  • AC97 powersave
  • Bluetooth powersave
  • Logging files tweaking
  • Syslog tweaking (through command lm-syslog-setup)
  • CPU frequencies and governors (however Ubuntu has already Gnome that does this)
  • Display dpms standby (however Ubuntu has already Gnome that does this)
  • Display brightness (however Ubuntu has already Gnome that does this)
  • Ethernet disabling (NOTE: autosensing even with AC doesn’t currently work for me)
  • Hal polling
  • Intel SATA link power management
  • Scheduler power saving settings
  • Video-out
  • Wireless Intel IPW and IWL drivers powersaving features
  • Start/Stop of programs and services on power source toggling (i.e. cron, crontab, cups…). These can be set through command lm-profiler

To enable laptop-mode-tools you have to edit both /etc/laptop-mode/laptop-mode.conf and (if you use the package from the repositories) also /etc/default/acpi-support

You may consider updating laptop-mode-tools from intrepid repositories. These have a new version which has more comprehensive power tweaking options:

http://packages.ubuntu.com/intrepid/laptop-mode-tools

NOTE: I advise against using the package provided from laptop-mode-tools maintainer website http://samwel.tk/laptop_mode/ since that wouldn’t resume its functionalities upon resume from suspend/hibernate. The package from the repositories, instead, provide a set of scripts for it to be always checking the power state (AC or Battery powered).

This link is available here: /usr/lib/pm-utils/power.d/laptop-mode and relies on the new pm-utils framework.

———————————
in /etc/sysfs.conf (available after having installed sysfsutils) you can tweak kernel options without having to recompile the kernel.

UPDATE: since this is managed well by both laptop-mode-tools and gnome-power-manager this is not necessary any more.

# Always use the ondemand CPU frequency governor
# You can set it to always use powersave CPU governor, although it hasn’t been proved to be less power intensive
devices/system/cpu/cpu0/cpufreq/scaling_governor = ondemand

———————————

UPDATE: Since this would be a permanent change, I advise you to use the laptop-mode-tools module instead.

# this enables the lowest power state for Wireless IWL4965
bus/pci/drivers/iwl4965/0000\:02\:00.0/power_level = 5

NOTE: this permanently (until you comment out this string) decreases the power of your Wireless card.
You can replace iwl4965 with iwl3945 if this is your wireless card.
You have to replace the 0000\:02\:00.0 with the numbers you actually find in /sys/bus/pci/drivers/iwl4965 which is your wireless card physical address

———————————

if USB autosuspend is enabled at the kernel level there is no more need to tweak these settings, also because powertop reports them not being active and consuming power while not working.

# manage suspend of Authentec Fingerprint Scanner.
# Bus 004 Device 003 AuthenTec, Inc.
# timeout time (seconds)
bus/usb/devices/4-1/power/autosuspend = 2
# power level: on = always on; auto = autosuspend; suspend = always off
bus/usb/devices/4-1/power/level = auto

Note on USB devices addresses: to locate the USB device address in /sys you first have to ‘lsusb’ then keep in mind the ‘Bus 00N Device 00N’ relative to the device you want to manage. Go into /sys/bus/usb/devices and here look at the entries in this form X-Y (numberDASHnumber) and use ‘cat X-Y/busnum’ and ‘cat X-Y devnum’ in order to identify the correct device.
With this in mind you can apply this tweak to every USB device attached to your laptop (however it makes sense only for those embedded into the laptop (fingerprint, webcam, bluetooth), not the external ones).

———————————
# manage suspend of Chicony Webcam
# Bus 007 Device 003 Chicony Electronics Co., Ltd
# timeout time (seconds)
bus/usb/devices/7-4/power/autosuspend = 2
# power level: on = always on; auto = autosuspend; suspend = always off
bus/usb/devices/7-4/power/level = auto

———————————

UPDATE: you may also use the script provided by laptop-mode-tools

# this enables lowest power state for SATA link host nr. 0,1,2,3,4
# only for kernel 2.6.24 upwards (ubuntu hardy 8.04)

class/scsi_host/host0/link_power_management_policy = min_power
class/scsi_host/host1/link_power_management_policy = min_power

class/scsi_host/host2/link_power_management_policy = min_power
class/scsi_host/host3/link_power_management_policy = min_power
class/scsi_host/host4/link_power_management_policy = min_power

———————————
# this enables low power state for Realtek HDA audio switch
# (integer express idle seconds after which to power off the device)
# note: audio led will toggle blue/amber according to active/powersaving state

module/snd_hda_intel/parameters/power_save = 10

———————————
in /etc/X11/xorg.conf (your video configuration file) enable Video Card on demand V-Blank (which will reduce by 60 your kernel wakeups)
under section “device” add following string:

Option “OnDemandVBlankInterrupts” “true”

———————————

if you use GNOME you can add to the pannel a very useful applet, the LCD Brightness applet. This enables you to tweak the display brightness according to the environment light and your desired comfort/battery lasting.

———————————

Gnome-power-manager has an interesting feature that allows you to dim screen brightness upon idle status. However you may only tweak the idle timeout from the registry with gconf-editor

run this application in ALT+F2 window and search for

/apps/gnome-power-manager/backlight/

tick enable
set brightness % when idle in idle_brightness
set the number of seconds after which to consider the computer idle in idle_dim_time

———————————

| Print This Post Print This Post | Email This Post Email This Post
RSS 2.0 | Trackback | Comment

7 Responses to “Linux Power Saving Tweaks for HP Pavilion laptops”


  1. [...] I also found some useful howto from Ubuntu Forum thread. For HP Pavilion owner, maybe this blog post and this can help you to improve your battery [...]

  2. H.-J.

    Hi,
    on my HP Pavilion I am running Fedora with the following power saving setup:

    #!/bin/bash
    # Datei: /usr/local/sbin/batteriebetrieb
    # http://de.gentoo-wiki.com/Aktivieren_von_Stromsparfunktionen
    #
    batteriebetrieb () {
    /bin/date >> /var/log/messages
    /bin/echo “Switching to battery power” >> /var/log/messages
    # Stop unneccessary services if on battery
    /etc/init.d/crond stop
    /etc/init.d/smartd stop
    /etc/init.d/smolt stop
    /etc/init.d/setroubleshoot stop
    #/etc/init.d/rsyslog stop
    #
    # Audio
    # Enable audio power saving
    /bin/echo 5 > /sys/module/snd_hda_intel/parameters/power_save
    #
    # Screen and graphics
    # Set power state of ATI graphics to low voltage
    # /sbin/aticonfig –set-powerstate=1 –effective=now
    # Reduce screen brightness
    /bin/echo “37″ > /proc/acpi/video/VGA/LCD/brightness
    # Adjust backlight brightness (set to 50%)
    #/usr/local/sbin/xbacklight -set 50
    #
    # CPU
    # Enable multi-core power saving tunables
    # configures the scheduler to use only one core if it doesn’t need two
    /bin/echo 1 > /sys/devices/system/cpu/sched_mc_power_savings
    # Set CPU clock sceduler
    #ondemand produces to many wakeups, set to powersave/conservative
    /usr/sbin/cpufreq-selector -g conservative
    #
    # SATA and CD/DVD
    # enable SATA ALPM link power management
    for i in /sys/class/scsi_host/*/link_power_management_policy; do /bin/echo min_power > $i; done
    # Decreases disk activity slightly
    # Tweak virtual memory to conserve power when running on batteries.
    /bin/echo 10 > /proc/sys/vm/swappiness
    /bin/echo 0 > /proc/sys/vm/dirty_expire_centisecs
    /bin/echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
    /bin/echo 60 > /proc/sys/vm/dirty_background_ratio
    /bin/echo 95 > /proc/sys/vm/dirty_ratio
    # Enabling the noatime filesystem option
    #/bin/mount -o remount/noatime /
    # Disable polling on CD-devices
    #/usr/bin/hal-disable-polling –device /dev/scd0
    #
    # USB
    # Enable autosuspend for usb devices
    # This might cause problems on some usb devices
    # detailed testing is recommended
    # Changing the default idle-delay time to 5 sec
    /bin/echo 5 >/sys/module/usbcore/parameters/autosuspend
    # enable autosuspend (on means never suspend)
    # timeout time (seconds)
    for i in /sys/bus/usb/devices/*/power/autosuspend; do /bin/echo 1 > $i; done
    # power level: on = always on; auto = autosuspend; suspend = always off
    for i in /sys/bus/usb/devices/*/power/level; do /bin/echo auto > $i; done
    #
    # Network
    # Enable wireless power saving
    #/bin/echo 5 > /sys/bus/pci/drivers/iwl3945/*/power_level
    #/sbin/iwconfig wlan0 txpower 7
    #/sbin/iwconfig ath0 txpower 7
    # Disable wake on lan on eth0
    /sbin/ethtool -s eth0 wol d
    # Reduce speed of eth0, supposed to save up to 2.5W
    /sbin/ethtool -s eth0 speed 100 duplex half autoneg off
    #
    #/etc/init.d/undervolt start
    #
    MODULE=”i2c_algo_bit crc_ccitt joydev
    radeon serio_raw pcspkr i2c_i801 firewire_ohci firewire_core
    uvcvideo compat_ioctl32 videodev

    ENTLADEVERSUCHE=3
    for versuch in $ENTLADEVERSUCHE
    do
    for modul in $MODULE
    do
    modprobe -r $modul
    done
    done
    }

    netzbetrieb () {
    /bin/date >> /var/log/messages
    /bin/echo “Switching to wall power” >> /var/log/messages
    # Start services again, if on wall power
    #/etc/init.d/rsyslog start
    /etc/init.d/crond start
    /etc/init.d/smartd start
    /etc/init.d/smolt start
    /etc/init.d/setroubleshoot start
    # Set screen brightness
    /bin/echo “81″ > /proc/acpi/video/VGA/LCD/brightness
    # Decreases disk activity slightly
    /bin/echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
    # Tweak virtual memory for running on AC.
    /bin/echo 60 > /proc/sys/vm/swappiness
    /bin/echo 3000 > /proc/sys/vm/dirty_expire_centisecs
    /bin/echo 500 > /proc/sys/vm/dirty_writeback_centisecs
    /bin/echo 10 > /proc/sys/vm/dirty_background_ratio
    /bin/echo 40 > /proc/sys/vm/dirty_ratio
    # Enable multi-core power saving tunables
    # configures the scheduler to use only one core if it doesn’t need two
    /bin/echo 1 > /sys/devices/system/cpu/sched_mc_power_savings
    # Enable audio power saving
    /bin/echo 5 > /sys/module/snd_hda_intel/parameters/power_save
    # enable SATA ALPM link power management
    for i in /sys/class/scsi_host/*/link_power_management_policy; do /bin/echo min_power > $i; done
    # Enable wireless power saving
    #/bin/echo 1 > /sys/bus/pci/drivers/iwl3945/*/power_level
    #/sbin/iwconfig wlan0 txpower 25mW
    #/sbin/iwconfig ath0 txpower 25mW
    /sbin/ethtool -s eth0 wol d
    /usr/sbin/cpufreq-selector -g conservative
    #/etc/init.d/undervolt stop
    MODULE=”uhci_hcd i2c_algo_bit crc_ccitt joydev
    serio_raw i2c_i801 firewire_ohci firewire_core
    uvcvideo compat_ioctl32 videodev

    LADEVERSUCHE=3
    for versuch in $LADEVERSUCHE
    do
    for modul in $MODULE
    do
    modprobe $modul
    done
    done
    }

    if [ "`basename $0`" == "batteriebetrieb" ];then
    if [ "$1" == "stop" ]; then netzbetrieb; else batteriebetrieb;fi
    elif [ "`basename $0`" == "netzbetrieb" ];then
    if [ "$1" == "stop" ]; then batteriebetrieb; else netzbetrieb;fi
    fi

  3. Harry

    Update:
    fixed the issue with sysfs.conf
    The solution was embarrassingly simple, all i had to do was remove the spaces in-between the lines… :)

  4. Harry

    More problems my way.
    After editing my sysfs.conf file (and rebooting of course), changes are not applied.
    I have added the following lines:

    # Always use the ondemand CPU frequency governor
    devices/system/cpu/cpu0/cpufreq/scaling_governor = ondemand
    devices/system/cpu/cpu1/cpufreq/scaling_governor = ondemand

    # this enables the lowest power state for Wireless IWL3945
    bus/pci/drivers/iwl3945/0000\:02\:00.0/power_level = 5

    # this enables lowest power state for SATA link host nr. 0,1,2,3,4
    # only for kernel 2.6.24 upwards (ubuntu hardy 8.04)
    class/scsi_host/host0/link_power_management_policy = min_power
    class/scsi_host/host1/link_power_management_policy = min_power
    class/scsi_host/host2/link_power_management_policy = min_power

    # this enables low power state for Realtek HDA audio switch
    # (integer express idle seconds after which to power off the device)
    # note: audio led will toggle blue/amber according to active/powersaving state
    module/snd_hda_intel/parameters/power_save = 10

    …but when i check if they are loaded, by doing cat /sys/……… i see that only the two first lines are applied, setting the cpu 0&1 governors to ‘ondemand’.

    Any ideas?

    Also, adding the OnDemandVBlankInterrupts Option on xorg.conf, causes the system to boot up in Low Graphics Mode… :(

    Using Hardy 64bit on HP DV9542ev….

  5. Harry

    Hi there,
    thanx for this tutorial.
    I can’t understand one thing though: what use is the USB tweaking (webcam, bluetooth) etc.
    if the IDs change at every boot? e.g my SuYin HP WebCam changes from 7-2 to 6-2, etc.
    I have an HP DV-9542ev

  6. aldeby

    Hi yakov!
    SCSI data link power save works in a way that it doesn’t actually affect performance much. The link goes into a power saving state after a few ms there is no data transferred and is very quick at going back at maximum power. On the other hand hard disk spin down have a bigger impact on performance because the hard disk takes much longer to spin up. There is also the wear out factor.
    However, if you carefully tweak your system in order to maximize buffer and cache usage so that it doesn’t have to spin up/down too often, of course hard disk power saving greatly reduces your power consumption. You’ll save much more power than with the scsi link trick.

    As far as I know we shouldn’t take care of the card reader usb port as far as there is no device attached. In fact we don’t have to care of the usb spare ports, only of those that have a device connected to.
    There is no ‘autosuspend’ file at those address not populated.

    You are welcome to experiment and please report your results!

  7. yakov

    2 questions:
    1) if you permanently decrease the scsi data link isnt it better to use hd spin down or something like that?
    2)should you also take care for the card reader usb port or not??
    thanks.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Page visits

    • 5135
  • Polls

    Did you manage using the internal modem?

    View Results

    Loading ... Loading ...
  • Categories

  • Meta

  • Recent Comments

  • Archives

  • Linux On Laptops

    -->