blob: 4d286844e3c832cc81ed182b8ce3b6aa815dd0b4 [file] [log] [blame]
Thomas Gleixner2874c5f2019-05-27 08:55:01 +02001// SPDX-License-Identifier: GPL-2.0-or-later
Barry Song200ceb92013-05-18 20:25:00 +08002/*
3 * Driver for generic Bluetooth SCO link
4 * Copyright 2011 Lars-Peter Clausen <lars@metafoo.de>
Barry Song200ceb92013-05-18 20:25:00 +08005 */
6
7#include <linux/init.h>
8#include <linux/module.h>
9#include <linux/platform_device.h>
10
11#include <sound/soc.h>
12
Mark Brown5195ca42013-08-19 12:16:19 +010013static const struct snd_soc_dapm_widget bt_sco_widgets[] = {
14 SND_SOC_DAPM_INPUT("RX"),
15 SND_SOC_DAPM_OUTPUT("TX"),
16};
17
18static const struct snd_soc_dapm_route bt_sco_routes[] = {
19 { "Capture", NULL, "RX" },
20 { "TX", NULL, "Playback" },
21};
22
Garlic Tseng5947e1b2016-07-04 18:56:26 +080023static struct snd_soc_dai_driver bt_sco_dai[] = {
24 {
25 .name = "bt-sco-pcm",
26 .playback = {
27 .stream_name = "Playback",
28 .channels_min = 1,
29 .channels_max = 1,
30 .rates = SNDRV_PCM_RATE_8000,
31 .formats = SNDRV_PCM_FMTBIT_S16_LE,
32 },
33 .capture = {
34 .stream_name = "Capture",
35 .channels_min = 1,
36 .channels_max = 1,
37 .rates = SNDRV_PCM_RATE_8000,
38 .formats = SNDRV_PCM_FMTBIT_S16_LE,
39 },
Barry Song200ceb92013-05-18 20:25:00 +080040 },
Garlic Tseng5947e1b2016-07-04 18:56:26 +080041 {
42 .name = "bt-sco-pcm-wb",
43 .playback = {
44 .stream_name = "Playback",
45 .channels_min = 1,
46 .channels_max = 1,
47 .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000,
48 .formats = SNDRV_PCM_FMTBIT_S16_LE,
49 },
50 .capture = {
51 .stream_name = "Capture",
52 .channels_min = 1,
53 .channels_max = 1,
54 .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000,
55 .formats = SNDRV_PCM_FMTBIT_S16_LE,
56 },
57 }
Barry Song200ceb92013-05-18 20:25:00 +080058};
59
Kuninori Morimoto90e678d2018-01-29 04:34:42 +000060static 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),
65 .idle_bias_on = 1,
66 .use_pmdown_time = 1,
67 .endianness = 1,
68 .non_legacy_dai_naming = 1,
Mark Brown5195ca42013-08-19 12:16:19 +010069};
Barry Song200ceb92013-05-18 20:25:00 +080070
71static int bt_sco_probe(struct platform_device *pdev)
72{
Kuninori Morimoto90e678d2018-01-29 04:34:42 +000073 return devm_snd_soc_register_component(&pdev->dev,
74 &soc_component_dev_bt_sco,
Garlic Tseng5947e1b2016-07-04 18:56:26 +080075 bt_sco_dai, ARRAY_SIZE(bt_sco_dai));
Barry Song200ceb92013-05-18 20:25:00 +080076}
77
78static int bt_sco_remove(struct platform_device *pdev)
79{
Barry Song200ceb92013-05-18 20:25:00 +080080 return 0;
81}
82
Krzysztof Kozlowskic5787432015-05-02 01:00:12 +090083static const struct platform_device_id bt_sco_driver_ids[] = {
Barry Song200ceb92013-05-18 20:25:00 +080084 {
85 .name = "dfbmcs320",
86 },
Mark Brownb9dff9c2013-08-19 12:13:14 +010087 {
88 .name = "bt-sco",
89 },
Barry Song200ceb92013-05-18 20:25:00 +080090 {},
91};
92MODULE_DEVICE_TABLE(platform, bt_sco_driver_ids);
93
Marek Beliskoc778b472015-05-08 21:02:34 +020094#if defined(CONFIG_OF)
95static const struct of_device_id bt_sco_codec_of_match[] = {
96 { .compatible = "delta,dfbmcs320", },
Garlic Tseng5947e1b2016-07-04 18:56:26 +080097 { .compatible = "linux,bt-sco", },
Marek Beliskoc778b472015-05-08 21:02:34 +020098 {},
99};
100MODULE_DEVICE_TABLE(of, bt_sco_codec_of_match);
101#endif
102
Barry Song200ceb92013-05-18 20:25:00 +0800103static struct platform_driver bt_sco_driver = {
104 .driver = {
105 .name = "bt-sco",
Marek Beliskoc778b472015-05-08 21:02:34 +0200106 .of_match_table = of_match_ptr(bt_sco_codec_of_match),
Barry Song200ceb92013-05-18 20:25:00 +0800107 },
108 .probe = bt_sco_probe,
109 .remove = bt_sco_remove,
110 .id_table = bt_sco_driver_ids,
111};
112
113module_platform_driver(bt_sco_driver);
114
115MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
Masanari Iidaa4651222015-01-15 19:29:28 +0900116MODULE_DESCRIPTION("ASoC generic bluetooth sco link driver");
Barry Song200ceb92013-05-18 20:25:00 +0800117MODULE_LICENSE("GPL");