PM: Add sysfs files to represent time spent in hardware sleep state
authorMario Limonciello <mario.limonciello@amd.com>
Mon, 17 Apr 2023 15:27:05 +0000 (10:27 -0500)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 20 Apr 2023 17:06:12 +0000 (19:06 +0200)
commitb52124a78ab34eb0754e32edc0c9996937779176
tree35050fa7febe8f3fb465d98280950c7171f9b194
parent6a8f57ae2eb07ab39a6f0ccad60c760743051026
PM: Add sysfs files to represent time spent in hardware sleep state

Userspace can't easily discover how much of a sleep cycle was spent in a
hardware sleep state without using kernel tracing and vendor specific sysfs
or debugfs files.

To make this information more discoverable, introduce 3 new sysfs files:
1) The time spent in a hw sleep state for last cycle.
2) The time spent in a hw sleep state since the kernel booted
3) The maximum time that the hardware can report for a sleep cycle.
All of these files will be present only if the system supports s2idle.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Documentation/ABI/testing/sysfs-power
include/linux/suspend.h
kernel/power/main.c