summaryrefslogtreecommitdiffstats
path: root/sound/soc/sof/intel
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2022-01-25 10:17:38 +0000
committerMark Brown <broonie@kernel.org>2022-01-25 10:17:38 +0000
commita567abf5defbe4beebb2a4f8b412c7bbb0ba0d84 (patch)
treec944e7d2e11e1faccb14750be98ac864fc150382 /sound/soc/sof/intel
parente6ec5a3936ee0c01f46e1d09dc758bb762e06dd9 (diff)
parent7afed13b582b0c3c2a283642fcd87e0db0134f39 (diff)
downloadlinux-a567abf5defbe4beebb2a4f8b412c7bbb0ba0d84.tar.bz2
ASoC: SOF: Intel: improve SoundWire _ADR handling
Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>: Make sure the device version is taken into account when selecting a machine driver, in addition to device manufacturer and part_id, and simplify code with a macro.
Diffstat (limited to 'sound/soc/sof/intel')
-rw-r--r--sound/soc/sof/intel/hda.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c
index c8fb082209ce..8f6765317cfa 100644
--- a/sound/soc/sof/intel/hda.c
+++ b/sound/soc/sof/intel/hda.c
@@ -1179,6 +1179,10 @@ static void hda_generic_machine_select(struct snd_sof_dev *sdev,
#endif
#if IS_ENABLED(CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE)
+
+#define SDW_CODEC_ADR_MASK(_adr) ((_adr) & (SDW_DISCO_LINK_ID_MASK | SDW_VERSION_MASK | \
+ SDW_MFG_ID_MASK | SDW_PART_ID_MASK))
+
/* Check if all Slaves defined on the link can be found */
static bool link_slaves_found(struct snd_sof_dev *sdev,
const struct snd_soc_acpi_link_adr *link,
@@ -1187,7 +1191,7 @@ static bool link_slaves_found(struct snd_sof_dev *sdev,
struct hdac_bus *bus = sof_to_bus(sdev);
struct sdw_intel_slave_id *ids = sdw->ids;
int num_slaves = sdw->num_slaves;
- unsigned int part_id, link_id, unique_id, mfg_id;
+ unsigned int part_id, link_id, unique_id, mfg_id, version;
int i, j, k;
for (i = 0; i < link->num_adr; i++) {
@@ -1197,12 +1201,14 @@ static bool link_slaves_found(struct snd_sof_dev *sdev,
mfg_id = SDW_MFG_ID(adr);
part_id = SDW_PART_ID(adr);
link_id = SDW_DISCO_LINK_ID(adr);
+ version = SDW_VERSION(adr);
for (j = 0; j < num_slaves; j++) {
/* find out how many identical parts were reported on that link */
if (ids[j].link_id == link_id &&
ids[j].id.part_id == part_id &&
- ids[j].id.mfg_id == mfg_id)
+ ids[j].id.mfg_id == mfg_id &&
+ ids[j].id.sdw_version == version)
reported_part_count++;
}
@@ -1211,21 +1217,15 @@ static bool link_slaves_found(struct snd_sof_dev *sdev,
if (ids[j].link_id != link_id ||
ids[j].id.part_id != part_id ||
- ids[j].id.mfg_id != mfg_id)
+ ids[j].id.mfg_id != mfg_id ||
+ ids[j].id.sdw_version != version)
continue;
/* find out how many identical parts are expected */
for (k = 0; k < link->num_adr; k++) {
u64 adr2 = link->adr_d[k].adr;
- unsigned int part_id2, link_id2, mfg_id2;
-
- mfg_id2 = SDW_MFG_ID(adr2);
- part_id2 = SDW_PART_ID(adr2);
- link_id2 = SDW_DISCO_LINK_ID(adr2);
- if (link_id2 == link_id &&
- part_id2 == part_id &&
- mfg_id2 == mfg_id)
+ if (SDW_CODEC_ADR_MASK(adr2) == SDW_CODEC_ADR_MASK(adr))
expected_part_count++;
}