Skip to content

Commit 4469191

Browse files
committed
ASoC: Intel: sof_sdw: Add a DAI link for echo reference
Add a DAI link for echo reference capture as the last link to make sure the other DAI link ID's remain unaffected. This will be needed to enable the echo reference capture in the SDW topologies which do not have a backend capture DAI in the pipeline. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
1 parent 7445cf6 commit 4469191

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

sound/soc/intel/boards/sof_sdw.c

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1196,6 +1196,28 @@ static int create_bt_dailinks(struct snd_soc_card *card,
11961196
return 0;
11971197
}
11981198

1199+
static int create_echoref_dailink(struct snd_soc_card *card,
1200+
struct snd_soc_dai_link **dai_links, int *be_id)
1201+
{
1202+
struct device *dev = card->dev;
1203+
int ret;
1204+
char *name = devm_kasprintf(dev, GFP_KERNEL, "EchoRef_virtual_DAI");
1205+
1206+
if (!name)
1207+
return -ENOMEM;
1208+
1209+
ret = asoc_sdw_init_simple_dai_link(dev, *dai_links, be_id, name,
1210+
0, 1, "snd-soc-dummy-dai", "dummy",
1211+
snd_soc_dummy_dlc.name, snd_soc_dummy_dlc.dai_name,
1212+
1, NULL, NULL);
1213+
if (ret)
1214+
return ret;
1215+
1216+
(*dai_links)++;
1217+
1218+
return 0;
1219+
}
1220+
11991221
static int sof_card_dai_links_create(struct snd_soc_card *card)
12001222
{
12011223
struct device *dev = card->dev;
@@ -1294,7 +1316,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
12941316
}
12951317

12961318
/* allocate BE dailinks */
1297-
num_links = sdw_be_num + ssp_num + dmic_num + hdmi_num + bt_num;
1319+
num_links = sdw_be_num + ssp_num + dmic_num + hdmi_num + bt_num + 1;
12981320
dai_links = devm_kcalloc(dev, num_links, sizeof(*dai_links), GFP_KERNEL);
12991321
if (!dai_links) {
13001322
ret = -ENOMEM;
@@ -1341,6 +1363,13 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
13411363
goto err_end;
13421364
}
13431365

1366+
/* dummy echo ref link */
1367+
ret = create_echoref_dailink(card, &dai_links, &be_id);
1368+
if (ret) {
1369+
dev_err(dev, "failed to create echo ref dai link: %d\n", ret);
1370+
goto err_end;
1371+
}
1372+
13441373
WARN_ON(codec_conf != card->codec_conf + card->num_configs);
13451374
WARN_ON(dai_links != card->dai_link + card->num_links);
13461375

0 commit comments

Comments
 (0)