[v2,15/15] ASoC: Intel: sst: Convert to PCI device IDs defines

Message ID 20230714185615.370597-16-amadeuszx.slawinski@linux.intel.com
State New
Headers
Series PCI: Define Intel PCI IDs and use them in drivers |

Commit Message

Amadeusz Sławiński July 14, 2023, 6:56 p.m. UTC
  Use PCI device IDs from pci_ids.h header.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
---
 sound/soc/intel/atom/sst/sst.c     | 7 ++++---
 sound/soc/intel/atom/sst/sst.h     | 3 ---
 sound/soc/intel/atom/sst/sst_pci.c | 4 ++--
 3 files changed, 6 insertions(+), 8 deletions(-)
  

Comments

Andy Shevchenko July 14, 2023, 11:26 a.m. UTC | #1
On Fri, Jul 14, 2023 at 08:56:15PM +0200, Amadeusz Sławiński wrote:
> Use PCI device IDs from pci_ids.h header.

Perhaps one more sentence to explain why this is okay change, like:
"The ACPI IDs are used only internally and lower 16 bits uniquely define
 the device as vendor ID for Intel is 8086 for all of them."

Suggested-by: ?

...

> -	{ PCI_VDEVICE(INTEL, SST_MRFLD_PCI_ID), 0},
> +	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_SST_TNG), 0},

That 0 is not needed, OTOH you may use PCI_DEVICE_DATA(..., 0).
  
Andy Shevchenko July 14, 2023, 11:32 a.m. UTC | #2
On Fri, Jul 14, 2023 at 02:26:45PM +0300, Andy Shevchenko wrote:
> On Fri, Jul 14, 2023 at 08:56:15PM +0200, Amadeusz Sławiński wrote:
> > Use PCI device IDs from pci_ids.h header.
> 
> Perhaps one more sentence to explain why this is okay change, like:
> "The ACPI IDs are used only internally and lower 16 bits uniquely define
>  the device as vendor ID for Intel is 8086 for all of them."
> 
> Suggested-by: ?
> 
> ...
> 
> > -	{ PCI_VDEVICE(INTEL, SST_MRFLD_PCI_ID), 0},
> > +	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_SST_TNG), 0},
> 
> That 0 is not needed, OTOH you may use PCI_DEVICE_DATA(..., 0).

And you missed the patch I sent to you, i.e. replacing field and function
parameter type to be insigned short. Otherwise it won't work with ACPI.
  

Patch

diff --git a/sound/soc/intel/atom/sst/sst.c b/sound/soc/intel/atom/sst/sst.c
index a0d29510d2bc..74614f9b086a 100644
--- a/sound/soc/intel/atom/sst/sst.c
+++ b/sound/soc/intel/atom/sst/sst.c
@@ -16,6 +16,7 @@ 
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/firmware.h>
+#include <linux/pci.h>
 #include <linux/pm_runtime.h>
 #include <linux/pm_qos.h>
 #include <linux/async.h>
@@ -174,9 +175,9 @@  int sst_driver_ops(struct intel_sst_drv *sst)
 {
 
 	switch (sst->dev_id) {
-	case SST_MRFLD_PCI_ID:
-	case SST_BYT_ACPI_ID:
-	case SST_CHV_ACPI_ID:
+	case PCI_DEVICE_ID_INTEL_SST_TNG:
+	case PCI_DEVICE_ID_INTEL_SST_BYT:
+	case PCI_DEVICE_ID_INTEL_SST_CHV:
 		sst->tstamp = SST_TIME_STAMP_MRFLD;
 		sst->ops = &mrfld_ops;
 		return 0;
diff --git a/sound/soc/intel/atom/sst/sst.h b/sound/soc/intel/atom/sst/sst.h
index 4d37d39fd8f4..eab374bf0066 100644
--- a/sound/soc/intel/atom/sst/sst.h
+++ b/sound/soc/intel/atom/sst/sst.h
@@ -20,9 +20,6 @@ 
 
 /* driver names */
 #define SST_DRV_NAME "intel_sst_driver"
-#define SST_MRFLD_PCI_ID 0x119A
-#define SST_BYT_ACPI_ID	0x80860F28
-#define SST_CHV_ACPI_ID	0x808622A8
 
 #define SST_SUSPEND_DELAY 2000
 #define FW_CONTEXT_MEM (64*1024)
diff --git a/sound/soc/intel/atom/sst/sst_pci.c b/sound/soc/intel/atom/sst/sst_pci.c
index 4058b4f80a0c..7ed142bb3dc0 100644
--- a/sound/soc/intel/atom/sst/sst_pci.c
+++ b/sound/soc/intel/atom/sst/sst_pci.c
@@ -32,7 +32,7 @@  static int sst_platform_get_resources(struct intel_sst_drv *ctx)
 
 	/* map registers */
 	/* DDR base */
-	if (ctx->dev_id == SST_MRFLD_PCI_ID) {
+	if (ctx->dev_id == PCI_DEVICE_ID_INTEL_SST_TNG) {
 		ctx->ddr_base = pci_resource_start(pci, 0);
 		/* check that the relocated IMR base matches with FW Binary */
 		ddr_base = relocate_imr_addr_mrfld(ctx->ddr_base);
@@ -173,7 +173,7 @@  static void intel_sst_remove(struct pci_dev *pci)
 
 /* PCI Routines */
 static const struct pci_device_id intel_sst_ids[] = {
-	{ PCI_VDEVICE(INTEL, SST_MRFLD_PCI_ID), 0},
+	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_SST_TNG), 0},
 	{ 0, }
 };