[RFC v2 3/3] platform/x86/intel/pmc: core: Report duration of time in HW sleep state

From: Mario Limonciello
Date: Thu Nov 10 2022 - 01:49:43 EST


intel_pmc_core displays a warning when a suspend didn't get to a HW
sleep state.

This information is generally useful to userspace as well which may use
it to collect further debugging data. Report this to the standard kernel
reporting infrastructure that can be accessed from sysfs.

Signed-off-by: Mario Limonciello <mario.limonciello@xxxxxxx>
---
drivers/platform/x86/intel/pmc/core.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c
index 17ec5825d13d..ef2055209213 100644
--- a/drivers/platform/x86/intel/pmc/core.c
+++ b/drivers/platform/x86/intel/pmc/core.c
@@ -2116,6 +2116,8 @@ static __maybe_unused int pmc_core_resume(struct device *dev)
if (!pmcdev->check_counters)
return 0;

+ pm_set_hw_state_residency(pmcdev->s0ix_counter);
+
if (!pmc_core_is_s0ix_failed(pmcdev))
return 0;

--
2.34.1