sysfs-power 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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. What: /sys/power/state
  9. Date: August 2006
  10. Contact: Rafael J. Wysocki <rjw@sisk.pl>
  11. Description:
  12. The /sys/power/state file controls the system power state.
  13. Reading from this file returns what states are supported,
  14. which is hard-coded to 'standby' (Power-On Suspend), 'mem'
  15. (Suspend-to-RAM), and 'disk' (Suspend-to-Disk).
  16. Writing to this file one of these strings causes the system to
  17. transition into that state. Please see the file
  18. Documentation/power/states.txt for a description of each of
  19. these states.
  20. What: /sys/power/disk
  21. Date: September 2006
  22. Contact: Rafael J. Wysocki <rjw@sisk.pl>
  23. Description:
  24. The /sys/power/disk file controls the operating mode of the
  25. suspend-to-disk mechanism. Reading from this file returns
  26. the name of the method by which the system will be put to
  27. sleep on the next suspend. There are four methods supported:
  28. 'firmware' - means that the memory image will be saved to disk
  29. by some firmware, in which case we also assume that the
  30. firmware will handle the system suspend.
  31. 'platform' - the memory image will be saved by the kernel and
  32. the system will be put to sleep by the platform driver (e.g.
  33. ACPI or other PM registers).
  34. 'shutdown' - the memory image will be saved by the kernel and
  35. the system will be powered off.
  36. 'reboot' - the memory image will be saved by the kernel and
  37. the system will be rebooted.
  38. Additionally, /sys/power/disk can be used to turn on one of the
  39. two testing modes of the suspend-to-disk mechanism: 'testproc'
  40. or 'test'. If the suspend-to-disk mechanism is in the
  41. 'testproc' mode, writing 'disk' to /sys/power/state will cause
  42. the kernel to disable nonboot CPUs and freeze tasks, wait for 5
  43. seconds, unfreeze tasks and enable nonboot CPUs. If it is in
  44. the 'test' mode, writing 'disk' to /sys/power/state will cause
  45. the kernel to disable nonboot CPUs and freeze tasks, shrink
  46. memory, suspend devices, wait for 5 seconds, resume devices,
  47. unfreeze tasks and enable nonboot CPUs. Then, we are able to
  48. look in the log messages and work out, for example, which code
  49. is being slow and which device drivers are misbehaving.
  50. The suspend-to-disk method may be chosen by writing to this
  51. file one of the accepted strings:
  52. 'firmware'
  53. 'platform'
  54. 'shutdown'
  55. 'reboot'
  56. 'testproc'
  57. 'test'
  58. It will only change to 'firmware' or 'platform' if the system
  59. supports that.
  60. What: /sys/power/image_size
  61. Date: August 2006
  62. Contact: Rafael J. Wysocki <rjw@sisk.pl>
  63. Description:
  64. The /sys/power/image_size file controls the size of the image
  65. created by the suspend-to-disk mechanism. It can be written a
  66. string representing a non-negative integer that will be used
  67. as an upper limit of the image size, in bytes. The kernel's
  68. suspend-to-disk code will do its best to ensure the image size
  69. will not exceed this number. However, if it turns out to be
  70. impossible, the kernel will try to suspend anyway using the
  71. smallest image possible. In particular, if "0" is written to
  72. this file, the suspend image will be as small as possible.
  73. Reading from this file will display the current image size
  74. limit, which is set to 500 MB by default.
  75. What: /sys/power/pm_trace
  76. Date: August 2006
  77. Contact: Rafael J. Wysocki <rjw@sisk.pl>
  78. Description:
  79. The /sys/power/pm_trace file controls the code which saves the
  80. last PM event point in the RTC across reboots, so that you can
  81. debug a machine that just hangs during suspend (or more
  82. commonly, during resume). Namely, the RTC is only used to save
  83. the last PM event point if this file contains '1'. Initially
  84. it contains '0' which may be changed to '1' by writing a
  85. string representing a nonzero integer into it.
  86. To use this debugging feature you should attempt to suspend
  87. the machine, then reboot it and run
  88. dmesg -s 1000000 | grep 'hash matches'
  89. If you do not get any matches (or they appear to be false
  90. positives), it is possible that the last PM event point
  91. referred to a device created by a loadable kernel module. In
  92. this case cat /sys/power/pm_trace_dev_match (see below) after
  93. your system is started up and the kernel modules are loaded.
  94. CAUTION: Using it will cause your machine's real-time (CMOS)
  95. clock to be set to a random invalid time after a resume.
  96. What; /sys/power/pm_trace_dev_match
  97. Date: October 2010
  98. Contact: James Hogan <james@albanarts.com>
  99. Description:
  100. The /sys/power/pm_trace_dev_match file contains the name of the
  101. device associated with the last PM event point saved in the RTC
  102. across reboots when pm_trace has been used. More precisely it
  103. contains the list of current devices (including those
  104. registered by loadable kernel modules since boot) which match
  105. the device hash in the RTC at boot, with a newline after each
  106. one.
  107. The advantage of this file over the hash matches printed to the
  108. kernel log (see /sys/power/pm_trace), is that it includes
  109. devices created after boot by loadable kernel modules.
  110. Due to the small hash size necessary to fit in the RTC, it is
  111. possible that more than one device matches the hash, in which
  112. case further investigation is required to determine which
  113. device is causing the problem. Note that genuine RTC clock
  114. values (such as when pm_trace has not been used), can still
  115. match a device and output it's name here.
  116. What: /sys/power/pm_async
  117. Date: January 2009
  118. Contact: Rafael J. Wysocki <rjw@sisk.pl>
  119. Description:
  120. The /sys/power/pm_async file controls the switch allowing the
  121. user space to enable or disable asynchronous suspend and resume
  122. of devices. If enabled, this feature will cause some device
  123. drivers' suspend and resume callbacks to be executed in parallel
  124. with each other and with the main suspend thread. It is enabled
  125. if this file contains "1", which is the default. It may be
  126. disabled by writing "0" to this file, in which case all devices
  127. will be suspended and resumed synchronously.
  128. What: /sys/power/wakeup_count
  129. Date: July 2010
  130. Contact: Rafael J. Wysocki <rjw@sisk.pl>
  131. Description:
  132. The /sys/power/wakeup_count file allows user space to put the
  133. system into a sleep state while taking into account the
  134. concurrent arrival of wakeup events. Reading from it returns
  135. the current number of registered wakeup events and it blocks if
  136. some wakeup events are being processed at the time the file is
  137. read from. Writing to it will only succeed if the current
  138. number of wakeup events is equal to the written value and, if
  139. successful, will make the kernel abort a subsequent transition
  140. to a sleep state if any wakeup events are reported after the
  141. write has returned.
  142. What: /sys/power/reserved_size
  143. Date: May 2011
  144. Contact: Rafael J. Wysocki <rjw@sisk.pl>
  145. Description:
  146. The /sys/power/reserved_size file allows user space to control
  147. the amount of memory reserved for allocations made by device
  148. drivers during the "device freeze" stage of hibernation. It can
  149. be written a string representing a non-negative integer that
  150. will be used as the amount of memory to reserve for allocations
  151. made by device drivers' "freeze" callbacks, in bytes.
  152. Reading from this file will display the current value, which is
  153. set to 1 MB by default.
  154. What: /sys/power/autosleep
  155. Date: April 2012
  156. Contact: Rafael J. Wysocki <rjw@sisk.pl>
  157. Description:
  158. The /sys/power/autosleep file can be written one of the strings
  159. returned by reads from /sys/power/state. If that happens, a
  160. work item attempting to trigger a transition of the system to
  161. the sleep state represented by that string is queued up. This
  162. attempt will only succeed if there are no active wakeup sources
  163. in the system at that time. After every execution, regardless
  164. of whether or not the attempt to put the system to sleep has
  165. succeeded, the work item requeues itself until user space
  166. writes "off" to /sys/power/autosleep.
  167. Reading from this file causes the last string successfully
  168. written to it to be returned.
  169. What: /sys/power/wake_lock
  170. Date: February 2012
  171. Contact: Rafael J. Wysocki <rjw@sisk.pl>
  172. Description:
  173. The /sys/power/wake_lock file allows user space to create
  174. wakeup source objects and activate them on demand (if one of
  175. those wakeup sources is active, reads from the
  176. /sys/power/wakeup_count file block or return false). When a
  177. string without white space is written to /sys/power/wake_lock,
  178. it will be assumed to represent a wakeup source name. If there
  179. is a wakeup source object with that name, it will be activated
  180. (unless active already). Otherwise, a new wakeup source object
  181. will be registered, assigned the given name and activated.
  182. If a string written to /sys/power/wake_lock contains white
  183. space, the part of the string preceding the white space will be
  184. regarded as a wakeup source name and handled as descrived above.
  185. The other part of the string will be regarded as a timeout (in
  186. nanoseconds) such that the wakeup source will be automatically
  187. deactivated after it has expired. The timeout, if present, is
  188. set regardless of the current state of the wakeup source object
  189. in question.
  190. Reads from this file return a string consisting of the names of
  191. wakeup sources created with the help of it that are active at
  192. the moment, separated with spaces.
  193. What: /sys/power/wake_unlock
  194. Date: February 2012
  195. Contact: Rafael J. Wysocki <rjw@sisk.pl>
  196. Description:
  197. The /sys/power/wake_unlock file allows user space to deactivate
  198. wakeup sources created with the help of /sys/power/wake_lock.
  199. When a string is written to /sys/power/wake_unlock, it will be
  200. assumed to represent the name of a wakeup source to deactivate.
  201. If a wakeup source object of that name exists and is active at
  202. the moment, it will be deactivated.
  203. Reads from this file return a string consisting of the names of
  204. wakeup sources created with the help of /sys/power/wake_lock
  205. that are inactive at the moment, separated with spaces.
  206. What: /sys/power/pm_print_times
  207. Date: May 2012
  208. Contact: Sameer Nanda <snanda@chromium.org>
  209. Description:
  210. The /sys/power/pm_print_times file allows user space to
  211. control whether the time taken by devices to suspend and
  212. resume is printed. These prints are useful for hunting down
  213. devices that take too long to suspend or resume.
  214. Writing a "1" enables this printing while writing a "0"
  215. disables it. The default value is "0". Reading from this file
  216. will display the current value.