Re: [PATCH 13/13] ASoC: Intel: sst: Convert to PCI device IDs defines

From: Andy Shevchenko
Date: Tue Jul 11 2023 - 10:33:47 EST


On Tue, Jul 11, 2023 at 02:57:26PM +0200, Amadeusz Sławiński wrote:
> Use PCI device IDs from pci_ids.h header.

...

> switch (sst->dev_id) {
> - case SST_MRFLD_PCI_ID:
> + case PCI_DEVICE_ID_INTEL_ADSP_TNG:
> case SST_BYT_ACPI_ID:
> case SST_CHV_ACPI_ID:

I think this needs a bit more, i.e. replacing the rest with respective PCI IDs.

All three will be defined with SST prefix, which makes sense to me.

ACPI here is a bit misleading, but correct. The ACPI specification assumes that
respective part of the ID space covers 100% of PCI ID space.

I have briefly checked the code and it seems that ID is used externally only
for PCI case, so we may simply use the lower 16 bits of the ACPI _HID for the
context.

diff --git a/sound/soc/intel/atom/sst/sst.c b/sound/soc/intel/atom/sst/sst.c
index a0d29510d2bc..b1f59604d825 100644
--- a/sound/soc/intel/atom/sst/sst.c
+++ b/sound/soc/intel/atom/sst/sst.c
@@ -222,7 +222,7 @@ static void sst_init_locks(struct intel_sst_drv *ctx)
}

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))
diff --git a/sound/soc/intel/atom/sst/sst.h b/sound/soc/intel/atom/sst/sst.h
index 4d37d39fd8f4..c04f033e1d5f 100644
--- a/sound/soc/intel/atom/sst/sst.h
+++ b/sound/soc/intel/atom/sst/sst.h
@@ -358,7 +358,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 +523,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);

...

> /* 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

And kill all three!

--
With Best Regards,
Andy Shevchenko