Difference between revisions of "Suspend/Resume Support For SATA Link Power Management"
(â†Created page with '== Synopsys == One good way to save power with a dynticks-enabled kernel is to set [http://www.lesswatts.org/tips/disks.php SATA link power management] to minimum pow...') |
(No difference)
|
Latest revision as of 01:18, 5 May 2008
Synopsys
One good way to save power with a dynticks-enabled kernel is to set SATA link power management to minimum power. However, if you do that you will probably experience long delays when resuming from suspend-to-disk. If, like Ubuntu Hardy, your distribution uses pm-suspend, the following script placed in /etc/pm/sleep.d/99sata will set the link power to maximum performance just before suspending, and restore it to whatever it was upon resume.
#!/bin/bash
[ -d /sys/class/scsi_host/ ] || exit 0
. /usr/lib/pm-utils/functions
suspend_sata()
{
pushd /sys/class/scsi_host/ > /dev/null 2>&1
local host
for host in $(ls -1); do
if [ -e ${host}/link_power_management_policy ]; then
local policy=$(cat ${host}/link_power_management_policy)
savestate ${host}_link_power_management_policy "${policy}"
echo max_performance > ${host}/link_power_management_policy
fi
done
popd
}
resume_sata()
{
pushd /sys/class/scsi_host/ > /dev/null 2>&1
local host
for host in $(ls -1); do
if [ -e ${host}/link_power_management_policy ]; then
local policy=$(restorestate $(echo ${host}_link_power_management_policy))
echo ${policy} > ${host}/link_power_management_policy
fi
done
popd
}
case "$1" in
suspend|hibernate)
suspend_sata
;;
resume|thaw)
resume_sata
;;
*)
;;
esac
exit $?