aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/intel/boards/sof_board_helpers.c
diff options
context:
space:
mode:
authorBrent Lu <[email protected]>2023-11-27 15:26:43 +0000
committerMark Brown <[email protected]>2023-11-27 16:33:00 +0000
commit53d8df6d3f0a1d6fd520865fb12c11868fe6cf81 (patch)
tree525075c0c1d5b3d46d5de1bf94ef501c03890b3f /sound/soc/intel/boards/sof_board_helpers.c
parentASoC: Intel: sof_ssp_amp: rename function parameter (diff)
downloadkernel-53d8df6d3f0a1d6fd520865fb12c11868fe6cf81.tar.gz
kernel-53d8df6d3f0a1d6fd520865fb12c11868fe6cf81.zip
ASoC: Intel: board_helpers: support BT offload link initialization
Add a helper function for machine drivers to initialize BT offload DAI link. Signed-off-by: Brent Lu <[email protected]> Reviewed-by: Pierre-Louis Bossart <[email protected]> Reviewed-by: Bard Liao <[email protected]> Signed-off-by: Peter Ujfalusi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
Diffstat (limited to 'sound/soc/intel/boards/sof_board_helpers.c')
-rw-r--r--sound/soc/intel/boards/sof_board_helpers.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/sound/soc/intel/boards/sof_board_helpers.c b/sound/soc/intel/boards/sof_board_helpers.c
index 515634db0a4d..335c660561d5 100644
--- a/sound/soc/intel/boards/sof_board_helpers.c
+++ b/sound/soc/intel/boards/sof_board_helpers.c
@@ -290,6 +290,49 @@ int sof_intel_board_set_ssp_amp_link(struct device *dev,
}
EXPORT_SYMBOL_NS(sof_intel_board_set_ssp_amp_link, SND_SOC_INTEL_SOF_BOARD_HELPERS);
+int sof_intel_board_set_bt_link(struct device *dev,
+ struct snd_soc_dai_link *link, int be_id,
+ int ssp_bt)
+{
+ struct snd_soc_dai_link_component *cpus;
+
+ dev_dbg(dev, "link %d: bt offload, ssp %d\n", be_id, ssp_bt);
+
+ /* link name */
+ link->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", ssp_bt);
+ if (!link->name)
+ return -ENOMEM;
+
+ /* cpus */
+ cpus = devm_kzalloc(dev, sizeof(struct snd_soc_dai_link_component),
+ GFP_KERNEL);
+ if (!cpus)
+ return -ENOMEM;
+
+ cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_bt);
+ if (!cpus->dai_name)
+ return -ENOMEM;
+
+ link->cpus = cpus;
+ link->num_cpus = 1;
+
+ /* codecs */
+ link->codecs = &snd_soc_dummy_dlc;
+ link->num_codecs = 1;
+
+ /* platforms */
+ link->platforms = platform_component;
+ link->num_platforms = ARRAY_SIZE(platform_component);
+
+ link->id = be_id;
+ link->no_pcm = 1;
+ link->dpcm_capture = 1;
+ link->dpcm_playback = 1;
+
+ return 0;
+}
+EXPORT_SYMBOL_NS(sof_intel_board_set_bt_link, SND_SOC_INTEL_SOF_BOARD_HELPERS);
+
MODULE_DESCRIPTION("ASoC Intel SOF Machine Driver Board Helpers");
MODULE_AUTHOR("Brent Lu <[email protected]>");
MODULE_LICENSE("GPL");