Thinkpad R61 Linux Power Saving
devoted my whole Sunday on researching how can I lower my laptop
power consumption whenworking on battery. A really precious tool
that helped me a lot is
powertop .
Powertop shows which application drains how much from your battery
when your laptop moving on battery, it also gives suggestions for
various optimizations that stretch the battery usage time. First I
took the wrong direction trying to play with powersaved, powernowd.
In case you're curious powernowd is good for controling your CPU
speed and voltage whether powersaved is a power management daemon.
After that I tried to follow some steps on the gentoo's website
buit didn't worked, so I remembered that there was something about
power saving on the thinkwiki's website. After reading a bunch of
pages there and experimenting with acpi. I found out that it's
quite easy to set scripts for execution with acpi, all I had to do
was put the executed script within the appropriate acpi directory.
Two directories were of an interest to me this are the directories
/etc/acpi/battery.d and /etc/acpi/ac.d. The 1st one controls the
events which happen in case laptop is running on battery the latter
one did control what happens in case the laptop is running on AC
power.
So as I said after reading suggested optimizations that could be
made I ended with 2 little shell scripts which I'm gonna paste
below, the 1st one should be putten in /etc/acpi/battery.d, the
second one in the ac.d's dir, I personally did choose the name of
the two shell cripts be power-save.sh you can name it whatever you
like. Be sure to set the executable file on that scripts.
Here are the scripts themselves:
---- CUT HERE ---- /etc/acpi/battery.d
!/bin/sh
hal-disable-polling --device /dev/cdrom
echo 5 > /sys/bus/pci/drivers/iwl3945/0000:03:00.0/power_level
mount -o remount,noatime /
echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo ondemand > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
xbacklight -set 50
hal-disable-polling --device /dev/hda
echo 5 > /proc/sys/vm/laptop_mode
# enable sound card power saving
echo 1 > /sys/module/snd_hda_intel/parameters/power_save
# mute microphone and Line
##amixer set Line mute nocap
amixer set Mic mute nocap
echo 1 > /sys/devices/system/cpu/sched_mc_power_savings
for i in /sys/bus/usb/devices/*/power/autosuspend; do echo 1 > $i; done
# those sysctl's are only available if you have an AHCI compatible SATA
# controler and use kernel > 2.6.24-rc2 (or use Kristen ALPM patchset) :
echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
echo min_power > /sys/class/scsi_host/host1/link_power_management_policy
# turn off the display after 5mn of idling
xset +dpms
xset dpms 0 0 300
# disable tv output
xrandr --output TV --off # for instance (if "xrandr" above listed a connected output named "TV" that you don't use)
# disable CRT and DVI output
echo crt_disable > /proc/acpi/ibm/video
echo dvi_disable > /proc/acpi/ibm/video
# disable wake-on-LAN
ethtool -s eth0 wol d
# force usage of 100Mbits on LAN card
ethtool -s eth0 autoneg off speed 100
# reduce display brightness
xbacklight -set 50
umount /mnt/C
umount /mnt/D
mount -t ntfs-3g -o noatime /dev/sda2 /mnt/C
mount -t ntfs-3g -o noatime /dev/sda5 /mnt/D
#disable uhci-hcd module
rmmod uhci-hcd
killall -9 gnome-power-manager
----------------------
------ CUT HERE ------ /etc/acpi/ac.d/restore.sh
#!/bin/sh
xbacklight -set 100
ethtool -s eth0 autoneg off speed 1000
mount -o remount,noatime /
umount /mnt/C
umount /mnt/D
mount -t ntfs-3g -o atime /dev/sda2 /mnt/C
mount -t ntfs-3g -o atime /dev/sda5 /mnt/D
echo 6 > /sys/bus/pci/drivers/iwl3945/0000:03:00.0/power_level
hal-disable-polling --enable-polling --device /dev/cdrom
echo max_performance > /sys/class/scsi_host/host0/link_power_management_policy
echo max_performance > /sys/class/scsi_host/host1/link_power_management_policy
echo 0 >/proc/sys/vm/laptop_mode
amixer set Mic unmute cap
echo 0 > /sys/module/snd_hda_intel/parameters/power_save
xset -dpms
echo 500 > /proc/sys/vm/dirty_writeback_centisecs
echo 0 > /proc/sys/kernel/nmi_watchdog
for i in /sys/bus/usb/devices/*/power/autosuspend; do echo 0 > $i; done
xrandr --output TV --auto
echo 0 > /sys/devices/system/cpu/sched_mc_power_savings
modprobe uhci-hcd
-----------------------
I'm not using the pcmci slot so I black listed it:
echo pcmci >> /etc/modprobe.d/blacklist
echo yenta_socket >> /etc/modprobe.d/blacklist
In /etc/modprobe.d/ create the file thinkpad_acpi.modprobe and put
the following in it:
options thinkpad_acpi hotkey=enable,0xffffff experimental=1
fan_control=1
The above would enable experimental feature which controls the fan
so when on battery the fan would turn on and off depending on the
thermal indicators of the cpu.
Well that's mostly what I did the battery's estimated time
increased to 3.2, 3.5 h before that it was somewhere around 2.5.
This means a whole hour more for my Laptop on Linux! Hoora! In
order for all this to work you should also read the thinkwiki's
page on power saving you need to have custom hdapsd and custom
kernel. Now Enjoy your prolonged battery time