1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Driver for generic Bluetooth SCO link
4 * Copyright 2011 Lars-Peter Clausen <lars@metafoo.de>
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"),
16 SND_SOC_DAPM_AIF_IN("BT_SCO_RX", "Playback", 0,
18 SND_SOC_DAPM_AIF_OUT("BT_SCO_TX", "Capture", 0,
22 static const struct snd_soc_dapm_route bt_sco_routes[] = {
23 { "BT_SCO_TX", NULL, "RX" },
24 { "TX", NULL, "BT_SCO_RX" },
27 static struct snd_soc_dai_driver bt_sco_dai[] = {
31 .stream_name = "Playback",
34 .rates = SNDRV_PCM_RATE_8000,
35 .formats = SNDRV_PCM_FMTBIT_S16_LE,
38 .stream_name = "Capture",
41 .rates = SNDRV_PCM_RATE_8000,
42 .formats = SNDRV_PCM_FMTBIT_S16_LE,
46 .name = "bt-sco-pcm-wb",
48 .stream_name = "Playback",
51 .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000,
52 .formats = SNDRV_PCM_FMTBIT_S16_LE,
55 .stream_name = "Capture",
58 .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000,
59 .formats = SNDRV_PCM_FMTBIT_S16_LE,
64 static const struct snd_soc_component_driver soc_component_dev_bt_sco = {
65 .dapm_widgets = bt_sco_widgets,
66 .num_dapm_widgets = ARRAY_SIZE(bt_sco_widgets),
67 .dapm_routes = bt_sco_routes,
68 .num_dapm_routes = ARRAY_SIZE(bt_sco_routes),
72 .non_legacy_dai_naming = 1,
75 static int bt_sco_probe(struct platform_device *pdev)
77 return devm_snd_soc_register_component(&pdev->dev,
78 &soc_component_dev_bt_sco,
79 bt_sco_dai, ARRAY_SIZE(bt_sco_dai));
82 static int bt_sco_remove(struct platform_device *pdev)
87 static const struct platform_device_id bt_sco_driver_ids[] = {
96 MODULE_DEVICE_TABLE(platform, bt_sco_driver_ids);
98 #if defined(CONFIG_OF)
99 static const struct of_device_id bt_sco_codec_of_match[] = {
100 { .compatible = "delta,dfbmcs320", },
101 { .compatible = "linux,bt-sco", },
104 MODULE_DEVICE_TABLE(of, bt_sco_codec_of_match);
107 static struct platform_driver bt_sco_driver = {
110 .of_match_table = of_match_ptr(bt_sco_codec_of_match),
112 .probe = bt_sco_probe,
113 .remove = bt_sco_remove,
114 .id_table = bt_sco_driver_ids,
117 module_platform_driver(bt_sco_driver);
119 MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
120 MODULE_DESCRIPTION("ASoC generic bluetooth sco link driver");
121 MODULE_LICENSE("GPL");