Problem with LCD backlight remaining on during ACPI sleep

From ThinkWiki
Revision as of 11:06, 15 June 2007 by Dennisg (Talk | contribs) (added uswsusp with -r option)
Jump to: navigation, search

Problem description

On some models the LCD backlight remains on during ACPI sleep.

Affected Models

  • ThinkPad 390X with kernel boot option ACPI=force
  • ThinkPad A30
  • ThinkPad A31p
  • ThinkPad T30
  • ThinkPad X31,X32
  • ThinkPad R51

(according to the relevant bug on the Kernel bug tracker (bug 2576))

Partial solution

If the ThinkPad has a radeon video chip, then switching off the light with the command

 radeontool light off

will work, but only in a text-mode virtual terminal. If X is running, the light apparently comes back on when the kernel switches to text mode prior to sleeping. The solution in that case it to switch to a text mode console first.

logger "Software suspend to ram."
FGCONSOLE=`fgconsole`
chvt 1
radeontool light off
echo -n 3 >/proc/acpi/sleep
logger "Woke up from suspend."
radeontool light on
chvt $FGCONSOLE

Improvements are clearly possible. :-)

On the X32, at least, the bios will switch off the screen by default on a lid close, and suspending to ram interrupts this, and the screen will turn back on. This can be fixed by simply adding "sleep 5" before "echo -n 3 > /proc/acpi/sleep". The suspend will take longer, but the screen will remain off.

A similar script can be found on the acpid configuration HOWTO page.

NOTE!
In Debian Testing (and maybe other Distributions/Debian versions using the hibernate-tool) you can simply uncomment the "RadeonTool yes" line in /etc/hibernate/ram.conf

Using Powersaved

If you use powersaved you can just edit the two scripts prepare_suspend_to_ram and restore_after_suspend_to_ram which are stored in /usr/lib/powersave/scripts/

add two lines to prepare_suspend_to_ram nearly at the end of the script:

 # insert the next two lines:
 chvt 1
 radeontool light off
 # this changes to a console nr. 1 and switches the light off
 
 progress_finish
 $SCRIPT_RETURN $EV_ID 0 "prepare_sleep finished successfully for $1"
 EXIT 0

and to restore_after_suspend_to_ram

 # insert the next two lines:
 radeontool light on
 chvt 7
 # this switching the light on and changes to display #7 (where the x-server runs) - 
 #you can change it to another display if you want... 
 #(the way doing this with a variable like in the script above doesn't work, because it can't be stored between
 #the two different scripts.
 
 # $SCRIPT_RETURN is called in restore_after_sleep.
 EXIT 0

Than you can suspend to ram with /usr/bin/powersave -u or just configure powersaved in a way that it suspends to ram when your notebook is closed. (As a frontend kpowersave is recomended).

Using s2ram

Just using the s2ram command from the uswsusp (Userspace Suspend) package should do the trick by appending the "-r" option (-r, --radeontool: turn off the backlight on radeons before suspending.).