aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/intel/pmc/tgl.c
diff options
context:
space:
mode:
authorXi Pardee <xi.pardee@linux.intel.com>2025-02-07 14:56:09 -0800
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2025-02-10 13:14:46 +0200
commitac6bef0d54014cc010831ec86ac425f482a981ae (patch)
treea483a29cbd9f8aa16d202c0ff6ab5052b6c85651 /drivers/platform/x86/intel/pmc/tgl.c
parentplatform/x86/intel/pmc: Remove duplicate enum (diff)
downloadlinux-ac6bef0d54014cc010831ec86ac425f482a981ae.tar.gz
linux-ac6bef0d54014cc010831ec86ac425f482a981ae.zip
platform/x86:intel/pmc: Create generic_core_init() for all platforms
Create a generic_core_init() function for all architectures to reduce duplicate code in each architecture file. Create an info structure to catch the variations between each architecture and pass it to the generic init function. Convert all architectures to call the generic core init function. Signed-off-by: Xi Pardee <xi.pardee@linux.intel.com> Link: https://lore.kernel.org/r/20250207225615.401235-4-xi.pardee@linux.intel.com Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Diffstat (limited to 'drivers/platform/x86/intel/pmc/tgl.c')
-rw-r--r--drivers/platform/x86/intel/pmc/tgl.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/platform/x86/intel/pmc/tgl.c b/drivers/platform/x86/intel/pmc/tgl.c
index 4fec43d212d0..bc3cb949c672 100644
--- a/drivers/platform/x86/intel/pmc/tgl.c
+++ b/drivers/platform/x86/intel/pmc/tgl.c
@@ -285,35 +285,36 @@ free_acpi_obj:
ACPI_FREE(out_obj);
}
-static int tgl_core_generic_init(struct pmc_dev *pmcdev, int pch_tp)
-{
- struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN];
- int ret;
+static struct pmc_dev_info tgl_l_pmc_dev = {
+ .map = &tgl_reg_map,
+ .suspend = cnl_suspend,
+ .resume = cnl_resume,
+};
- if (pch_tp == PCH_H)
- pmc->map = &tgl_h_reg_map;
- else
- pmc->map = &tgl_reg_map;
+static struct pmc_dev_info tgl_pmc_dev = {
+ .map = &tgl_h_reg_map,
+ .suspend = cnl_suspend,
+ .resume = cnl_resume,
+};
- pmcdev->suspend = cnl_suspend;
- pmcdev->resume = cnl_resume;
+static int tgl_core_generic_init(struct pmc_dev *pmcdev, struct pmc_dev_info *pmc_dev_info)
+{
+ int ret;
- ret = get_primary_reg_base(pmc);
+ ret = generic_core_init(pmcdev, pmc_dev_info);
if (ret)
return ret;
- pmc_core_get_low_power_modes(pmcdev);
pmc_core_get_tgl_lpm_reqs(pmcdev->pdev);
-
return 0;
}
int tgl_l_core_init(struct pmc_dev *pmcdev)
{
- return tgl_core_generic_init(pmcdev, PCH_LP);
+ return tgl_core_generic_init(pmcdev, &tgl_l_pmc_dev);
}
int tgl_core_init(struct pmc_dev *pmcdev)
{
- return tgl_core_generic_init(pmcdev, PCH_H);
+ return tgl_core_generic_init(pmcdev, &tgl_pmc_dev);
}