Commit a567abf5 authored by Mark Brown's avatar Mark Brown

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.
parents e6ec5a39 7afed13b
......@@ -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++;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment