| Rafael J. Wysocki | 5b79520 | 2007-05-08 00:24:07 -0700 | [diff] [blame] | 1 | Testing suspend and resume support in device drivers | 
|  | 2 | (C) 2007 Rafael J. Wysocki <rjw@sisk.pl>, GPL | 
|  | 3 |  | 
|  | 4 | 1. Preparing the test system | 
|  | 5 |  | 
|  | 6 | Unfortunately, to effectively test the support for the system-wide suspend and | 
|  | 7 | resume transitions in a driver, it is necessary to suspend and resume a fully | 
|  | 8 | functional system with this driver loaded.  Moreover, that should be done | 
| Rafael J. Wysocki | ce2b714 | 2007-11-19 23:43:34 +0100 | [diff] [blame] | 9 | several times, preferably several times in a row, and separately for hibernation | 
|  | 10 | (aka suspend to disk or STD) and suspend to RAM (STR), because each of these | 
|  | 11 | cases involves slightly different operations and different interactions with | 
| Rafael J. Wysocki | 5b79520 | 2007-05-08 00:24:07 -0700 | [diff] [blame] | 12 | the machine's BIOS. | 
|  | 13 |  | 
|  | 14 | Of course, for this purpose the test system has to be known to suspend and | 
|  | 15 | resume without the driver being tested.  Thus, if possible, you should first | 
|  | 16 | resolve all suspend/resume-related problems in the test system before you start | 
| Ralf Baechle | 5e3c3ac | 2007-10-16 23:30:18 -0700 | [diff] [blame] | 17 | testing the new driver.  Please see Documentation/power/basic-pm-debugging.txt | 
|  | 18 | for more information about the debugging of suspend/resume functionality. | 
| Rafael J. Wysocki | 5b79520 | 2007-05-08 00:24:07 -0700 | [diff] [blame] | 19 |  | 
|  | 20 | 2. Testing the driver | 
|  | 21 |  | 
|  | 22 | Once you have resolved the suspend/resume-related problems with your test system | 
|  | 23 | without the new driver, you are ready to test it: | 
|  | 24 |  | 
| Rafael J. Wysocki | ce2b714 | 2007-11-19 23:43:34 +0100 | [diff] [blame] | 25 | a) Build the driver as a module, load it and try the test modes of hibernation | 
| Jon Mason | 7ac4dca | 2010-12-01 00:14:55 +0100 | [diff] [blame] | 26 | (see: Documentation/power/basic-pm-debugging.txt, 1). | 
| Rafael J. Wysocki | 5b79520 | 2007-05-08 00:24:07 -0700 | [diff] [blame] | 27 |  | 
| Rafael J. Wysocki | ce2b714 | 2007-11-19 23:43:34 +0100 | [diff] [blame] | 28 | b) Load the driver and attempt to hibernate in the "reboot", "shutdown" and | 
| Jon Mason | 7ac4dca | 2010-12-01 00:14:55 +0100 | [diff] [blame] | 29 | "platform" modes (see: Documentation/power/basic-pm-debugging.txt, 1). | 
| Rafael J. Wysocki | 5b79520 | 2007-05-08 00:24:07 -0700 | [diff] [blame] | 30 |  | 
| Rafael J. Wysocki | ce2b714 | 2007-11-19 23:43:34 +0100 | [diff] [blame] | 31 | c) Compile the driver directly into the kernel and try the test modes of | 
|  | 32 | hibernation. | 
| Rafael J. Wysocki | 5b79520 | 2007-05-08 00:24:07 -0700 | [diff] [blame] | 33 |  | 
| Rafael J. Wysocki | ce2b714 | 2007-11-19 23:43:34 +0100 | [diff] [blame] | 34 | d) Attempt to hibernate with the driver compiled directly into the kernel | 
|  | 35 | in the "reboot", "shutdown" and "platform" modes. | 
| Rafael J. Wysocki | 5b79520 | 2007-05-08 00:24:07 -0700 | [diff] [blame] | 36 |  | 
| Jon Mason | 7ac4dca | 2010-12-01 00:14:55 +0100 | [diff] [blame] | 37 | e) Try the test modes of suspend (see: Documentation/power/basic-pm-debugging.txt, | 
| Rafael J. Wysocki | ce2b714 | 2007-11-19 23:43:34 +0100 | [diff] [blame] | 38 | 2).  [As far as the STR tests are concerned, it should not matter whether or | 
|  | 39 | not the driver is built as a module.] | 
|  | 40 |  | 
|  | 41 | f) Attempt to suspend to RAM using the s2ram tool with the driver loaded | 
| Jon Mason | 7ac4dca | 2010-12-01 00:14:55 +0100 | [diff] [blame] | 42 | (see: Documentation/power/basic-pm-debugging.txt, 2). | 
| Rafael J. Wysocki | 5b79520 | 2007-05-08 00:24:07 -0700 | [diff] [blame] | 43 |  | 
|  | 44 | Each of the above tests should be repeated several times and the STD tests | 
|  | 45 | should be mixed with the STR tests.  If any of them fails, the driver cannot be | 
|  | 46 | regarded as suspend/resume-safe. |