public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Xi Pardee <xi.pardee@linux.intel.com>
To: xi.pardee@linux.intel.com, rajvi0912@gmail.com,
	irenic.rajneesh@gmail.com, david.e.box@linux.intel.com,
	hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org
Subject: [PATCH v6 5/6] platform/x86:intel/pmc: Move arch specific action to init function
Date: Fri,  7 Feb 2025 14:56:11 -0800	[thread overview]
Message-ID: <20250207225615.401235-6-xi.pardee@linux.intel.com> (raw)
In-Reply-To: <20250207225615.401235-1-xi.pardee@linux.intel.com>

Move arch specific action from core.c to the init() function of spt.c.

Signed-off-by: Xi Pardee <xi.pardee@linux.intel.com>
---
 drivers/platform/x86/intel/pmc/core.c | 13 -------------
 drivers/platform/x86/intel/pmc/spt.c  | 21 +++++++++++++++++++++
 2 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c
index 628cb22221fbc..06821c41fbeb9 100644
--- a/drivers/platform/x86/intel/pmc/core.c
+++ b/drivers/platform/x86/intel/pmc/core.c
@@ -1416,11 +1416,6 @@ static const struct x86_cpu_id intel_pmc_core_ids[] = {
 
 MODULE_DEVICE_TABLE(x86cpu, intel_pmc_core_ids);
 
-static const struct pci_device_id pmc_pci_ids[] = {
-	{ PCI_VDEVICE(INTEL, SPT_PMC_PCI_DEVICE_ID) },
-	{ }
-};
-
 /*
  * This quirk can be used on those platforms where
  * the platform BIOS enforces 24Mhz crystal to shutdown
@@ -1531,14 +1526,6 @@ static int pmc_core_probe(struct platform_device *pdev)
 	if (!pmcdev->pkgc_res_cnt)
 		return -ENOMEM;
 
-	/*
-	 * Coffee Lake has CPU ID of Kaby Lake and Cannon Lake PCH. So here
-	 * Sunrisepoint PCH regmap can't be used. Use Cannon Lake PCH regmap
-	 * in this case.
-	 */
-	if (pmc_dev_info == &spt_pmc_dev && !pci_dev_present(pmc_pci_ids))
-		pmc_dev_info = &cnp_pmc_dev;
-
 	mutex_init(&pmcdev->lock);
 
 	if (pmc_dev_info->init)
diff --git a/drivers/platform/x86/intel/pmc/spt.c b/drivers/platform/x86/intel/pmc/spt.c
index 956b2ec1c7510..9289cd76b0145 100644
--- a/drivers/platform/x86/intel/pmc/spt.c
+++ b/drivers/platform/x86/intel/pmc/spt.c
@@ -8,6 +8,8 @@
  *
  */
 
+#include <linux/pci.h>
+
 #include "core.h"
 
 const struct pmc_bit_map spt_pll_map[] = {
@@ -134,6 +136,25 @@ const struct pmc_reg_map spt_reg_map = {
 	.pm_vric1_offset = SPT_PMC_VRIC1_OFFSET,
 };
 
+static const struct pci_device_id pmc_pci_ids[] = {
+	{ PCI_VDEVICE(INTEL, SPT_PMC_PCI_DEVICE_ID) },
+	{ }
+};
+
+static int spt_core_init(struct pmc_dev *pmcdev, struct pmc_dev_info *pmc_dev_info)
+{
+	/*
+	 * Coffee Lake has CPU ID of Kaby Lake and Cannon Lake PCH. So here
+	 * Sunrisepoint PCH regmap can't be used. Use Cannon Lake PCH regmap
+	 * in this case.
+	 */
+	if (!pci_dev_present(pmc_pci_ids))
+		return generic_core_init(pmcdev, &cnp_pmc_dev);
+
+	return generic_core_init(pmcdev, pmc_dev_info);
+}
+
 struct pmc_dev_info spt_pmc_dev = {
 	.map = &spt_reg_map,
+	.init = spt_core_init,
 };
-- 
2.43.0


  parent reply	other threads:[~2025-02-07 22:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-07 22:56 [PATCH v6 0/6] Add Arrow Lake U/H support Xi Pardee
2025-02-07 22:56 ` [PATCH v6 1/6] platform/x86:intel/pmc: Make tgl_core_generic_init() static Xi Pardee
2025-02-07 22:56 ` [PATCH v6 2/6] platform/x86/intel/pmc: Remove duplicate enum Xi Pardee
2025-02-07 22:56 ` [PATCH v6 3/6] platform/x86:intel/pmc: Create generic_core_init() for all platforms Xi Pardee
2025-02-07 22:56 ` [PATCH v6 4/6] platform/x86/intel/pmc: Remove simple init functions Xi Pardee
2025-02-07 22:56 ` Xi Pardee [this message]
2025-02-10 11:58   ` [PATCH v6 5/6] platform/x86:intel/pmc: Move arch specific action to init function Ilpo Järvinen
2025-02-10 18:11     ` Xi Pardee
2025-02-07 22:56 ` [PATCH v6 6/6] platform/x86/intel/pmc: Add Arrow Lake U/H support to intel_pmc_core driver Xi Pardee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250207225615.401235-6-xi.pardee@linux.intel.com \
    --to=xi.pardee@linux.intel.com \
    --cc=david.e.box@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=irenic.rajneesh@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rajvi0912@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox