HP-Envy 14 Power Tweaks - Updated

Battery life on my HP-envy is down right horrible in Linux - Fedora 16 by default results in only about two hours of operation before it shuts down (and is about 60c) when compared to the almost 5 hours of running time in Windows 7. Here are some tweaks to improve it to 5+ hrs with minor use and minimal wifi:

Prerequisite packages:

Install the following:

  1. sudo yum install pm-utils tuned
  2. sudo chkconfig tuned on

Install Jupiter and get it configured

  1. wget http://sourceforge.net/projects/jupiter/files/jupiter-0.1.2-1.noarch.rpm/download
  2. sudo rpm -ivh jupiter-0.1.2-1.noarch.rpm

It should startup automatically, however, you can verify this with a reboot or by running the following command (not as root):

gnome-session-properties

Edit the kernel parameters:

  1. sudo vi /etc/default/grub
  2.  
  3. GRUB_TIMEOUT=5
  4. GRUB_DISTRIBUTOR="Fedora"
  5. GRUB_DEFAULT=saved
  6. GRUB_CMDLINE_LINUX="rd.md=0 rd.dm=0 rd.lvm.lv=VolGroup/lv_swap  KEYTABLE=us quiet SYSFONT=latarcyrheb-sun16 rhgb rd.lvm.lv=VolGroup/lv_root rd.luks=0 LANG=en_US.UTF-8 acpi_osi=Linux video.brightness_switch_enabled=1 video.use_bios_initial_backlight=0 pcie_aspm=force i915.i915_enable_fbc=1 i915.i915_enable_rc6=1 modeset=1 usbcore.autosuspend=1 hpet=force"

Install the new grub parameters by running the following commands:

  1. sudo grub2-mkconfig -o /boot/grub2/grub.cfg
  2. sudo grub2-install --boot-directory=/boot /dev/sda
  3.  
  4. # Note: your drive may have another device name. Check for it with mount command output.

Create the powersave profile

This section creates the powersave profile which will be activated when the laptop is on battery. I have taken this from numerous sources and made it look like the following with my own additions.

  1. #!/bin/sh
  2. # Power saving script
  3.  
  4. # List of modules to unload, space seperated. Edit depending on your hardware and preferences.
  5. modlist="uvcvideo"
  6. # Bus list for runtime pm. Probably shouldn't touch this.
  7. buslist="pci spi i2c"
  8.  
  9. case "$1" in
  10.     true)
  11.    
  12.     # Couple of simple screen tweaks
  13.     xgamma --gamma 0.75
  14.     xset dpms 0 0 120
  15.    
  16.     # Lower power using ethtool
  17.         ethtool -s em1 wol d
  18.        
  19.         #Turn off watchdog
  20.         echo 0 > /proc/sys/kernel/nmi_watchdog
  21.        
  22.         # Turn on multithread power savings
  23.         echo 1 > /sys/devices/system/cpu/sched_mc_power_savings
  24.  
  25.         # Turn ondemand powergovener
  26.         echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
  27.         echo ondemand > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
  28.         echo ondemand > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
  29.         echo ondemand > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
  30.  
  31.         # Hard drive parameters for better savings
  32.         echo "30000" > /proc/sys/vm/dirty_writeback_centisecs
  33.         hdparm -B1 /dev/sda
  34.  
  35.         # Disable cd-drive polling
  36.         hal-disable-polling --device /dev/scd0
  37.  
  38.         # PCU link power management
  39.     echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
  40.         echo min_power > /sys/class/scsi_host/host1/link_power_management_policy
  41.  
  42.         # Enable laptop mode
  43.     echo 5 > /proc/sys/vm/laptop_mode
  44.      
  45.         # Intel power saving
  46.         echo Y > /sys/module/snd_hda_intel/parameters/power_save_controller
  47.         echo 1 > /sys/module/snd_hda_intel/parameters/power_save
  48.  
  49.     # Set backlight brightness to 50%
  50.     echo 5 > /sys/devices/virtual/backlight/acpi_video0/brightness
  51.         echo 5 > /sys/devices/pci0000:00/0000:00:02.0/backlight/acpi_video0/brightness
  52.    
  53.     # USB powersaving
  54.         for i in /sys/bus/usb/devices/*/power/autosuspend; do
  55.                 echo 1 > $i
  56.         done
  57.  
  58.         # Turnoff bluetooth
  59.         rfkill block bluetooth
  60.  
  61.         # audio
  62.         amixer set Line mute nocap
  63.         amixer set Mic mute nocap
  64.  
  65.         # usb stuff
  66.         for i in /sys/bus/usb/devices/*/power/autosuspend; do echo 1 > $i; done
  67.         for i in /sys/bus/usb/devices/*/power/level; do echo auto > $i; done
  68.  
  69.     # SATA power saving
  70.         for i in /sys/class/scsi_host/host*/link_power_management_policy; do
  71.                 echo min_power > $i
  72.         done
  73.    
  74.     # Disable hardware modules to save power
  75.         for mod in $modlist; do
  76.                 grep $mod /proc/modules >/dev/null || continue
  77.                 modprobe -r $mod 2>/dev/null
  78.         done
  79.    
  80.     # Enable runtime power management. Suggested by powertop.
  81.         for bus in $buslist; do
  82.                 for i in /sys/bus/$bus/devices/*/power/control; do
  83.                         echo auto > $i
  84.                 done
  85.         done
  86.     ;;
  87.     false)
  88.        #Return settings to default on AC power
  89.  
  90.                 hal-disable-polling --enable-polling --device /dev/scd0 # or whatever your CD drive is
  91.                 echo 0 > /sys/devices/system/cpu/sched_mc_power_savings
  92.  
  93.         echo 0 > /proc/sys/vm/laptop_mode
  94.         echo 500 > /proc/sys/vm/dirty_writeback_centisecs
  95.         echo N > /sys/module/snd_hda_intel/parameters/power_save_controller
  96.         echo 0 > /sys/module/snd_hda_intel/parameters/power_save
  97.         echo 10 > /sys/devices/virtual/backlight/acpi_video0/brightness
  98.        
  99.         for i in /sys/bus/usb/devices/*/power/autosuspend; do
  100.             echo 2 > $i
  101.         done
  102.         for i in /sys/class/scsi_host/host*/link_power_management_policy
  103.             do echo max_performance > $i
  104.         done
  105.         for mod in $modlist; do
  106.             if ! lsmod | grep $mod; then
  107.                 modprobe $mod 2>/dev/null
  108.             fi
  109.         done
  110.         for bus in $buslist; do
  111.             for i in /sys/bus/$bus/devices/*/power/control; do
  112.                 echo on > $i
  113.             done
  114.         done
  115.     ;;
  116. esac
  117.  
  118. exit 0

Run the following:

  1. sudo chmod a+x  /etc/pm/power.d/powersave
  2. sudo /etc/pm/power.d/powersave true
  3. sudo pm-powersave true

If you have any other suggestions - let me know!

Blog tags: 

Comments

Winning!

Just got a HP Envy Beats 2002ea. It wasn't working with gnome 3. Your solution has solve this problem and improved my battery life. Thanks!!!

Good Post

it is actually highly content. You have spent long time for this post. It's a very useful and interesting site.

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.