]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
platform/x86/intel/pmc: Add ssram_init flag in PMC discovery in Meteor Lake
authorRajvi Jingar <rajvi.jingar@linux.intel.com>
Tue, 19 Dec 2023 04:22:14 +0000 (20:22 -0800)
committerHans de Goede <hdegoede@redhat.com>
Tue, 19 Dec 2023 15:48:27 +0000 (16:48 +0100)
If PMC discovery using pmc_core_ssram_init() was unsuccessful for the
Meteor Lake platform, the legacy enumeration method is used. In this
case pci device struct for the PMC SSRAM is not available
and pmc_core_ssram_get_lpm_reqs() will not work. Add ssram_init flag to
indicate if the PMC SSRAM initialization was successful or not. Call
pmc_core_ssram_get_lpm_reqs() only if the ssram_init flag is set to true.

Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
Link: https://lore.kernel.org/r/20231219042216.2592029-6-rajvi.jingar@linux.intel.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/x86/intel/pmc/mtl.c

index d2470f8002981073cba50ecccf24deec99461bb2..e75431325dda92e42d5ba22754281a7af7bebfa9 100644 (file)
@@ -994,6 +994,7 @@ int mtl_core_init(struct pmc_dev *pmcdev)
        struct pmc *pmc = pmcdev->pmcs[PMC_IDX_SOC];
        int ret;
        int func = 2;
+       bool ssram_init = true;
 
        mtl_d3_fixup();
 
@@ -1006,6 +1007,7 @@ int mtl_core_init(struct pmc_dev *pmcdev)
         */
        ret = pmc_core_ssram_init(pmcdev, func);
        if (ret) {
+               ssram_init = false;
                dev_warn(&pmcdev->pdev->dev,
                         "ssram init failed, %d, using legacy init\n", ret);
                pmc->map = &mtl_socm_reg_map;
@@ -1023,5 +1025,8 @@ int mtl_core_init(struct pmc_dev *pmcdev)
        dev_dbg(&pmcdev->pdev->dev, "ignoring GBE LTR\n");
        pmc_core_send_ltr_ignore(pmcdev, 3);
 
-       return pmc_core_ssram_get_lpm_reqs(pmcdev);
+       if (ssram_init)
+               return pmc_core_ssram_get_lpm_reqs(pmcdev);
+
+       return 0;
 }