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