As said earlier, Ubuntu 12.04 does a good job with power management on the 4720s. With some manual settings power consumption can be further decreases, albeit not much this time. I wrote this script which takes a parameter:
on: enable power management settings
off: disable power management settings
extra: on + enable extensive power management settings. This is a point of no return, i.e. it unloads modules, disables CPU cores, switches off the wireless lan. I have not found a way to re-enable these, thus a full reboot is required.
#!/bin/sh
COMMAND=$1
DIRECTION="unload"
switch_module () {
case $DIRECTION in
"unload")
rmmod -f $1 || echo cannot remove $1
;;
"load")
insmod $1 || echo cannot insert $1
;;
esac
}
switch_service () {
case $DIRECTION in
"unload")
/etc/init.d/$1 stop || echo cannot stop $1
;;
"load")
/etc/init.d/$1 start || echo cannot start $1
;;
esac
}
# Increase filesystem write cache timeout
echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
case $COMMAND in
on|extra)
# Enable power management on all PCI devices
find /sys/devices/pci* -path "*power/control" -exec bash -c "echo auto > '{}'" \;
# Increase pulseaudio buffers
for i in `find /proc/asound/* -path */prealloc`; do echo 4096 > $i; done;
# Enable power aware CPU scheduler
echo 1 > /sys/devices/system/cpu/sched_mc_power_savings
# Enable WLAN power management
iwconfig wlan0 power on
iwconfig wlan0 txpower auto
# Disable NMI watchdog
echo 0 > /proc/sys/kernel/nmi_watchdog
# Enable Intel audio power management
echo 1 > /sys/module/snd_hda_intel/parameters/power_save
# Enable SATA power management
for i in /sys/class/scsi_host/host*/link_power_management_policy; do echo min_power > $i; done
for i in `find /sys/devices/system/cpu/*/cpufreq/scaling_governor`; do echo ondemand > $i; done;
for i in `find /sys/devices/*/power/control`; do echo auto > $i; done;
for i in `find /sys/bus/usb/devices/*/power/level`; do echo auto > $i; done;
for i in `find /sys/bus/usb/devices/*/power/autosuspend`; do echo 2 > $i; done;
for i in `find /sys/class/scsi_host/host*/link_power_management_policy`; do echo min_power > $i; done
for i in `find /sys/bus/pci/devices/*/power/control`; do echo auto > $i; done
for i in `find /sys/bus/i2c/devices/*/power/control`; do echo auto > $i; done
for i in `find /sys/bus/spi/devices/*/power/control`; do echo auto > $i; done
# Enable laptop mode tools
echo 5 > /proc/sys/vm/laptop_mode
# Override PCIE power management
echo powersave > /sys/module/pcie_aspm/parameters/policy
# Disable wake on lan for LAN
ethtool -s eth0 wol d || echo not setting wol on eth0
# Stop mysql
switch_service mysql
# stop ntp
switch_service ntp
# stop cron and anacron
switch_service cron
switch_service anacron
# stop cups
switch_service cups
#disable bluetooth
hciconfig hci0 down || echo skip bluetooth
# harddisk
hdparm -B127 /dev/sda
;;
esac
case $COMMAND in
extra)
# stop irqbalance
switch_service irqbalance
# stop pulseaudio
switch_service pulseaudio
#disable USB polling
(udisks --inhibit-all-polling)&
#disable syndaemon keyboard polling
killall syndaemon
#disable update notifier
killall update-notifier
# network
switch_service winbind
switch_service network-manager
#disable CPUs
echo 0 > /sys/devices/system/cpu/cpu1/online
echo 0 > /sys/devices/system/cpu/cpu2/online
echo 0 > /sys/devices/system/cpu/cpu3/online
switch_module btusb
switch_module bluetooth
switch_module hp-wmi
switch_module parport
switch_module joydev
switch_module lp
switch_module ppdev
switch_module parport
#switch_module ums_realtek
#switch_module usb_storage
switch_module r8169
switch_module vboxpci
switch_module vboxnetadp
switch_module vboxnetflt
switch_module vboxdrv
switch_module snd_hda_codec_hdmi
switch_module mei
switch_module rt2800pci
switch_module rt2800lib
switch_module rt2x00pci
switch_module rt2x00lib
switch_module mac80211
switch_module cfg80211
switch_module uas
switch_module wmi
switch_module msr
switch_module video
;;
off)
DIRECTION="load"
# Enable power management on all PCI devices
find /sys/devices/pci* -path "*power/control" -exec bash -c "echo off > '{}'" \;
# Enable power aware CPU scheduler
echo 0 > /sys/devices/system/cpu/sched_mc_power_savings
# Enable WLAN power management
iwconfig wlan0 power off
iwconfig wlan0 txpower auto
# Enable Intel audio power management
echo 0 > /sys/module/snd_hda_intel/parameters/power_save
# Enable SATA power management
for i in /sys/class/scsi_host/host*/link_power_management_policy; do echo max_performance > $i; done
# Enable laptop mode tools
echo 1 > /proc/sys/vm/laptop_mode
# Override PCIE power management
echo performance > /sys/module/pcie_aspm/parameters/policy
# Disable wake on lan for LAN
ethtool -s eth0 wol u || echo not setting wol on eth0
# start mysql
switch_service mysql
# start ntp
switch_service ntp
# start cron and anacron
switch_service cron
switch_service anacron
# start cups
switch_service cups
# harddisk
hdparm -B255 /dev/sda
#enable bluetooth
hciconfig hci0 up || echo skip bluetooth
# network
switch_service winbind
switch_service network-manager
switch_module btusb
switch_module bluetooth
switch_module hp-wmi
switch_module parport
switch_module joydev
switch_module lp
switch_module ppdev
switch_module parport
#switch_module ums_realtek
#switch_module usb_storage
switch_module r8169
switch_module vboxpci
switch_module vboxnetadp
switch_module vboxnetflt
switch_module vboxdrv
switch_module snd_hda_codec_hdmi
switch_module mei
switch_module rt2800pci
switch_module rt2800lib
switch_module rt2x00pci
switch_module rt2x00lib
switch_module mac80211
switch_module cfg80211
switch_module uas
switch_module wmi
switch_module msr
switch_module video
;;
esac
Hi, could you please write how much power your laptop uses after running this script?
LikeLike
Hello Nurian,
I upgraded yesterday to 12.10 and can't check how much the script did for 12.04. I remeber that with idle load 12.04 used to consume about 12.5 watt on the 4720s, I think with the script it went down to 12 watt with running harddisk and about 10.5 watt with harddisk on standby.
LikeLike