Mauro Carvalho Chehab | 151f4e2 | 2019-06-13 07:10:36 -0300 | [diff] [blame] | 1 | ==================================================== |
Rafael J. Wysocki | 5b79520 | 2007-05-08 00:24:07 -0700 | [diff] [blame] | 2 | Testing suspend and resume support in device drivers |
Mauro Carvalho Chehab | 151f4e2 | 2019-06-13 07:10:36 -0300 | [diff] [blame] | 3 | ==================================================== |
| 4 | |
Rafael J. Wysocki | 5b79520 | 2007-05-08 00:24:07 -0700 | [diff] [blame] | 5 | (C) 2007 Rafael J. Wysocki <rjw@sisk.pl>, GPL |
| 6 | |
| 7 | 1. Preparing the test system |
Mauro Carvalho Chehab | 151f4e2 | 2019-06-13 07:10:36 -0300 | [diff] [blame] | 8 | ============================ |
Rafael J. Wysocki | 5b79520 | 2007-05-08 00:24:07 -0700 | [diff] [blame] | 9 | |
| 10 | Unfortunately, to effectively test the support for the system-wide suspend and |
| 11 | resume transitions in a driver, it is necessary to suspend and resume a fully |
| 12 | functional system with this driver loaded. Moreover, that should be done |
Rafael J. Wysocki | ce2b714 | 2007-11-19 23:43:34 +0100 | [diff] [blame] | 13 | several 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 |
| 15 | cases involves slightly different operations and different interactions with |
Rafael J. Wysocki | 5b79520 | 2007-05-08 00:24:07 -0700 | [diff] [blame] | 16 | the machine's BIOS. |
| 17 | |
| 18 | Of course, for this purpose the test system has to be known to suspend and |
| 19 | resume without the driver being tested. Thus, if possible, you should first |
| 20 | resolve all suspend/resume-related problems in the test system before you start |
Mauro Carvalho Chehab | 151f4e2 | 2019-06-13 07:10:36 -0300 | [diff] [blame] | 21 | testing the new driver. Please see Documentation/power/basic-pm-debugging.rst |
Ralf Baechle | 5e3c3ac | 2007-10-16 23:30:18 -0700 | [diff] [blame] | 22 | for more information about the debugging of suspend/resume functionality. |
Rafael J. Wysocki | 5b79520 | 2007-05-08 00:24:07 -0700 | [diff] [blame] | 23 | |
| 24 | 2. Testing the driver |
Mauro Carvalho Chehab | 151f4e2 | 2019-06-13 07:10:36 -0300 | [diff] [blame] | 25 | ===================== |
Rafael J. Wysocki | 5b79520 | 2007-05-08 00:24:07 -0700 | [diff] [blame] | 26 | |
| 27 | Once you have resolved the suspend/resume-related problems with your test system |
| 28 | without the new driver, you are ready to test it: |
| 29 | |
Rafael J. Wysocki | ce2b714 | 2007-11-19 23:43:34 +0100 | [diff] [blame] | 30 | a) Build the driver as a module, load it and try the test modes of hibernation |
Mauro Carvalho Chehab | 151f4e2 | 2019-06-13 07:10:36 -0300 | [diff] [blame] | 31 | (see: Documentation/power/basic-pm-debugging.rst, 1). |
Rafael J. Wysocki | 5b79520 | 2007-05-08 00:24:07 -0700 | [diff] [blame] | 32 | |
Rafael J. Wysocki | ce2b714 | 2007-11-19 23:43:34 +0100 | [diff] [blame] | 33 | b) Load the driver and attempt to hibernate in the "reboot", "shutdown" and |
Mauro Carvalho Chehab | 151f4e2 | 2019-06-13 07:10:36 -0300 | [diff] [blame] | 34 | "platform" modes (see: Documentation/power/basic-pm-debugging.rst, 1). |
Rafael J. Wysocki | 5b79520 | 2007-05-08 00:24:07 -0700 | [diff] [blame] | 35 | |
Rafael J. Wysocki | ce2b714 | 2007-11-19 23:43:34 +0100 | [diff] [blame] | 36 | c) Compile the driver directly into the kernel and try the test modes of |
| 37 | hibernation. |
Rafael J. Wysocki | 5b79520 | 2007-05-08 00:24:07 -0700 | [diff] [blame] | 38 | |
Rafael J. Wysocki | ce2b714 | 2007-11-19 23:43:34 +0100 | [diff] [blame] | 39 | d) Attempt to hibernate with the driver compiled directly into the kernel |
| 40 | in the "reboot", "shutdown" and "platform" modes. |
Rafael J. Wysocki | 5b79520 | 2007-05-08 00:24:07 -0700 | [diff] [blame] | 41 | |
Bjorn Helgaas | 1992b66 | 2019-11-19 08:09:23 -0600 | [diff] [blame] | 42 | e) 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. Wysocki | ce2b714 | 2007-11-19 23:43:34 +0100 | [diff] [blame] | 46 | |
| 47 | f) Attempt to suspend to RAM using the s2ram tool with the driver loaded |
Mauro Carvalho Chehab | 151f4e2 | 2019-06-13 07:10:36 -0300 | [diff] [blame] | 48 | (see: Documentation/power/basic-pm-debugging.rst, 2). |
Rafael J. Wysocki | 5b79520 | 2007-05-08 00:24:07 -0700 | [diff] [blame] | 49 | |
| 50 | Each of the above tests should be repeated several times and the STD tests |
| 51 | should be mixed with the STR tests. If any of them fails, the driver cannot be |
| 52 | regarded as suspend/resume-safe. |