[mythtv-users] Hardware Supporting Suspend to RAM
Leighton Brough
brough at baremetalsoft.com
Mon Jun 12 15:09:43 UTC 2006
> I'm building a MythFrontend for my living room. The two key ingredients
> are on board Svideo, and Suspend to RAM support in linux with a way to
> wake-up from remote. The suspend must be silent, I.E. all fans need to
> shut off, including the PSU. I have a Harmony remote, and was thinking of
> getting an IR keyboard so I can do a wake on keypress. Anyone know of
> motherboards that support this in Linux (Fedora Core 5 or KnoppMyth,
> undecided as of now)?
>
>
Hi Ben,
I've got suspend to RAM working on my box, almost completely to my
satisfaction. This is a far from trivial problem. What you will have to
do to get this going, and whether it will work correctly or not depends
on a lot of factors. But I can summarise my experience which might help.
After many, many hours, I have managed to get my combined front/back end
system to automatically wake up from S3 (the suspended to RAM state) 2
minutes before recordings, and automatically return to S3 when the
frontend isn't active and nothing else (recording, commercial flagging
etc) is going on. It's been more or less reliably doing this for a few
weeks now, without a reboot or full shutdown (which is _not_ to say that
I don't experience crashes of MythTV from time to time). The startup and
shutdown is fast, taking just a few seconds, the power consumption in S3
is trivial and the box is silent.
I can shut the frontend down with the remote (in this case an MCE unit),
but as yet I cannot get it to wake this system from S3. This is
infuriating, as I've previously installed Windows XP on the same
hardware, and _could_ wake it with the remote. I have yet to get to the
bottom of this problem - I assume the 'fix' will be in the ACPI related
portions of the kernel. Anyway, the point is I have to suffer the
indignity of pressing the power button on the case to wake the box manually.
I'm using an ASUS P4P800S-X motherboard in this system. Here are some of
the things I needed to do to get the Linux end of the problem working:
* With my (Debian) distro, I downloaded and compiled a newer 2.6.x
kernel, with suitable settings to get ACPI support. You will need at
least 2.6.x kernel, so this will limit your choice of Linux distro,
unless you are prepared to build the kernel. You may have to do this
anyway, if it isn't configured for ACPI. Sadly, as far as I can tell,
with 2.6.x there is no SMP support, so my P4 cannot be run in
hyperthreaded mode, which I would very much like to do.
* As I'm using a NVidia 6200 video card, I had to make a few hacks to
the some of the source provided with the proprietary binary as this was
throwing errors preventing a transition to S3 (the suspended to RAM
state). With these, I can go to S3 without stopping X, which makes the
resume considerably quicker, as X doesn't need to be restarted.
* I've developed some scripts which do the work of transitioning the
system to S3. These stop a number of daemons, and unload a number of
kernel modules, sync disks etc before the transition to S3, and restart
them again afterwards. I haven't got access to my MythTV box at the
moment, so I can't give you precise details. The kernel modules I needed
to unload included hot-swap, USB support and the DVB drivers (I have 3
Twinhan DVB tuners). Basically, you've got to keep ripping out bits of
the OS until you can get the suspend (and then resume) to work; then
you've found the drivers and servers which don't cope with S3.
* I had to setup Linux to interpret the real-time clock value as local
time, not UTC, or the times pushed into the BIOS with ACPI when setting
the wakeup time were not correct.
I'm using 0.19-fixes svn source to compile MythTV now. To get this to
use the ACPI suspend to RAM support correctly, I had to:
* Setup the backend with mythtv-setup correctly to shutdown the when
it's not busy, and wait for a client to connect before shutdown. You
need to set the time it will wait rather than shutdown if a recording is
coming up to 15 minutes. With this value is configurable in the backend,
it's hard-coded in MythWelcome (more below), so you're stuck with this
value in practice. It's a shame, as the suspend to S3 and resume is so
fast I would prefer a value more like 2 minutes.
* I'm using MythWelcome, which helps, but it assumes that you're using
nvwakeup for the wake on real-time clock functionality, rather than
ACPI, so you have to configure this appropriately too - sorry about the
lack of details again - the point is it is possible. I ended up writing
a little Perl script which takes a command line of the form assumed by
MythWelcome for setting the wakeup time, and translates this to an
appropriate setting for /proc/acpi/wakeup.
In a nutshell, pretty much any motherboard you buy today I would guess
supports S3 and ACPI. However the Linux support for this isn't great yet
(it's not perfect in Windows either, but it's better). So unless you can
find positive proof of a working example for a particular configuration,
you can't be sure it will work. There are also issues to do with video
restarting correctly on resume. Most motherboards have some BIOS
settings relating to this which can help (didn't work for me), and there
some tools like vbetool which can also help (didn't work for me either).
So what happens for me after a suspend and resume is that the X video
state is correct, but the consoles' video states are trashed. This isn't
the end of the world, as I don't need to use the console. But it does
make it harder to debug the system, as you can't see all of the shutdown
messages.
I also find that I cannot do a reboot or 'shutdown -r' after a resume
from S3. If I attempt this, the system hangs on shutdown, and after a
power-cycle, the BIOS date and time have been trashed (ughhh!). So I
avoid that too!
I hope that gives you a bit of a picture. Others may have had much
easier results.
Cheers,
Leighton
More information about the mythtv-users
mailing list