ASoC: Intel: sst: Convert to PCI device IDs defines
authorAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Mon, 17 Jul 2023 11:45:11 +0000 (13:45 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 18 Jul 2023 12:22:25 +0000 (14:22 +0200)
Use PCI device IDs from pci_ids.h header. BSW replaces CHV, as 0x22a8
was added in PCI header as BSW ID for consistency, as they are same
(similar) platforms. 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. Use PCI_DEVICE_DATA() to match PCI device to be consistent
with other Intel audio drivers.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20230717114511.484999-16-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/soc/intel/atom/sst/sst.c
sound/soc/intel/atom/sst/sst.h
sound/soc/intel/atom/sst/sst_pci.c

index a0d29510d2bc486cbaeb7f3a9bae4287136e2aeb..e0357d257c6c3c63c7baeae7721a85a9d5368dc0 100644 (file)
@@ -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_BSW:
                sst->tstamp = SST_TIME_STAMP_MRFLD;
                sst->ops = &mrfld_ops;
                return 0;
@@ -221,8 +222,13 @@ static void sst_init_locks(struct intel_sst_drv *ctx)
        spin_lock_init(&ctx->block_lock);
 }
 
+/*
+ * Driver handles PCI IDs in ACPI - sst_acpi_probe() - and we are using only
+ * device ID part. If real ACPI ID appears, the kstrtouint() returns error, so
+ * we are fine with using unsigned short as dev_id type.
+ */
 int sst_alloc_drv_context(struct intel_sst_drv **ctx,
-               struct device *dev, unsigned int dev_id)
+               struct device *dev, unsigned short dev_id)
 {
        *ctx = devm_kzalloc(dev, sizeof(struct intel_sst_drv), GFP_KERNEL);
        if (!(*ctx))
index 4d37d39fd8f42aa101c1bae304221dcd1b54162b..126903e126e45f64644802141d197f6f50f3c621 100644 (file)
@@ -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)
@@ -358,7 +355,7 @@ struct sst_fw_save {
 struct intel_sst_drv {
        int                     sst_state;
        int                     irq_num;
-       unsigned int            dev_id;
+       unsigned short          dev_id;
        void __iomem            *ddr;
        void __iomem            *shim;
        void __iomem            *mailbox;
@@ -523,7 +520,7 @@ int sst_register(struct device *);
 int sst_unregister(struct device *);
 
 int sst_alloc_drv_context(struct intel_sst_drv **ctx,
-               struct device *dev, unsigned int dev_id);
+               struct device *dev, unsigned short dev_id);
 int sst_context_init(struct intel_sst_drv *ctx);
 void sst_context_cleanup(struct intel_sst_drv *ctx);
 void sst_configure_runtime_pm(struct intel_sst_drv *ctx);
index 4058b4f80a0cf067421eb001807314ba5d8ffd38..d1e64c3500be1783aab50cc9abcb33dec6646db3 100644 (file)
@@ -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_DEVICE_DATA(INTEL, SST_TNG, 0) },
        { 0, }
 };