diff options
author | David E. Box <david.e.box@linux.intel.com> | 2023-06-14 01:53:44 +0300 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2023-06-20 13:51:08 +0300 |
commit | 1b8c7b843c0043dd1b81e162e5b5fbed4b256896 (patch) | |
tree | 804f7c29d64f920f9f9411b395f36549b8b3bc36 /drivers/platform/x86/intel/pmc/core.c | |
parent | 2bcef4529222424559ac9b45948ee9d82c09d9b5 (diff) | |
download | linux-1b8c7b843c0043dd1b81e162e5b5fbed4b256896.tar.xz |
platform/x86:intel/pmc: Discover PMC devices
On platforms with multiple PMCs, additional PMC devices are discovered
in the SSRAM device associated with the primary PMC. Add support for
discovering PMC devices from SSRAM. Use PMC devid to assign the
corresponding register map.
Signed-off-by: Xi Pardee <xi.pardee@intel.com>
Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230613225347.2720665-6-rajvi.jingar@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform/x86/intel/pmc/core.c')
-rw-r--r-- | drivers/platform/x86/intel/pmc/core.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c index 5864d2e85706..5a36b3f77bc5 100644 --- a/drivers/platform/x86/intel/pmc/core.c +++ b/drivers/platform/x86/intel/pmc/core.c @@ -1183,6 +1183,26 @@ static void pmc_core_do_dmi_quirks(struct pmc *pmc) pmc_core_xtal_ignore(pmc); } +static void pmc_core_clean_structure(struct platform_device *pdev) +{ + struct pmc_dev *pmcdev = platform_get_drvdata(pdev); + int i; + + for (i = 0; i < ARRAY_SIZE(pmcdev->pmcs); ++i) { + struct pmc *pmc = pmcdev->pmcs[i]; + + if (pmc) + iounmap(pmc->regbase); + } + + if (pmcdev->ssram_pcidev) { + pci_dev_put(pmcdev->ssram_pcidev); + pci_disable_device(pmcdev->ssram_pcidev); + } + platform_set_drvdata(pdev, NULL); + mutex_destroy(&pmcdev->lock); +} + static int pmc_core_probe(struct platform_device *pdev) { static bool device_initialized; @@ -1225,7 +1245,7 @@ static int pmc_core_probe(struct platform_device *pdev) mutex_init(&pmcdev->lock); ret = core_init(pmcdev); if (ret) { - mutex_destroy(&pmcdev->lock); + pmc_core_clean_structure(pdev); return ret; } @@ -1246,18 +1266,8 @@ static int pmc_core_probe(struct platform_device *pdev) static void pmc_core_remove(struct platform_device *pdev) { struct pmc_dev *pmcdev = platform_get_drvdata(pdev); - int i; - - for (i = 0; i < ARRAY_SIZE(pmcdev->pmcs); ++i) { - struct pmc *pmc = pmcdev->pmcs[i]; - - if (pmc) - iounmap(pmc->regbase); - } - pmc_core_dbgfs_unregister(pmcdev); - platform_set_drvdata(pdev, NULL); - mutex_destroy(&pmcdev->lock); + pmc_core_clean_structure(pdev); } static bool warn_on_s0ix_failures; |