Difference between revisions of "How to make ACPI work"
(added A30p to) |
|||
Line 145: | Line 145: | ||
− | [[Category:570]] [[Category:570E]] [[Category:A20m]] [[Category:A20p]] [[Category:A20m]] [[Category:A20p]] [[Category:A21e]] [[Category:A21m]] [[Category:A21p]] [[Category:A22e]] [[Category:A22m]] [[Category:A22p]] [[Category:A30p]] [[Category:G40]] [[Category:G41]] [[Category:R30]] [[Category:R31]] [[Category:R32]] [[Category:R40]] [[Category:R40e]] [[Category:R50]] [[Category:R50p]] [[Category:R51]] [[Category:R52]] [[Category:T20]] [[Category:T21]] [[Category:T22]] [[Category:T23]] [[Category:T30]] [[Category:T40]] [[Category:T40p]] [[Category:T41]] [[Category:T41p]] [[Category:T42]] [[Category:T42p]] [[Category:T43]] [[Category:T43p]] [[Category:X20]] [[Category:X21]] [[Category:X22]] [[Category:X23]] [[Category:X24]] [[Category:X30]] [[Category:X31]] [[Category:X32]] [[Category:X40]] [[Category:X41]] [[Category:X41 Tablet]] | + | [[Category:570]] [[Category:570E]] [[Category:A20m]] [[Category:A20p]] [[Category:A20m]] [[Category:A20p]] [[Category:A21e]] [[Category:A21m]] [[Category:A21p]] [[Category:A22e]] [[Category:A22m]] [[Category:A22p]] [[Category:A30]] [[Category:A30p]] [[Category:A31]] [[Category:A31p]] [[Category:G40]] [[Category:G41]] [[Category:R30]] [[Category:R31]] [[Category:R32]] [[Category:R40]] [[Category:R40e]] [[Category:R50]] [[Category:R50p]] [[Category:R51]] [[Category:R52]] [[Category:T20]] [[Category:T21]] [[Category:T22]] [[Category:T23]] [[Category:T30]] [[Category:T40]] [[Category:T40p]] [[Category:T41]] [[Category:T41p]] [[Category:T42]] [[Category:T42p]] [[Category:T43]] [[Category:T43p]] [[Category:X20]] [[Category:X21]] [[Category:X22]] [[Category:X23]] [[Category:X24]] [[Category:X30]] [[Category:X31]] [[Category:X32]] [[Category:X40]] [[Category:X41]] [[Category:X41 Tablet]] |
Revision as of 01:36, 15 August 2005
Contents
general
Kernel configuration
First of all you'll have to enable ACPI support in your kernel (if your distro doesn't already have an ACPI enabled kernel). To do this open your kernel config and enable ACPI Power Management: CONFIG_PM → <*> → Power Management support → Power management options → CONFIG_ACPI_SLEEP → <*> → ACPI → Power management options →
You'd most likely want to enable the following ACPI options: CONFIG_ACPI_SLEEP → <*> → Sleep States → ACPI → Power management options CONFIG_ACPI_AC → <*> → AC Adapter → ACPI → Power management options CONFIG_ACPI_BATTERY → <*> → Battery → ACPI → Power management options CONFIG_ACPI_FAN → <*> → Fan → ACPI → Power management options CONFIG_ACPI_PROCESSOR → <*> → Processor → ACPI → Power management options CONFIG_ACPI_THERMAL → <*> → Thermal Zone → ACPI → Power management options
If you prefer editing your .config file directly, you should set at least the following variables:
CONFIG_PM=y CONFIG_ACPI_BOOT=y CONFIG_ACPI_INTERPRETER=y CONFIG_ACPI_SLEEP=y CONFIG_ACPI_SLEEP_PROC_FS=y CONFIG_ACPI_AC=y CONFIG_ACPI_BATTERY=y CONFIG_ACPI_BUTTON=y CONFIG_ACPI_FAN=y CONFIG_ACPI_PROCESSOR=y CONFIG_ACPI_THERMAL=y CONFIG_ACPI_BUS=y CONFIG_ACPI_EC=y CONFIG_ACPI_POWER=y CONFIG_ACPI_PCI=y CONFIG_ACPI_SYSTEM=y
Then recompile your kernel.
IBM specific ACPI driver
Unfortunately, special drivers for ACPI on ThinkPads were not included with kernels prior 2.6.10. So you'll have to compile one yourself or get it as precompiled module for your kernel.
You have the choice between thinkpad-acpi and ibm-acpi, with the latter being the recommended one.
If you use a post-2.6.10 kernel and you want to use ibm-acpi, it is recommended to look on its projects page for a possibly newer version.
ACPI daemon
Also you'll need to install acpid, if it isn't present on your system. acpid is a daemon that handles the ACPI events generated by the system. Read How to configure acpid.
Screen blanking (Standby)
Make sure you have
Option "DPMS"
in the Monitor section of your /etc/X11/XF86Config or /etc/X11/xorg.conf.
Running {{{2}}} xset +dpms
and then {{{2}}} xset dpms force off
will turn off the backlight on a laptop screen.
Note that this may not work in combination with {{{2}}} echo -n "mem" > /sys/power/state
because switching to console causes the backlight to come back on before sleeping.
Suspend to RAM (Sleep)
ACPI Sleep/suspend-to-ram with recent 2.6.x kernels usually works fine. Have a look at the acpid configuration HOWTO. It includes a specific example for going to sleep on lid close.
The following glitches may or may not occur in relation to suspending to RAM:
- With a 2.6.9 or 2.6.10 kernel, when resuming from a suspend-to-ram the display might remain black (the system is still rebootable via ctrlaltdel). This can be fixed by adding
acpi_sleep=s3_bios
to the kernel boot parameters. It seems this problem is solved in 2.6.11-rc1, but is reported to be needed on 2.6.12.3. - When your system is equiped with a Radeon Mobility graphic controller your LCD backlight may not turn off automatically. Use radeontool to switch off your backlight prior suspend in your sleep action script.
- Also, you might want to take note of the Problem with high power drain in ACPI sleep.
- You may experience problems when using
# echo standby > /sys/power/state
(machine goes to sleep and wakes up immediately). This can be avoided by using# echo -n 3 >/proc/acpi/sleep
to get it to sleep. This can be also happen if hotplug daemon is still running. - Problems with the serial port of the port replicator after the wake up from ram have also been experienced.
- Crash on resume
- ...when using ATI proprietary drivers can be solved by using vbetool.
- ...might be solved by disabling APIC (@Processor type and features) in the kernel configuration
- If your suspend is failing, and a tail of /var/log/acpid shows "Permission denied" errors, be sure that your new ACPI event and action scripts have the appropriate permissions
- Due to the fact that Sonoma chipset based laptops (T43, T43p) utilize the SATA layer for disk access and SATA does not have power-management support yet Suspend to RAM does not work on these machines. However, Jens Axboe's patch ([1] LKML posting) provides SATA power-management support and makes Suspend to RAM work on the T43 at least. (Tested on 2.6.12rc6 which the patch applies to with some offsets. T43p not tested but should work as well. X41: reboot after wake up. R52 uses SATA and sleep doesn't work, so it is probably affected too)
Suspend to disk (Hibernate)
There are two drivers for this available:
- swsusp, which is in the kernel and
- SoftwareSuspend2 which is more feature rich, but not yet in the kernel, so you have to patch it in yourself
Both are reported to work fine as long as you use open-source graphic drivers. A comparison of the features can be found on this page.
Just in case you are in doubt...yes, it is safe in both cases to use the same swap partition as active swap and as suspend partition.
using swsusp
Software Suspend (swsusp) is included in the 2.6 kernel series. It seems like no patches for 2.4 kernels are available.
To enable software suspend change your kernel config as follows: CONFIG_PM → <*> → Power management support → Power management options → CONFIG_SOFTWARE_SUSPEND → <*> → Software Suspend → Power management options → CONFIG_PM_STD_PARTITION → [/dev/resume_partition] → Default resume partition → Power management options →
/dev/resume_partition needs to be replaced by the swap partition you want to use for suspending. (Use # fdisk -l /dev/hda
if unsure.)
You can override the default resume partition anytime by giving resume=/dev/resume_partition
as kernel boot parameter.
Also, in case you suspended, but want to boot up normally (without resuming from the saved image - losing all data that was unsaved at suspend time), you can give the noresume kernel boot parameter.
(In my case, and according to reports from several people, suspending does not work if resume_partition is specified in the kernel config (my version is 2.6.12-3 from kernel.org). It works as a charm if one specifies the resume partition as a kernel parameter instead.)
To suspend you can either do a simple # echo -n 4 > /proc/acpi/sleep
(recommended) or use the patched SysVInit and call # swsusp
or # shutdown -z now
.
Ideally you would do this from a script like /etc/acpi/actions/hibernate.sh. It has proven to be a good idea to shutdown the following processes/drivers within the script before you do the actual suspend.
- any running mysql server
- the linuxant driver may require stopping in a acpi script as well.
# dldrstop
does the trick.
Afterwards you might want to enable them again, as well as run a script that does necessary configurations according to the ac power state. Furthermore, the system clock is not readjusted automatically, so you will probably also want the do that from that script (i.e. by restarting your systemclock bootup script).
If the sound output is silent after resume, these commands might help to get sound to work again without reloading any modules:
amixer set Master mute >/dev/null 2>&1 amixer set PCM mute >/dev/null 2>&1 amixer set Master unmute >/dev/null 2>&1 amixer set PCM unmute >/dev/null 2>&1
Finally you should take note that swsusp does not set the ACPI S4 state. Instead it goes to S5. This means that the machine itself doesn't know that it was suspend rather than shutdown. Hence you can i.e. boot a parallel installed other operating system and resume your linux session later, as long as you don't touch the swap partition the image was saved to.
using SoftwareSuspend2
First apply Software Suspend 2 patches from http://softwaresuspend.berlios.de/ if they are not already in your kernel.
Be sure to also read the http://softwaresuspend.berlios.de/HOWTO.html
These are the options for the kernel. Make sure to change the /dev/resume_partition to your swap partition, i.e. /dev/hda5.
# Software Suspend 2 CONFIG_SOFTWARE_SUSPEND2=y CONFIG_SOFTWARE_SUSPEND2_BUILTIN=y CONFIG_SOFTWARE_SUSPEND_SWAPWRITER=y CONFIG_SOFTWARE_SUSPEND_LZF_COMPRESSION=y CONFIG_SOFTWARE_SUSPEND_TEXT_MODE=y CONFIG_SOFTWARE_SUSPEND_DEFAULT_RESUME2="/dev/resume_partition" # CONFIG_SOFTWARE_SUSPEND_KEEP_IMAGE is not set CONFIG_SOFTWARE_SUSPEND_CHECK_RESUME_SAFE=y # CONFIG_SOFTWARE_SUSPEND_DEBUG is not set # CONFIG_SOFTWARE_SUSPEND_DEVELOPER is not set
Next, compile and install the kernel.
In the meantime, add the following to the kernel parameters: resume2=swap:/dev/resume_partition
. Again change /dev/resume_partition to your swap partition.
Install the hibernation script:
- For Gentoo users: emerge hibernate-script
- For Fedora users: kernel and hibernate RPMs are available at http://mhensler.de/swsusp/
- For all other users, check the home page for packages (deb, i386 rpm, tgz, and source rpm) from http://softwaresuspend.berlios.de/
- Debian users using initrd image, make sure you copy swsusp-initrd.sh script to your /etc/mkinitrd/scripts directory before creating initrd image.
Restart using the new kernel and run the script to test it: # /usr/sbin/hibernate