Commit 13e698e8 authored by Charles Keepax's avatar Charles Keepax Committed by Mark Brown

ASoC: Intel: sof_sdw: Move append_dai_type to new parsing

append_dai_type should be set to true in any situation that would
result in multiple DAI links existing on a single SoundWire bus,
because the legacy naming used only the bus number to make things
unique. The current code handles this by looking for codecs with
multiple dai_info structs and looking for buses that include multiple
types of device on them. The first of these assumes that all DAIs on a
given device would be in use. The second, with dissimilar aggregation
now being supported, isn't really an accurate check either since those
devices could be aggregated into a single DAI link.

Move the handling for this flag over to the new parsing code and
simplify things a little by looking directly for SoundWire links
that will contain multiple DAI links to set the flag. These changes
should not cause any change in behaviour for any currently supported
systems.
Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://msgid.link/r/20240326160429.13560-22-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 22f2a5e7
......@@ -1463,6 +1463,8 @@ static int parse_sdw_endpoints(struct snd_soc_card *card,
int i, j;
for (adr_link = mach_params->links; adr_link->num_adr; adr_link++) {
int num_link_dailinks = 0;
if (!is_power_of_2(adr_link->mask)) {
dev_err(dev, "link with multiple mask bits: 0x%x\n",
adr_link->mask);
......@@ -1540,6 +1542,7 @@ static int parse_sdw_endpoints(struct snd_soc_card *card,
}
}
num_link_dailinks += !!list_empty(&sof_dai->endpoints);
list_add_tail(&sof_end->list, &sof_dai->endpoints);
sof_end->link_mask = adr_link->mask;
......@@ -1550,6 +1553,8 @@ static int parse_sdw_endpoints(struct snd_soc_card *card,
sof_end++;
}
}
ctx->append_dai_type |= (num_link_dailinks > 1);
}
WARN_ON(codec_conf != card->codec_conf + card->num_configs);
......@@ -1933,37 +1938,6 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
for (i = 0; i < SDW_MAX_LINKS; i++)
ctx->sdw_pin_index[i] = SDW_INTEL_BIDIR_PDI_BASE;
for (; adr_link->num_adr; adr_link++) {
/*
* If there are two or more different devices on the same sdw link, we have to
* append the codec type to the dai link name to prevent duplicated dai link name.
* The same type devices on the same sdw link will be in the same
* snd_soc_acpi_adr_device array. They won't be described in different adr_links.
*/
for (i = 0; i < adr_link->num_adr; i++) {
/* find codec info to get dai_num */
codec_info = find_codec_info_part(adr_link->adr_d[i].adr);
if (!codec_info) {
ret = -EINVAL;
goto err_end;
}
if (codec_info->dai_num > 1) {
ctx->append_dai_type = true;
goto out;
}
for (j = 0; j < i; j++) {
if ((SDW_PART_ID(adr_link->adr_d[i].adr) !=
SDW_PART_ID(adr_link->adr_d[j].adr)) ||
(SDW_MFG_ID(adr_link->adr_d[i].adr) !=
SDW_MFG_ID(adr_link->adr_d[j].adr))) {
ctx->append_dai_type = true;
goto out;
}
}
}
}
out:
/* generate DAI links by each sdw link */
for (adr_link = mach_params->links ; adr_link->num_adr; adr_link++) {
for (i = 0; i < adr_link->num_adr; i++) {
......
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