xref: /OK3568_Linux_fs/kernel/Documentation/power/drivers-testing.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun====================================================
2*4882a593SmuzhiyunTesting suspend and resume support in device drivers
3*4882a593Smuzhiyun====================================================
4*4882a593Smuzhiyun
5*4882a593Smuzhiyun	(C) 2007 Rafael J. Wysocki <rjw@sisk.pl>, GPL
6*4882a593Smuzhiyun
7*4882a593Smuzhiyun1. Preparing the test system
8*4882a593Smuzhiyun============================
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunUnfortunately, to effectively test the support for the system-wide suspend and
11*4882a593Smuzhiyunresume transitions in a driver, it is necessary to suspend and resume a fully
12*4882a593Smuzhiyunfunctional system with this driver loaded.  Moreover, that should be done
13*4882a593Smuzhiyunseveral times, preferably several times in a row, and separately for hibernation
14*4882a593Smuzhiyun(aka suspend to disk or STD) and suspend to RAM (STR), because each of these
15*4882a593Smuzhiyuncases involves slightly different operations and different interactions with
16*4882a593Smuzhiyunthe machine's BIOS.
17*4882a593Smuzhiyun
18*4882a593SmuzhiyunOf course, for this purpose the test system has to be known to suspend and
19*4882a593Smuzhiyunresume without the driver being tested.  Thus, if possible, you should first
20*4882a593Smuzhiyunresolve all suspend/resume-related problems in the test system before you start
21*4882a593Smuzhiyuntesting the new driver.  Please see Documentation/power/basic-pm-debugging.rst
22*4882a593Smuzhiyunfor more information about the debugging of suspend/resume functionality.
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun2. Testing the driver
25*4882a593Smuzhiyun=====================
26*4882a593Smuzhiyun
27*4882a593SmuzhiyunOnce you have resolved the suspend/resume-related problems with your test system
28*4882a593Smuzhiyunwithout the new driver, you are ready to test it:
29*4882a593Smuzhiyun
30*4882a593Smuzhiyuna) Build the driver as a module, load it and try the test modes of hibernation
31*4882a593Smuzhiyun   (see: Documentation/power/basic-pm-debugging.rst, 1).
32*4882a593Smuzhiyun
33*4882a593Smuzhiyunb) Load the driver and attempt to hibernate in the "reboot", "shutdown" and
34*4882a593Smuzhiyun   "platform" modes (see: Documentation/power/basic-pm-debugging.rst, 1).
35*4882a593Smuzhiyun
36*4882a593Smuzhiyunc) Compile the driver directly into the kernel and try the test modes of
37*4882a593Smuzhiyun   hibernation.
38*4882a593Smuzhiyun
39*4882a593Smuzhiyund) Attempt to hibernate with the driver compiled directly into the kernel
40*4882a593Smuzhiyun   in the "reboot", "shutdown" and "platform" modes.
41*4882a593Smuzhiyun
42*4882a593Smuzhiyune) Try the test modes of suspend (see:
43*4882a593Smuzhiyun   Documentation/power/basic-pm-debugging.rst, 2).  [As far as the STR tests are
44*4882a593Smuzhiyun   concerned, it should not matter whether or not the driver is built as a
45*4882a593Smuzhiyun   module.]
46*4882a593Smuzhiyun
47*4882a593Smuzhiyunf) Attempt to suspend to RAM using the s2ram tool with the driver loaded
48*4882a593Smuzhiyun   (see: Documentation/power/basic-pm-debugging.rst, 2).
49*4882a593Smuzhiyun
50*4882a593SmuzhiyunEach of the above tests should be repeated several times and the STD tests
51*4882a593Smuzhiyunshould be mixed with the STR tests.  If any of them fails, the driver cannot be
52*4882a593Smuzhiyunregarded as suspend/resume-safe.
53