xref: /openbmc/linux/Documentation/power/drivers-testing.rst (revision 151f4e2bdc7a04020ae5c533896fb91a16e1f501)
1*151f4e2bSMauro Carvalho Chehab====================================================
2*151f4e2bSMauro Carvalho ChehabTesting suspend and resume support in device drivers
3*151f4e2bSMauro Carvalho Chehab====================================================
4*151f4e2bSMauro Carvalho Chehab
5*151f4e2bSMauro Carvalho Chehab	(C) 2007 Rafael J. Wysocki <rjw@sisk.pl>, GPL
6*151f4e2bSMauro Carvalho Chehab
7*151f4e2bSMauro Carvalho Chehab1. Preparing the test system
8*151f4e2bSMauro Carvalho Chehab============================
9*151f4e2bSMauro Carvalho Chehab
10*151f4e2bSMauro Carvalho ChehabUnfortunately, to effectively test the support for the system-wide suspend and
11*151f4e2bSMauro Carvalho Chehabresume transitions in a driver, it is necessary to suspend and resume a fully
12*151f4e2bSMauro Carvalho Chehabfunctional system with this driver loaded.  Moreover, that should be done
13*151f4e2bSMauro Carvalho Chehabseveral times, preferably several times in a row, and separately for hibernation
14*151f4e2bSMauro Carvalho Chehab(aka suspend to disk or STD) and suspend to RAM (STR), because each of these
15*151f4e2bSMauro Carvalho Chehabcases involves slightly different operations and different interactions with
16*151f4e2bSMauro Carvalho Chehabthe machine's BIOS.
17*151f4e2bSMauro Carvalho Chehab
18*151f4e2bSMauro Carvalho ChehabOf course, for this purpose the test system has to be known to suspend and
19*151f4e2bSMauro Carvalho Chehabresume without the driver being tested.  Thus, if possible, you should first
20*151f4e2bSMauro Carvalho Chehabresolve all suspend/resume-related problems in the test system before you start
21*151f4e2bSMauro Carvalho Chehabtesting the new driver.  Please see Documentation/power/basic-pm-debugging.rst
22*151f4e2bSMauro Carvalho Chehabfor more information about the debugging of suspend/resume functionality.
23*151f4e2bSMauro Carvalho Chehab
24*151f4e2bSMauro Carvalho Chehab2. Testing the driver
25*151f4e2bSMauro Carvalho Chehab=====================
26*151f4e2bSMauro Carvalho Chehab
27*151f4e2bSMauro Carvalho ChehabOnce you have resolved the suspend/resume-related problems with your test system
28*151f4e2bSMauro Carvalho Chehabwithout the new driver, you are ready to test it:
29*151f4e2bSMauro Carvalho Chehab
30*151f4e2bSMauro Carvalho Chehaba) Build the driver as a module, load it and try the test modes of hibernation
31*151f4e2bSMauro Carvalho Chehab   (see: Documentation/power/basic-pm-debugging.rst, 1).
32*151f4e2bSMauro Carvalho Chehab
33*151f4e2bSMauro Carvalho Chehabb) Load the driver and attempt to hibernate in the "reboot", "shutdown" and
34*151f4e2bSMauro Carvalho Chehab   "platform" modes (see: Documentation/power/basic-pm-debugging.rst, 1).
35*151f4e2bSMauro Carvalho Chehab
36*151f4e2bSMauro Carvalho Chehabc) Compile the driver directly into the kernel and try the test modes of
37*151f4e2bSMauro Carvalho Chehab   hibernation.
38*151f4e2bSMauro Carvalho Chehab
39*151f4e2bSMauro Carvalho Chehabd) Attempt to hibernate with the driver compiled directly into the kernel
40*151f4e2bSMauro Carvalho Chehab   in the "reboot", "shutdown" and "platform" modes.
41*151f4e2bSMauro Carvalho Chehab
42*151f4e2bSMauro Carvalho Chehabe) Try the test modes of suspend (see: Documentation/power/basic-pm-debugging.rst,
43*151f4e2bSMauro Carvalho Chehab   2).  [As far as the STR tests are concerned, it should not matter whether or
44*151f4e2bSMauro Carvalho Chehab   not the driver is built as a module.]
45*151f4e2bSMauro Carvalho Chehab
46*151f4e2bSMauro Carvalho Chehabf) Attempt to suspend to RAM using the s2ram tool with the driver loaded
47*151f4e2bSMauro Carvalho Chehab   (see: Documentation/power/basic-pm-debugging.rst, 2).
48*151f4e2bSMauro Carvalho Chehab
49*151f4e2bSMauro Carvalho ChehabEach of the above tests should be repeated several times and the STD tests
50*151f4e2bSMauro Carvalho Chehabshould be mixed with the STR tests.  If any of them fails, the driver cannot be
51*151f4e2bSMauro Carvalho Chehabregarded as suspend/resume-safe.
52