xref: /openbmc/linux/Documentation/power/drivers-testing.rst (revision c95baf12f5077419db01313ab61c2aac007d40cd)
1151f4e2bSMauro Carvalho Chehab====================================================
2151f4e2bSMauro Carvalho ChehabTesting suspend and resume support in device drivers
3151f4e2bSMauro Carvalho Chehab====================================================
4151f4e2bSMauro Carvalho Chehab
5151f4e2bSMauro Carvalho Chehab	(C) 2007 Rafael J. Wysocki <rjw@sisk.pl>, GPL
6151f4e2bSMauro Carvalho Chehab
7151f4e2bSMauro Carvalho Chehab1. Preparing the test system
8151f4e2bSMauro Carvalho Chehab============================
9151f4e2bSMauro Carvalho Chehab
10151f4e2bSMauro Carvalho ChehabUnfortunately, to effectively test the support for the system-wide suspend and
11151f4e2bSMauro Carvalho Chehabresume transitions in a driver, it is necessary to suspend and resume a fully
12151f4e2bSMauro Carvalho Chehabfunctional system with this driver loaded.  Moreover, that should be done
13151f4e2bSMauro Carvalho Chehabseveral times, preferably several times in a row, and separately for hibernation
14151f4e2bSMauro Carvalho Chehab(aka suspend to disk or STD) and suspend to RAM (STR), because each of these
15151f4e2bSMauro Carvalho Chehabcases involves slightly different operations and different interactions with
16151f4e2bSMauro Carvalho Chehabthe machine's BIOS.
17151f4e2bSMauro Carvalho Chehab
18151f4e2bSMauro Carvalho ChehabOf course, for this purpose the test system has to be known to suspend and
19151f4e2bSMauro Carvalho Chehabresume without the driver being tested.  Thus, if possible, you should first
20151f4e2bSMauro Carvalho Chehabresolve all suspend/resume-related problems in the test system before you start
21151f4e2bSMauro Carvalho Chehabtesting the new driver.  Please see Documentation/power/basic-pm-debugging.rst
22151f4e2bSMauro Carvalho Chehabfor more information about the debugging of suspend/resume functionality.
23151f4e2bSMauro Carvalho Chehab
24151f4e2bSMauro Carvalho Chehab2. Testing the driver
25151f4e2bSMauro Carvalho Chehab=====================
26151f4e2bSMauro Carvalho Chehab
27151f4e2bSMauro Carvalho ChehabOnce you have resolved the suspend/resume-related problems with your test system
28151f4e2bSMauro Carvalho Chehabwithout the new driver, you are ready to test it:
29151f4e2bSMauro Carvalho Chehab
30151f4e2bSMauro Carvalho Chehaba) Build the driver as a module, load it and try the test modes of hibernation
31151f4e2bSMauro Carvalho Chehab   (see: Documentation/power/basic-pm-debugging.rst, 1).
32151f4e2bSMauro Carvalho Chehab
33151f4e2bSMauro Carvalho Chehabb) Load the driver and attempt to hibernate in the "reboot", "shutdown" and
34151f4e2bSMauro Carvalho Chehab   "platform" modes (see: Documentation/power/basic-pm-debugging.rst, 1).
35151f4e2bSMauro Carvalho Chehab
36151f4e2bSMauro Carvalho Chehabc) Compile the driver directly into the kernel and try the test modes of
37151f4e2bSMauro Carvalho Chehab   hibernation.
38151f4e2bSMauro Carvalho Chehab
39151f4e2bSMauro Carvalho Chehabd) Attempt to hibernate with the driver compiled directly into the kernel
40151f4e2bSMauro Carvalho Chehab   in the "reboot", "shutdown" and "platform" modes.
41151f4e2bSMauro Carvalho Chehab
42*1992b66dSBjorn Helgaase) Try the test modes of suspend (see:
43*1992b66dSBjorn Helgaas   Documentation/power/basic-pm-debugging.rst, 2).  [As far as the STR tests are
44*1992b66dSBjorn Helgaas   concerned, it should not matter whether or not the driver is built as a
45*1992b66dSBjorn Helgaas   module.]
46151f4e2bSMauro Carvalho Chehab
47151f4e2bSMauro Carvalho Chehabf) Attempt to suspend to RAM using the s2ram tool with the driver loaded
48151f4e2bSMauro Carvalho Chehab   (see: Documentation/power/basic-pm-debugging.rst, 2).
49151f4e2bSMauro Carvalho Chehab
50151f4e2bSMauro Carvalho ChehabEach of the above tests should be repeated several times and the STD tests
51151f4e2bSMauro Carvalho Chehabshould be mixed with the STR tests.  If any of them fails, the driver cannot be
52151f4e2bSMauro Carvalho Chehabregarded as suspend/resume-safe.
53