Skip to content

Commit 632cc05

Browse files
committed
ASoC: Intel: add SDCA Amp feedback fragment topology support
Use the topology with feedback PCM if the SDCA smart amp capture dai link is created. The commit makes an assumption that the smart amp playback dai link is always created if the smart amp capture dai link is present. That is a reasonable assumption because it makes no sense that a feedback work without playback. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
1 parent c6e20f3 commit 632cc05

1 file changed

Lines changed: 37 additions & 3 deletions

File tree

sound/soc/intel/common/sof-function-topology-lib.c

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
enum tplg_device_id {
1717
TPLG_DEVICE_SDCA_JACK,
1818
TPLG_DEVICE_SDCA_AMP,
19+
TPLG_DEVICE_SDCA_AMP_FEEDBACK,
1920
TPLG_DEVICE_SDCA_MIC,
2021
TPLG_DEVICE_INTEL_PCH_DMIC,
2122
TPLG_DEVICE_HDMI,
@@ -35,6 +36,7 @@ int sof_sdw_get_tplg_files(struct snd_soc_card *card, const struct snd_soc_acpi_
3536
const struct firmware *fw;
3637
char platform[SOF_INTEL_PLATFORM_NAME_MAX];
3738
unsigned long tplg_mask = 0;
39+
int amp_tplg_num;
3840
int tplg_num = 0;
3941
int tplg_dev;
4042
int ret;
@@ -55,9 +57,41 @@ int sof_sdw_get_tplg_files(struct snd_soc_card *card, const struct snd_soc_acpi_
5557
tplg_dev = TPLG_DEVICE_SDCA_JACK;
5658
tplg_dev_name = "sdca-jack";
5759
} else if (strstr(dai_link->name, "SmartAmp")) {
58-
tplg_dev = TPLG_DEVICE_SDCA_AMP;
59-
tplg_dev_name = devm_kasprintf(card->dev, GFP_KERNEL,
60-
"sdca-%damp", dai_link->num_cpus);
60+
/* If the AMP feedback topology is already used, continue */
61+
if (tplg_mask & BIT(TPLG_DEVICE_SDCA_AMP_FEEDBACK))
62+
continue;
63+
if (strstr(dai_link->name, "Playback")) {
64+
tplg_dev = TPLG_DEVICE_SDCA_AMP;
65+
tplg_dev_name = devm_kasprintf(card->dev, GFP_KERNEL,
66+
"sdca-%damp", dai_link->num_cpus);
67+
amp_tplg_num = tplg_num;
68+
} else { /* Capture */
69+
tplg_dev = TPLG_DEVICE_SDCA_AMP_FEEDBACK;
70+
tplg_dev_name = devm_kasprintf(card->dev, GFP_KERNEL,
71+
"sdca-%damp-feedback",
72+
dai_link->num_cpus);
73+
/* Replace the AMP topology with feedback */
74+
if (tplg_mask & BIT(TPLG_DEVICE_SDCA_AMP)) {
75+
/*
76+
* Update tplg_mask and test tplg_dev_name as it will
77+
* continue in this if condition.
78+
*/
79+
tplg_mask |= BIT(tplg_dev);
80+
if (!tplg_dev_name)
81+
return -ENOMEM;
82+
83+
(*tplg_files)[amp_tplg_num] =
84+
devm_kasprintf(card->dev, GFP_KERNEL,
85+
"%s/sof-%s-id%d.tplg",
86+
prefix, tplg_dev_name,
87+
dai_link->id);
88+
if (!(*tplg_files)[amp_tplg_num])
89+
return -ENOMEM;
90+
91+
/* No need to add tplg file to the tplg_files list */
92+
continue;
93+
}
94+
}
6195
if (!tplg_dev_name)
6296
return -ENOMEM;
6397
} else if (strstr(dai_link->name, "SmartMic")) {

0 commit comments

Comments
 (0)