Commit 0e2c1dd0 authored by Charles Keepax's avatar Charles Keepax Committed by Mark Brown

ASoC: Intel: sof_sdw: Factor out BlueTooth DAI creation

Factor out the creation of the BlueTooth DAI links into a helper
function.  No functional change.
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-14-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 914c43ab
......@@ -1722,6 +1722,27 @@ static int create_hdmi_dailinks(struct snd_soc_card *card,
return 0;
}
static int create_bt_dailinks(struct snd_soc_card *card,
struct snd_soc_dai_link **dai_links, int *be_id)
{
struct device *dev = card->dev;
int port = (sof_sdw_quirk & SOF_BT_OFFLOAD_SSP_MASK) >>
SOF_BT_OFFLOAD_SSP_SHIFT;
char *name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", port);
char *cpu_dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", port);
int ret;
ret = init_simple_dai_link(dev, *dai_links, be_id, name,
1, 1, cpu_dai_name, snd_soc_dummy_dlc.name,
snd_soc_dummy_dlc.dai_name, NULL, NULL);
if (ret)
return ret;
(*dai_links)++;
return 0;
}
static int sof_card_dai_links_create(struct snd_soc_card *card)
{
struct device *dev = card->dev;
......@@ -1738,7 +1759,6 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
bool group_generated[SDW_MAX_GROUPS] = { };
struct snd_soc_dai_link *dai_links;
int num_links;
char *name, *cpu_dai_name;
int i, j, be_id = 0;
int hdmi_num;
unsigned long ssp_mask;
......@@ -1899,20 +1919,11 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
if (ret)
return ret;
/* BT */
if (sof_sdw_quirk & SOF_SSP_BT_OFFLOAD_PRESENT) {
int port = (sof_sdw_quirk & SOF_BT_OFFLOAD_SSP_MASK) >>
SOF_BT_OFFLOAD_SSP_SHIFT;
name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", port);
cpu_dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", port);
ret = init_simple_dai_link(dev, dai_links, &be_id, name,
1, 1, cpu_dai_name, snd_soc_dummy_dlc.name,
snd_soc_dummy_dlc.dai_name, NULL, NULL);
ret = create_bt_dailinks(card, &dai_links, &be_id);
if (ret)
return ret;
dai_links++;
}
WARN_ON(dai_links != card->dai_link + card->num_links);
......
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