blob: d739aa7c742ce075d2d6a7391b4ba95db17c2681 [file] [log] [blame]
Mauro Carvalho Chehab151f4e22019-06-13 07:10:36 -03001========================
2How to get s2ram working
3========================
4
52006 Linus Torvalds
62006 Pavel Machek
Pavel Machek06df6a52006-12-06 20:34:46 -08007
81) Check suspend.sf.net, program s2ram there has long whitelist of
9 "known ok" machines, along with tricks to use on each one.
10
112) If that does not help, try reading tricks.txt and
12 video.txt. Perhaps problem is as simple as broken module, and
13 simple module unload can fix it.
14
153) You can use Linus' TRACE_RESUME infrastructure, described below.
16
Mauro Carvalho Chehab151f4e22019-06-13 07:10:36 -030017Using TRACE_RESUME
18~~~~~~~~~~~~~~~~~~
Pavel Machek06df6a52006-12-06 20:34:46 -080019
20I've been working at making the machines I have able to STR, and almost
21always it's a driver that is buggy. Thank God for the suspend/resume
22debugging - the thing that Chuck tried to disable. That's often the _only_
23way to debug these things, and it's actually pretty powerful (but
24time-consuming - having to insert TRACE_RESUME() markers into the device
25driver that doesn't resume and recompile and reboot).
26
27Anyway, the way to debug this for people who are interested (have a
28machine that doesn't boot) is:
29
30 - enable PM_DEBUG, and PM_TRACE
31
Mauro Carvalho Chehab151f4e22019-06-13 07:10:36 -030032 - use a script like this::
Pavel Machek06df6a52006-12-06 20:34:46 -080033
34 #!/bin/sh
35 sync
36 echo 1 > /sys/power/pm_trace
37 echo mem > /sys/power/state
38
39 to suspend
40
41 - if it doesn't come back up (which is usually the problem), reboot by
42 holding the power button down, and look at the dmesg output for things
Mauro Carvalho Chehab151f4e22019-06-13 07:10:36 -030043 like::
Pavel Machek06df6a52006-12-06 20:34:46 -080044
45 Magic number: 4:156:725
46 hash matches drivers/base/power/resume.c:28
47 hash matches device 0000:01:00.0
48
49 which means that the last trace event was just before trying to resume
50 device 0000:01:00.0. Then figure out what driver is controlling that
51 device (lspci and /sys/devices/pci* is your friend), and see if you can
52 fix it, disable it, or trace into its resume function.
53
James Hogand33ac602010-10-12 00:00:25 +020054 If no device matches the hash (or any matches appear to be false positives),
55 the culprit may be a device from a loadable kernel module that is not loaded
56 until after the hash is checked. You can check the hash against the current
Mauro Carvalho Chehab151f4e22019-06-13 07:10:36 -030057 devices again after more modules are loaded using sysfs::
James Hogand33ac602010-10-12 00:00:25 +020058
59 cat /sys/power/pm_trace_dev_match
60
Pavel Machek06df6a52006-12-06 20:34:46 -080061For example, the above happens to be the VGA device on my EVO, which I
62used to run with "radeonfb" (it's an ATI Radeon mobility). It turns out
63that "radeonfb" simply cannot resume that device - it tries to set the
64PLL's, and it just _hangs_. Using the regular VGA console and letting X
65resume it instead works fine.
Frans Popb25f29b2008-10-15 22:01:21 -070066
67NOTE
68====
69pm_trace uses the system's Real Time Clock (RTC) to save the magic number.
70Reason for this is that the RTC is the only reliably available piece of
71hardware during resume operations where a value can be set that will
72survive a reboot.
73
Pavel Macheka03ff6f2015-01-26 14:43:04 +010074pm_trace is not compatible with asynchronous suspend, so it turns
75asynchronous suspend off (which may work around timing or
76ordering-sensitive bugs).
77
Frans Popb25f29b2008-10-15 22:01:21 -070078Consequence is that after a resume (even if it is successful) your system
Matt LaPlante19f59462009-04-27 15:06:31 +020079clock will have a value corresponding to the magic number instead of the
Frans Popb25f29b2008-10-15 22:01:21 -070080correct date/time! It is therefore advisable to use a program like ntp-date
81or rdate to reset the correct date/time from an external time source when
82using this trace option.
83
84As the clock keeps ticking it is also essential that the reboot is done
85quickly after the resume failure. The trace option does not use the seconds
86or the low order bits of the minutes of the RTC, but a too long delay will
87corrupt the magic value.