[PATCH 1/2] ASoC: SOF: Intel: reuse name prefix for duplicate SoundWire devices
From: Amaan Lalani
Date: Fri Aug 28 2026 - 15:04:02 EST
Some firmware describes a single physical SoundWire peripheral with
multiple _ADR entries that differ only in SDCA class ID.
These entries currently consume separate amplifier indices when the
SoundWire machine description is built. This can cause the peripheral
that actually enumerates to receive a different name prefix from the
one expected by UCM.
Detect entries which differ only in class ID and reuse the name prefix
assigned to the first entry. Do not increment the amplifier index for
the duplicate entry.
Fixes: 5226d19d4cae ("ASoC: SOF: Intel: use sof_sdw as default SDW machine driver")
Assisted-by: LLM
Signed-off-by: Amaan Lalani <zlzzm2014@xxxxxxxxxxx>
---
sound/soc/sof/intel/hda.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c
index 4dbba9186b29..c785e27089ea 100644
--- a/sound/soc/sof/intel/hda.c
+++ b/sound/soc/sof/intel/hda.c
@@ -1245,6 +1245,20 @@ static struct snd_soc_acpi_adr_device *find_acpi_adr_device(struct device *dev,
((u64)(sdw_device->id.sdw_version & 0xF) << 44) |
((u64)(sdw_device->bus->link_id & 0xF) << 48);
+ /*
+ * Firmware may describe the same physical peripheral with multiple
+ * _ADR entries that differ only in SDCA class ID. Reuse the prefix
+ * so duplicate entries do not consume another amplifier index.
+ */
+
+ for (j = 0; j < index; j++) {
+ if ((adr_dev[j].adr & ~SDW_CLASS_ID_MASK) ==
+ (adr_dev[index].adr & ~SDW_CLASS_ID_MASK)) {
+ adr_dev[index].name_prefix = adr_dev[j].name_prefix;
+ goto done_name_prefix;
+ }
+ }
+
if (!codec_info_list[i].is_amp) {
/* For non-amp codecs, get name_prefix from codec_info_list[] */
adr_dev[index].name_prefix = devm_kasprintf(dev, GFP_KERNEL, "%s", name_prefix);
--
2.55.0