Dell Latitude C800 and CPxH500 w/ATI video – Suspend to disk and ram!!!

NOTE: Updated 3/3/06:

BOOYAH! – I think I now have the last word on getting this box to properly suspend / resume in Linux! WOO-HOO! NOTE: This box is a Dell Latitude C800 with the ATI “RAGE” Mobility video card and I use the “r128” driver for it. After MUCH research off & on since I got this box a couple of years ago, here’s what works:

1) Simply Mepis (Stock kernel 2.6.7+)
2) Use ACPI (Not APM). Here’s my grub config: (hda6 is my swap partition)

In /boot/grub/menu.lst, you need 2 entries (1 for suspend/resume AND one for “noresume”, in case
your suspend honks up and or you wish to boot fresh without attempting to resume. I use the following 2 grub entries:

title MEPIS at hda7, kernel 2.6.7
kernel (hd0,6)/boot/vmlinuz-2.6.7 root=/dev/hda7 nomce psmouse.proto=ps2 quiet splash=verbose vga=791 acpi=off apm=power_off noacpi pnpbios=on
initrd (hd0,6)/boot/initrd.mepis
savedefault

title MEPIS w/SUSPEND/RESUME, kernel 2.6.7
kernel (hd0,6)/boot/vmlinuz-2.6.7 root=/dev/hda7 nomce psmouse.proto=ps2 quiet splash=verbose vga=791 acpi=on pnpbios=on resume=/dev/hda6
initrd (hd0,6)/boot/initrd.mepis
savedefault

========== END GRUB CONFIGURATION ===========

Also note: For ACPI, my volume keys quit working, so I had to use Hotkey and setkeycodes
to restore their operation (see later post on this!)

3) The following modules: acpid, hibernate, and vbetool (for Suspend-2-RAM)
4) Video DRI turned OFF (Comment out the lines: “Load dri”, “Section DRI”, “Mode 0666”, and “EndSection” in /etc/X11/XF86Config-4). NOTE: This step does not appear to be necessary on the Latitude CPxH500, at least for s2ram.

5) The following script for suspend-2-disk (run as root) (I call it /usr/local/bin/s2disk):

#!/bin/sh

# shut off things that can’t handle hibernation (usb and alsa)
/etc/init.d/alsa stop
modprobe -r usbhid ohci_hcd uhci_hcd

# this does the actual hibernation
#### echo > /proc/swsusp/activate
sync
/bin/echo 4 > /proc/acpi/sleep

# re-activate things after a resume (alsa & usb)
hwclock –hctosys
modprobe uhci_hcd
modprobe ohci_hcd
modprobe usbhid
/etc/init.d/alsa start

========= END SCRIPT =========

On a Latitude CPxH500 w/ATI RAGE, above works great for suspending to RAM as well (all you need to do is change the “4” to a “3”) – hibernate is not required! On the C800, however, you must use “hibernate” to suspend to RAM. to do so, do the following:

First backup and edit /etc/hibernate/hibernate.com as follows:

1) Comment out 1st four lines under “swsusp2_15” (should be lines 4-7) including any lines about “Compressor” or “Encryptor”.
2) Uncomment out the 2 lines: “UseSysfsPowerState mem” and “PowerdownMethod shutdown” (lines 49-50, I think).
3) Under the “modules” section, add the line:

UnloadModules usbhid ohci_hcd uhci_hcd 3c59x sg

4) Under the “network” section, uncomment the 2 lines: “DownInterfaces ” and “UpInterfaces auto”.
5) Apend “eth0″ to the DownInterfaces” line (should say: “DownInterfaces eth0”.
6) Under “vbetool” section, uncomment the lines: “EnableVbetool yes” and “VbetoolPost yes”.

Then, to suspend, simply invoke: “sudo hibernate”.

What all this does is make sure that the modules “usbhid, ohci_hcd, uhci_hcd, 3c59x, and sg” are temporarily removed for suspends – otherwise, usb and or the keyboard and mouse are hosed after resuming. Also have to take down the wired network driver “3c59x” when suspending to RAM.

I have both a built-in 3c59x nic (hurricane) and a docking station 3c59x nic (tornado) plus a wireless Orinoco nic. In order to suspend when using any or both of these, I wrote the following
script for suspend-2-ram to invoke hibernate (I call it /usr/local/bin/s2ram):

#!/usr/bin/perl

use LoadHtml;

&SetRegices(-numbers => 0, -hashes => 0);

my %wireless_eths;
if (open F, ‘/proc/net/wireless’)
{
$_ = join(”, <F>);
close F;
for (my $i=0;$i<=2;$i++)
{
$wireless_eths{$i} = 1 if (/eth$i/);
}
}

my %eths;
if (open F, ‘/proc/net/dev_mcast’)
{
$_ = join(”, <F>);
close F;
for (my $i=0;$i join(‘ ‘, @eths2off),
-ethdriver => (@eths2off > 0 ? ‘3c59x’ : ”),
);

close F;
`/usr/sbin/hibernate`;

exit(0);

========= END SCRIPT ========

This script processes a templated hibernate.comf file (hibernate.conf.template), using my “LoadHtml” module, available at my website (http://home.mesh.net/turnerjw/jim) to dynamically generate a “hibernate.conf” file to take down each 3c59x network card that is active. by examining /proc/net. This script must of course also be run as root. To create /etc/hibernate/hibernate.conf.template, simply copy hibernate.conf to it, then make the following edits:

1) In the “UnloadModules” line you added earlier, change “3c59x” to “<!:ethdriver>”.
2) In the DownInterfaces” line, change “eth0” to “<!:eths:>eth0<!:/eths>”.

To make the machine resume after opening the lid, try adding / uncommenting the
line:

RadeonTool yes

in your hibernate.conf.template file.

*** No need to do this last step, if you can set it in your bios! ***

To make closing the lid do a suspend to ram, do the following:
In the handler referenced by /etc/acpi/events/default, include the following:

“button/lid”)
/usr/sbin/hibernate
;;

Replace “/usr/bin/hibernate” above with the previous script filename (/usr/local/bin/s2ram), if using docking or multiple nics.

That should do it! Now, enjoy very fast suspend-2-ram and reliable, handy, no battery required suspend-2-disk in Linux!

Warning: Always wake the machine up with the exact same hardware attached as when it was put to sleep, ie. if put to sleep w/AC plugged in, wake it up w/AC plugged in. Otherwise, you may get a kernel panic on resume! Also, when closing the lid to suspend, I have the bios set to leave the machine active on lid close AND therefore, you’ll need to press the power button (on C800) after opening the lid to resume.

Advertisements

One Trackback

Feel Free to Comment (Name/Email/Website optional):

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: