[ltp] Aggressive Powersaving

Pedro Ribeiro linux-thinkpad@linux-thinkpad.org
Tue, 9 Feb 2010 13:28:33 +0000


2010/2/9 Karsten K=F6nig <remur@gmx.net>:
> Heya,
>
> the new kernels really brought down the power consumption and I am intere=
sted
> in getting it a little bit further, on the road I don't use my DVD drive =
nor
> ExpressCard nor USB nor Firewire nor Touchpad, is there a way to cleany c=
ut
> the power to these devices/buses?
>
> I don't know about VGA and modem, but I think they aren't that easy acces=
sible
> because they are part of the graphics driver and alsa (it does drive the
> winmodem right?)
>
> Or is there nothing to gain? I noticed pulling out the dvd drive was ~0.5=
W
> less, so I take it getting the other stuff offline might be nice too.
>
> I don't mind echos to some sysfs file, the simpler the better, I just wan=
t to
> make a small script which I can run as root to just get power down
> aggressivly.
>
>
> Thanks for your ideas,
> Karsten
> --
> The linux-thinkpad mailing list home page is at:
> http://mailman.linux-thinkpad.org/mailman/listinfo/linux-thinkpad
>

Hi Carsten,

I use the script below and I'm able to get -1.5w . Some parts are in
portuguese, but they are understandable.

You can grab the ultrabay DVD eject script off thinkwiki. When you
want to power it on again, you can just press the eject button.

--------------------------------------------------------

FindMouseAndSuspend()
{
 local mouse_location

 if [ `cat /sys/bus/usb/devices/6-2/manufacturer | grep Logitech` ]
 then
    mouse_location=3D"6-2"
 else if [ `cat /sys/bus/usb/devices/6-1/manufacturer | grep Logitech` ]
    then
       mouse_location=3D"6-1"
    else if [ `cat /sys/bus/usb/devices/2-1/manufacturer | grep Logitech` ]
       then
          mouse_location=3D"2-1"
       fi
     fi
 fi

 if [ $mouse_location ]
 then
   echo 60 > /sys/bus/usb/devices/$mouse_location/power/autosuspend
   echo auto > /sys/bus/usb/devices/$mouse_location/power/level
 fi
}

FindMouseAndDisableSuspend()
{
 if [ `cat /sys/bus/usb/devices/6-2/manufacturer | grep Logitech` ]
 then
    mouse_location=3D"6-2"
 else if [ `cat /sys/bus/usb/devices/6-1/manufacturer | grep Logitech` ]
    then
       mouse_location=3D"6-1"
    else if [ `cat /sys/bus/usb/devices/2-1/manufacturer | grep Logitech` ]
       then
          mouse_location=3D"2-1"
       fi
     fi
 fi
 if [ $mouse_location ]
 then
   echo on > /sys/bus/usb/devices/$mouse_location/power/level
 fi
}

sleep 5.0s

# Auto suspends usb camera
echo auto > /sys/bus/usb/devices/1-6/power/level
=09
# disable ao bluetooth
echo disable > /proc/acpi/ibm/bluetooth

if acpi -a | grep 'off-line'
then
=09
	# disable ao wake on lan
	ethtool -s eth0 wol d
=09
	# ejecta a ultrabay
	/usr/local/sbin/ultrabay_eject
=09
	# suspende o rato
	FindMouseAndSuspend
=09
	# manda foder o firewire
	#modprobe -r firewire_ohci
	modprobe -r ohci1394
=09
	# desliga o som ap=F3s 10 segundos de inactividade
	echo 10 > /sys/module/snd_hda_intel/parameters/power_save
=09
	# liga o acoustic power management
	hdparm -M 128 /dev/sda
=09
	# activa o laptop mode
	echo 5 > /proc/sys/vm/laptop_mode

   # ... e os parametros da VM
   echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
=09
	# poe o SATA ALPM a min power
	echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
   exit 0
else
=09
	# disable ao mouse suspend
	FindMouseAndDisableSuspend
=09
	# desliga o powersaving do som
	echo 0 > /sys/module/snd_hda_intel/parameters/power_save
=09
	# desliga o acoustic power management
	hdparm -M 254 /dev/sda
=09
	# desactiva o laptop mode
	echo 0 > /proc/sys/vm/laptop_mode
=09
   # ... e restaura os parametros por default da VM
   echo 500 > /proc/sys/vm/dirty_writeback_centisecs
	=09
	# poe o SATA ALPM de volta a performance
	echo max_performance > /sys/class/scsi_host/host0/link_power_management_po=
licy
	exit 0
fi