Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: Intel: sof_sdw: Add a DAI link for loopback capture

Add a DAI link for loopback capture as the last link to make sure
the other DAI link ID's remain unaffected. It serves as a dummy DAI link
to enable echo reference capture in the SDW topologies which do not have
an actual backend capture DAI.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://patch.msgid.link/20260204081833.16630-5-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Ranjani Sridharan and committed by
Mark Brown
e614fce9 af0bc3ac

+41 -2
+41 -2
sound/soc/intel/boards/sof_sdw.c
··· 1186 1186 return 0; 1187 1187 } 1188 1188 1189 + static int create_echoref_dailink(struct snd_soc_card *card, 1190 + struct snd_soc_dai_link **dai_links, int *be_id) 1191 + { 1192 + struct device *dev = card->dev; 1193 + int ret; 1194 + char *name = devm_kasprintf(dev, GFP_KERNEL, "Loopback_Virtual"); 1195 + 1196 + if (!name) 1197 + return -ENOMEM; 1198 + 1199 + /* 1200 + * use dummy DAI names as this won't be connected to an actual DAI but just to establish a 1201 + * fe <-> be connection for loopback capture for echo reference 1202 + */ 1203 + ret = asoc_sdw_init_simple_dai_link(dev, *dai_links, be_id, name, 1204 + 0, 1, "Loopback Virtual Pin", "dummy", 1205 + snd_soc_dummy_dlc.name, snd_soc_dummy_dlc.dai_name, 1206 + 1, NULL, NULL); 1207 + if (ret) 1208 + return ret; 1209 + 1210 + (*dai_links)++; 1211 + 1212 + dev_dbg(dev, "Added echo reference DAI link\n"); 1213 + 1214 + return 0; 1215 + } 1216 + 1189 1217 static int sof_card_dai_links_create(struct snd_soc_card *card) 1190 1218 { 1191 1219 struct device *dev = card->dev; ··· 1322 1294 goto err_end; 1323 1295 } 1324 1296 1325 - /* allocate BE dailinks */ 1326 - num_links = sdw_be_num + ssp_num + dmic_num + hdmi_num + bt_num; 1297 + /* 1298 + * allocate BE dailinks, add an extra DAI link for echo reference capture. 1299 + * This should be the last DAI link and it is expected both for monolithic 1300 + * and functional SOF topologies to support echo reference. 1301 + */ 1302 + num_links = sdw_be_num + ssp_num + dmic_num + hdmi_num + bt_num + 1; 1327 1303 dai_links = devm_kcalloc(dev, num_links, sizeof(*dai_links), GFP_KERNEL); 1328 1304 if (!dai_links) { 1329 1305 ret = -ENOMEM; ··· 1374 1342 ret = create_bt_dailinks(card, &dai_links, &be_id); 1375 1343 if (ret) 1376 1344 goto err_end; 1345 + } 1346 + 1347 + /* dummy echo ref link. keep this as the last DAI link. The DAI link ID does not matter */ 1348 + ret = create_echoref_dailink(card, &dai_links, &be_id); 1349 + if (ret) { 1350 + dev_err(dev, "failed to create echo ref dai link: %d\n", ret); 1351 + goto err_end; 1377 1352 } 1378 1353 1379 1354 WARN_ON(codec_conf != card->codec_conf + card->num_configs);