Merge tag 'pm-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
[linux-block.git] / drivers / platform / x86 / intel / pmc / core.c
index 61ca7c37fb02022e10c580b027d2fa629575cce7..da6e7206d38b5a571e2889665cd675f51c343d5e 100644 (file)
@@ -1153,6 +1153,8 @@ static int pmc_core_probe(struct platform_device *pdev)
        pmc_core_do_dmi_quirks(pmcdev);
 
        pmc_core_dbgfs_register(pmcdev);
+       pm_report_max_hw_sleep(FIELD_MAX(SLP_S0_RES_COUNTER_MASK) *
+                              pmc_core_adjust_slp_s0_step(pmcdev, 1));
 
        device_initialized = true;
        dev_info(&pdev->dev, " initialized\n");
@@ -1178,12 +1180,6 @@ static __maybe_unused int pmc_core_suspend(struct device *dev)
 {
        struct pmc_dev *pmcdev = dev_get_drvdata(dev);
 
-       pmcdev->check_counters = false;
-
-       /* No warnings on S0ix failures */
-       if (!warn_on_s0ix_failures)
-               return 0;
-
        /* Check if the syspend will actually use S0ix */
        if (pm_suspend_via_firmware())
                return 0;
@@ -1196,7 +1192,6 @@ static __maybe_unused int pmc_core_suspend(struct device *dev)
        if (pmc_core_dev_state_get(pmcdev, &pmcdev->s0ix_counter))
                return -EIO;
 
-       pmcdev->check_counters = true;
        return 0;
 }
 
@@ -1220,6 +1215,8 @@ static inline bool pmc_core_is_s0ix_failed(struct pmc_dev *pmcdev)
        if (pmc_core_dev_state_get(pmcdev, &s0ix_counter))
                return false;
 
+       pm_report_hw_sleep_time((u32)(s0ix_counter - pmcdev->s0ix_counter));
+
        if (s0ix_counter == pmcdev->s0ix_counter)
                return true;
 
@@ -1232,12 +1229,16 @@ static __maybe_unused int pmc_core_resume(struct device *dev)
        const struct pmc_bit_map **maps = pmcdev->map->lpm_sts;
        int offset = pmcdev->map->lpm_status_offset;
 
-       if (!pmcdev->check_counters)
+       /* Check if the syspend used S0ix */
+       if (pm_suspend_via_firmware())
                return 0;
 
        if (!pmc_core_is_s0ix_failed(pmcdev))
                return 0;
 
+       if (!warn_on_s0ix_failures)
+               return 0;
+
        if (pmc_core_is_pc10_failed(pmcdev)) {
                /* S0ix failed because of PC10 entry failure */
                dev_info(dev, "CPU did not enter PC10!!! (PC10 cnt=0x%llx)\n",