| Rafael J. Wysocki | 84ed64e | 2006-08-30 23:38:06 +0200 | [diff] [blame] | 1 | What:		/sys/power/ | 
|  | 2 | Date:		August 2006 | 
|  | 3 | Contact:	Rafael J. Wysocki <rjw@sisk.pl> | 
|  | 4 | Description: | 
|  | 5 | The /sys/power directory will contain files that will | 
|  | 6 | provide a unified interface to the power management | 
|  | 7 | subsystem. | 
|  | 8 |  | 
|  | 9 | What:		/sys/power/state | 
|  | 10 | Date:		August 2006 | 
|  | 11 | Contact:	Rafael J. Wysocki <rjw@sisk.pl> | 
|  | 12 | Description: | 
|  | 13 | The /sys/power/state file controls the system power state. | 
|  | 14 | Reading from this file returns what states are supported, | 
|  | 15 | which is hard-coded to 'standby' (Power-On Suspend), 'mem' | 
|  | 16 | (Suspend-to-RAM), and 'disk' (Suspend-to-Disk). | 
|  | 17 |  | 
|  | 18 | Writing to this file one of these strings causes the system to | 
|  | 19 | transition into that state. Please see the file | 
|  | 20 | Documentation/power/states.txt for a description of each of | 
|  | 21 | these states. | 
|  | 22 |  | 
|  | 23 | What:		/sys/power/disk | 
| Rafael J. Wysocki | b918f6e | 2006-11-02 22:07:19 -0800 | [diff] [blame] | 24 | Date:		September 2006 | 
| Rafael J. Wysocki | 84ed64e | 2006-08-30 23:38:06 +0200 | [diff] [blame] | 25 | Contact:	Rafael J. Wysocki <rjw@sisk.pl> | 
|  | 26 | Description: | 
|  | 27 | The /sys/power/disk file controls the operating mode of the | 
|  | 28 | suspend-to-disk mechanism.  Reading from this file returns | 
|  | 29 | the name of the method by which the system will be put to | 
|  | 30 | sleep on the next suspend.  There are four methods supported: | 
|  | 31 | 'firmware' - means that the memory image will be saved to disk | 
|  | 32 | by some firmware, in which case we also assume that the | 
|  | 33 | firmware will handle the system suspend. | 
|  | 34 | 'platform' - the memory image will be saved by the kernel and | 
|  | 35 | the system will be put to sleep by the platform driver (e.g. | 
|  | 36 | ACPI or other PM registers). | 
|  | 37 | 'shutdown' - the memory image will be saved by the kernel and | 
|  | 38 | the system will be powered off. | 
|  | 39 | 'reboot' - the memory image will be saved by the kernel and | 
|  | 40 | the system will be rebooted. | 
|  | 41 |  | 
| Rafael J. Wysocki | b918f6e | 2006-11-02 22:07:19 -0800 | [diff] [blame] | 42 | Additionally, /sys/power/disk can be used to turn on one of the | 
|  | 43 | two testing modes of the suspend-to-disk mechanism: 'testproc' | 
|  | 44 | or 'test'.  If the suspend-to-disk mechanism is in the | 
|  | 45 | 'testproc' mode, writing 'disk' to /sys/power/state will cause | 
|  | 46 | the kernel to disable nonboot CPUs and freeze tasks, wait for 5 | 
|  | 47 | seconds, unfreeze tasks and enable nonboot CPUs.  If it is in | 
|  | 48 | the 'test' mode, writing 'disk' to /sys/power/state will cause | 
|  | 49 | the kernel to disable nonboot CPUs and freeze tasks, shrink | 
|  | 50 | memory, suspend devices, wait for 5 seconds, resume devices, | 
|  | 51 | unfreeze tasks and enable nonboot CPUs.  Then, we are able to | 
|  | 52 | look in the log messages and work out, for example, which code | 
|  | 53 | is being slow and which device drivers are misbehaving. | 
|  | 54 |  | 
| Rafael J. Wysocki | 84ed64e | 2006-08-30 23:38:06 +0200 | [diff] [blame] | 55 | The suspend-to-disk method may be chosen by writing to this | 
|  | 56 | file one of the accepted strings: | 
|  | 57 |  | 
|  | 58 | 'firmware' | 
|  | 59 | 'platform' | 
|  | 60 | 'shutdown' | 
|  | 61 | 'reboot' | 
| Rafael J. Wysocki | b918f6e | 2006-11-02 22:07:19 -0800 | [diff] [blame] | 62 | 'testproc' | 
|  | 63 | 'test' | 
| Rafael J. Wysocki | 84ed64e | 2006-08-30 23:38:06 +0200 | [diff] [blame] | 64 |  | 
|  | 65 | It will only change to 'firmware' or 'platform' if the system | 
|  | 66 | supports that. | 
|  | 67 |  | 
|  | 68 | What:		/sys/power/image_size | 
|  | 69 | Date:		August 2006 | 
|  | 70 | Contact:	Rafael J. Wysocki <rjw@sisk.pl> | 
|  | 71 | Description: | 
|  | 72 | The /sys/power/image_size file controls the size of the image | 
|  | 73 | created by the suspend-to-disk mechanism.  It can be written a | 
|  | 74 | string representing a non-negative integer that will be used | 
|  | 75 | as an upper limit of the image size, in bytes.  The kernel's | 
|  | 76 | suspend-to-disk code will do its best to ensure the image size | 
|  | 77 | will not exceed this number.  However, if it turns out to be | 
|  | 78 | impossible, the kernel will try to suspend anyway using the | 
|  | 79 | smallest image possible.  In particular, if "0" is written to | 
|  | 80 | this file, the suspend image will be as small as possible. | 
|  | 81 |  | 
|  | 82 | Reading from this file will display the current image size | 
|  | 83 | limit, which is set to 500 MB by default. | 
|  | 84 |  | 
|  | 85 | What:		/sys/power/pm_trace | 
|  | 86 | Date:		August 2006 | 
|  | 87 | Contact:	Rafael J. Wysocki <rjw@sisk.pl> | 
|  | 88 | Description: | 
|  | 89 | The /sys/power/pm_trace file controls the code which saves the | 
|  | 90 | last PM event point in the RTC across reboots, so that you can | 
|  | 91 | debug a machine that just hangs during suspend (or more | 
|  | 92 | commonly, during resume).  Namely, the RTC is only used to save | 
|  | 93 | the last PM event point if this file contains '1'.  Initially | 
|  | 94 | it contains '0' which may be changed to '1' by writing a | 
|  | 95 | string representing a nonzero integer into it. | 
|  | 96 |  | 
|  | 97 | To use this debugging feature you should attempt to suspend | 
|  | 98 | the machine, then reboot it and run | 
|  | 99 |  | 
|  | 100 | dmesg -s 1000000 | grep 'hash matches' | 
|  | 101 |  | 
|  | 102 | CAUTION: Using it will cause your machine's real-time (CMOS) | 
|  | 103 | clock to be set to a random invalid time after a resume. |