I'm not familiar with laptop power management internals, and I have a bit of a problem with Ubuntu 11.10 and HP Envy 14. Waking up from sleep (opening the lid) causes a cooler to spin on maximum speed, it becomes really loud and unpleasant. Where should I start looking? I suppose one of the devices can start sucking power on wake up?
1 Answer
This works for me on HP Envy 14 running 11.10, from http://linuxenvy.blogspot.com/2011/09/ive-been-being-lazy.html?showComment=1315427419402#c4396376300869253470:
I put a script in my /usr/lib/pm-utils/sleep.d which switches the discrete gpu ON when suspending and turns it back OFF (if it was OFF when suspending). Now my power consumption is the same before and after suspend. Just like when disabling the discrete gpu in bios. I first tried putting the script in /etc/pm/sleep.d, that didn't execute on my system (Ubuntu 11.04/lenvyx 64-bit + ugr). Not sure where to put it on other distros. You can get the script here if interested http://dl.dropbox.com/u/5227387/09_toggle_discrete_gpu, use at your own risk.
After copying the script to /usr/lib/pm-utils/sleep.d
, make it executable:
sudo chmod +x /usr/lib/pm-utils/sleep.d/09_toggle_discrete_gpu
In case the DropBox link disappears, here is the code in 09_toggle_discrete_gpu
:
#!/bin/sh
#Script to switch on discrete graphics at suspend to avoid suspend bug on ENVY 14,
#causing increased power consumption after suspend.
#Author Tinux, line 11-39 stolen almost directly from RM's "switch_between_cards.sh"
#from at http://asusm51ta-with-linux.blogspot.com/
#DISCLAIMER: I only tested this on my own system and I take no responsibility for any
#harm it might cause to your hardware or software
. "${PM_FUNCTIONS}"
suspend_nm()
{
pci_integrated=$(lspci | grep VGA | sed -n '1p' | cut -f 1 -d " ")
pci_discrete=$(lspci | grep VGA | sed -n '2p' | cut -f 1 -d " ")
integrated=$(cat /sys/kernel/debug/vgaswitcheroo/switch | grep $pci_integrated | grep -o -P ':.:...:')
discrete=$(cat /sys/kernel/debug/vgaswitcheroo/switch | grep $pci_discrete | grep -o -P ':.:...:')
if [ "$integrated" = ":+:Pwr:" ]
then
integrated_condition=1
elif [ "$integrated" = ": :Pwr:" ]
then
integrated_condition=1
elif [ "$integrated" = ": :Off:" ]
then
integrated_condition=0
fi
if [ "$discrete" = ":+:Pwr:" ]
then
discrete_condition=1
elif [ "$discrete" = ": :Pwr:" ]
then
discrete_condition=1
elif [ "$discrete" = ": :Off:" ]
then
discrete_condition=0
fi
#Switch ON discrete graphics
if [ $discrete_condition = 0 ]
then
echo ON > /sys/kernel/debug/vgaswitcheroo/switch
fi
echo $discrete_condition > /tmp/condition
}
resume_nm()
{
#Swtich OFF discrete graphics
if [ -e /tmp/condition ]
then
discrete_condition=`cat /tmp/condition`
rm /tmp/condition
fi
if [ $discrete_condition = 0 ]
then
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
fi
}
case "$1" in
hibernate|suspend)
suspend_nm
;;
thaw|resume)
resume_nm
;;
*) exit $NA
;;
esac