Skip to content

Commit 8e34567

Browse files
committed
ASoC: soc_sdw_utils: partial match the codec name
Currently, we can set codec name in the dai info which will be set as the codec component name in a DAI link. However, the codec name may not be fixed. For example, there is an index in a SDCA codec name and that is not fixed. Lookup the fixed codec name string from the component list to get the right component name to ensure the DAI link will bind to the right codec component. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
1 parent 84373fa commit 8e34567

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

sound/soc/sdw_utils/soc_sdw_utils.c

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,8 +1215,18 @@ const char *asoc_sdw_get_codec_name(struct device *dev,
12151215
const struct snd_soc_acpi_link_adr *adr_link,
12161216
int adr_index)
12171217
{
1218-
if (dai_info->codec_name)
1219-
return devm_kstrdup(dev, dai_info->codec_name, GFP_KERNEL);
1218+
if (dai_info->codec_name) {
1219+
struct snd_soc_component *component;
1220+
1221+
component = snd_soc_lookup_component_by_name(dai_info->codec_name);
1222+
if (component) {
1223+
dev_dbg(dev, "%s found component %s for codec_name %s\n",
1224+
__func__, component->name, dai_info->codec_name);
1225+
return devm_kstrdup(dev, component->name, GFP_KERNEL);
1226+
} else {
1227+
return devm_kstrdup(dev, dai_info->codec_name, GFP_KERNEL);
1228+
}
1229+
}
12201230

12211231
return _asoc_sdw_get_codec_name(dev, adr_link, adr_index);
12221232
}
@@ -1528,7 +1538,17 @@ int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card,
15281538
return -EINVAL;
15291539

15301540
for (j = 0; j < codec_info->aux_num; j++) {
1531-
soc_aux->dlc.name = codec_info->auxs[j].codec_name;
1541+
struct snd_soc_component *component;
1542+
1543+
component = snd_soc_lookup_component_by_name(codec_info->auxs[j].
1544+
codec_name);
1545+
if (component) {
1546+
dev_dbg(dev, "%s found component %s for aux name %s\n",
1547+
__func__, component->name, codec_info->auxs[j].codec_name);
1548+
soc_aux->dlc.name = component->name;
1549+
} else {
1550+
soc_aux->dlc.name = codec_info->auxs[j].codec_name;
1551+
}
15321552
soc_aux++;
15331553
}
15341554

0 commit comments

Comments
 (0)