interface.txt 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. Power Management Interface
  2. The power management subsystem provides a unified sysfs interface to
  3. userspace, regardless of what architecture or platform one is
  4. running. The interface exists in /sys/power/ directory (assuming sysfs
  5. is mounted at /sys).
  6. /sys/power/state controls system power state. Reading from this file
  7. returns what states are supported, which is hard-coded to 'freeze',
  8. 'standby' (Power-On Suspend), 'mem' (Suspend-to-RAM), and 'disk'
  9. (Suspend-to-Disk).
  10. Writing to this file one of those strings causes the system to
  11. transition into that state. Please see the file
  12. Documentation/power/states.txt for a description of each of those
  13. states.
  14. /sys/power/disk controls the operating mode of the suspend-to-disk
  15. mechanism. Suspend-to-disk can be handled in several ways. We have a
  16. few options for putting the system to sleep - using the platform driver
  17. (e.g. ACPI or other suspend_ops), powering off the system or rebooting the
  18. system (for testing).
  19. Additionally, /sys/power/disk can be used to turn on one of the two testing
  20. modes of the suspend-to-disk mechanism: 'testproc' or 'test'. If the
  21. suspend-to-disk mechanism is in the 'testproc' mode, writing 'disk' to
  22. /sys/power/state will cause the kernel to disable nonboot CPUs and freeze
  23. tasks, wait for 5 seconds, unfreeze tasks and enable nonboot CPUs. If it is
  24. in the 'test' mode, writing 'disk' to /sys/power/state will cause the kernel
  25. to disable nonboot CPUs and freeze tasks, shrink memory, suspend devices, wait
  26. for 5 seconds, resume devices, unfreeze tasks and enable nonboot CPUs. Then,
  27. we are able to look in the log messages and work out, for example, which code
  28. is being slow and which device drivers are misbehaving.
  29. Reading from this file will display all supported modes and the currently
  30. selected one in brackets, for example
  31. [shutdown] reboot test testproc
  32. Writing to this file will accept one of
  33. 'platform' (only if the platform supports it)
  34. 'shutdown'
  35. 'reboot'
  36. 'testproc'
  37. 'test'
  38. /sys/power/image_size controls the size of the image created by
  39. the suspend-to-disk mechanism. It can be written a string
  40. representing a non-negative integer that will be used as an upper
  41. limit of the image size, in bytes. The suspend-to-disk mechanism will
  42. do its best to ensure the image size will not exceed that number. However,
  43. if this turns out to be impossible, it will try to suspend anyway using the
  44. smallest image possible. In particular, if "0" is written to this file, the
  45. suspend image will be as small as possible.
  46. Reading from this file will display the current image size limit, which
  47. is set to 2/5 of available RAM by default.
  48. /sys/power/pm_trace controls the code which saves the last PM event point in
  49. the RTC across reboots, so that you can debug a machine that just hangs
  50. during suspend (or more commonly, during resume). Namely, the RTC is only
  51. used to save the last PM event point if this file contains '1'. Initially it
  52. contains '0' which may be changed to '1' by writing a string representing a
  53. nonzero integer into it.
  54. To use this debugging feature you should attempt to suspend the machine, then
  55. reboot it and run
  56. dmesg -s 1000000 | grep 'hash matches'
  57. CAUTION: Using it will cause your machine's real-time (CMOS) clock to be
  58. set to a random invalid time after a resume.