blob: d77d2894f9fe97bef7b2c88fa622cee1de228b44 [file] [log] [blame]
Mauro Carvalho Chehab151f4e22019-06-13 07:10:36 -03001====================================================
Rafael J. Wysocki5b795202007-05-08 00:24:07 -07002Testing suspend and resume support in device drivers
Mauro Carvalho Chehab151f4e22019-06-13 07:10:36 -03003====================================================
4
Rafael J. Wysocki5b795202007-05-08 00:24:07 -07005 (C) 2007 Rafael J. Wysocki <rjw@sisk.pl>, GPL
6
71. Preparing the test system
Mauro Carvalho Chehab151f4e22019-06-13 07:10:36 -03008============================
Rafael J. Wysocki5b795202007-05-08 00:24:07 -07009
10Unfortunately, to effectively test the support for the system-wide suspend and
11resume transitions in a driver, it is necessary to suspend and resume a fully
12functional system with this driver loaded. Moreover, that should be done
Rafael J. Wysockice2b7142007-11-19 23:43:34 +010013several times, preferably several times in a row, and separately for hibernation
14(aka suspend to disk or STD) and suspend to RAM (STR), because each of these
15cases involves slightly different operations and different interactions with
Rafael J. Wysocki5b795202007-05-08 00:24:07 -070016the machine's BIOS.
17
18Of course, for this purpose the test system has to be known to suspend and
19resume without the driver being tested. Thus, if possible, you should first
20resolve all suspend/resume-related problems in the test system before you start
Mauro Carvalho Chehab151f4e22019-06-13 07:10:36 -030021testing the new driver. Please see Documentation/power/basic-pm-debugging.rst
Ralf Baechle5e3c3ac2007-10-16 23:30:18 -070022for more information about the debugging of suspend/resume functionality.
Rafael J. Wysocki5b795202007-05-08 00:24:07 -070023
242. Testing the driver
Mauro Carvalho Chehab151f4e22019-06-13 07:10:36 -030025=====================
Rafael J. Wysocki5b795202007-05-08 00:24:07 -070026
27Once you have resolved the suspend/resume-related problems with your test system
28without the new driver, you are ready to test it:
29
Rafael J. Wysockice2b7142007-11-19 23:43:34 +010030a) Build the driver as a module, load it and try the test modes of hibernation
Mauro Carvalho Chehab151f4e22019-06-13 07:10:36 -030031 (see: Documentation/power/basic-pm-debugging.rst, 1).
Rafael J. Wysocki5b795202007-05-08 00:24:07 -070032
Rafael J. Wysockice2b7142007-11-19 23:43:34 +010033b) Load the driver and attempt to hibernate in the "reboot", "shutdown" and
Mauro Carvalho Chehab151f4e22019-06-13 07:10:36 -030034 "platform" modes (see: Documentation/power/basic-pm-debugging.rst, 1).
Rafael J. Wysocki5b795202007-05-08 00:24:07 -070035
Rafael J. Wysockice2b7142007-11-19 23:43:34 +010036c) Compile the driver directly into the kernel and try the test modes of
37 hibernation.
Rafael J. Wysocki5b795202007-05-08 00:24:07 -070038
Rafael J. Wysockice2b7142007-11-19 23:43:34 +010039d) Attempt to hibernate with the driver compiled directly into the kernel
40 in the "reboot", "shutdown" and "platform" modes.
Rafael J. Wysocki5b795202007-05-08 00:24:07 -070041
Bjorn Helgaas1992b662019-11-19 08:09:23 -060042e) Try the test modes of suspend (see:
43 Documentation/power/basic-pm-debugging.rst, 2). [As far as the STR tests are
44 concerned, it should not matter whether or not the driver is built as a
45 module.]
Rafael J. Wysockice2b7142007-11-19 23:43:34 +010046
47f) Attempt to suspend to RAM using the s2ram tool with the driver loaded
Mauro Carvalho Chehab151f4e22019-06-13 07:10:36 -030048 (see: Documentation/power/basic-pm-debugging.rst, 2).
Rafael J. Wysocki5b795202007-05-08 00:24:07 -070049
50Each of the above tests should be repeated several times and the STD tests
51should be mixed with the STR tests. If any of them fails, the driver cannot be
52regarded as suspend/resume-safe.