1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Driver for generic Bluetooth SCO link
7 #include <linux/init.h>
8 #include <linux/module.h>
9 #include <linux/platform_device.h>
11 #include <sound/soc.h>
13 static const struct snd_soc_dapm_widget bt_sco_widgets[] = {
14 SND_SOC_DAPM_INPUT("RX"),
15 SND_SOC_DAPM_OUTPUT("TX"),
18 static const struct snd_soc_dapm_route bt_sco_routes[] = {
19 { "Capture", NULL, "RX" },
20 { "TX", NULL, "Playback" },
23 static struct snd_soc_dai_driver bt_sco_dai[] = {
27 .stream_name = "Playback",
30 .rates = SNDRV_PCM_RATE_8000,
31 .formats = SNDRV_PCM_FMTBIT_S16_LE,
34 .stream_name = "Capture",
37 .rates = SNDRV_PCM_RATE_8000,
38 .formats = SNDRV_PCM_FMTBIT_S16_LE,
42 .name = "bt-sco-pcm-wb",
44 .stream_name = "Playback",
47 .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000,
48 .formats = SNDRV_PCM_FMTBIT_S16_LE,
51 .stream_name = "Capture",
54 .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000,
55 .formats = SNDRV_PCM_FMTBIT_S16_LE,
60 static const struct snd_soc_component_driver soc_component_dev_bt_sco = {
61 .dapm_widgets = bt_sco_widgets,
62 .num_dapm_widgets = ARRAY_SIZE(bt_sco_widgets),
63 .dapm_routes = bt_sco_routes,
64 .num_dapm_routes = ARRAY_SIZE(bt_sco_routes),
68 .non_legacy_dai_naming = 1,
71 static int bt_sco_probe(struct platform_device *pdev)
73 return devm_snd_soc_register_component(&pdev->dev,
74 &soc_component_dev_bt_sco,
75 bt_sco_dai, ARRAY_SIZE(bt_sco_dai));
78 static int bt_sco_remove(struct platform_device *pdev)
83 static const struct platform_device_id bt_sco_driver_ids[] = {
92 MODULE_DEVICE_TABLE(platform, bt_sco_driver_ids);
94 #if defined(CONFIG_OF)
95 static const struct of_device_id bt_sco_codec_of_match[] = {
96 { .compatible = "delta,dfbmcs320", },
97 { .compatible = "linux,bt-sco", },
100 MODULE_DEVICE_TABLE(of, bt_sco_codec_of_match);
103 static struct platform_driver bt_sco_driver = {
106 .of_match_table = of_match_ptr(bt_sco_codec_of_match),
108 .probe = bt_sco_probe,
109 .remove = bt_sco_remove,
110 .id_table = bt_sco_driver_ids,
113 module_platform_driver(bt_sco_driver);
116 MODULE_DESCRIPTION("ASoC generic bluetooth sco link driver");
117 MODULE_LICENSE("GPL");