0001
0002
0003
0004
0005
0006
0007 #include <linux/init.h>
0008 #include <linux/module.h>
0009 #include <linux/platform_device.h>
0010
0011 #include <sound/soc.h>
0012
0013 static const struct snd_soc_dapm_widget bt_sco_widgets[] = {
0014 SND_SOC_DAPM_INPUT("RX"),
0015 SND_SOC_DAPM_OUTPUT("TX"),
0016 SND_SOC_DAPM_AIF_IN("BT_SCO_RX", "Playback", 0,
0017 SND_SOC_NOPM, 0, 0),
0018 SND_SOC_DAPM_AIF_OUT("BT_SCO_TX", "Capture", 0,
0019 SND_SOC_NOPM, 0, 0),
0020 };
0021
0022 static const struct snd_soc_dapm_route bt_sco_routes[] = {
0023 { "BT_SCO_TX", NULL, "RX" },
0024 { "TX", NULL, "BT_SCO_RX" },
0025 };
0026
0027 static struct snd_soc_dai_driver bt_sco_dai[] = {
0028 {
0029 .name = "bt-sco-pcm",
0030 .playback = {
0031 .stream_name = "Playback",
0032 .channels_min = 1,
0033 .channels_max = 1,
0034 .rates = SNDRV_PCM_RATE_8000,
0035 .formats = SNDRV_PCM_FMTBIT_S16_LE,
0036 },
0037 .capture = {
0038 .stream_name = "Capture",
0039 .channels_min = 1,
0040 .channels_max = 1,
0041 .rates = SNDRV_PCM_RATE_8000,
0042 .formats = SNDRV_PCM_FMTBIT_S16_LE,
0043 },
0044 },
0045 {
0046 .name = "bt-sco-pcm-wb",
0047 .playback = {
0048 .stream_name = "Playback",
0049 .channels_min = 1,
0050 .channels_max = 1,
0051 .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000,
0052 .formats = SNDRV_PCM_FMTBIT_S16_LE,
0053 },
0054 .capture = {
0055 .stream_name = "Capture",
0056 .channels_min = 1,
0057 .channels_max = 1,
0058 .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000,
0059 .formats = SNDRV_PCM_FMTBIT_S16_LE,
0060 },
0061 }
0062 };
0063
0064 static const struct snd_soc_component_driver soc_component_dev_bt_sco = {
0065 .dapm_widgets = bt_sco_widgets,
0066 .num_dapm_widgets = ARRAY_SIZE(bt_sco_widgets),
0067 .dapm_routes = bt_sco_routes,
0068 .num_dapm_routes = ARRAY_SIZE(bt_sco_routes),
0069 .idle_bias_on = 1,
0070 .use_pmdown_time = 1,
0071 .endianness = 1,
0072 };
0073
0074 static int bt_sco_probe(struct platform_device *pdev)
0075 {
0076 return devm_snd_soc_register_component(&pdev->dev,
0077 &soc_component_dev_bt_sco,
0078 bt_sco_dai, ARRAY_SIZE(bt_sco_dai));
0079 }
0080
0081 static int bt_sco_remove(struct platform_device *pdev)
0082 {
0083 return 0;
0084 }
0085
0086 static const struct platform_device_id bt_sco_driver_ids[] = {
0087 {
0088 .name = "dfbmcs320",
0089 },
0090 {
0091 .name = "bt-sco",
0092 },
0093 {},
0094 };
0095 MODULE_DEVICE_TABLE(platform, bt_sco_driver_ids);
0096
0097 #if defined(CONFIG_OF)
0098 static const struct of_device_id bt_sco_codec_of_match[] = {
0099 { .compatible = "delta,dfbmcs320", },
0100 { .compatible = "linux,bt-sco", },
0101 {},
0102 };
0103 MODULE_DEVICE_TABLE(of, bt_sco_codec_of_match);
0104 #endif
0105
0106 static struct platform_driver bt_sco_driver = {
0107 .driver = {
0108 .name = "bt-sco",
0109 .of_match_table = of_match_ptr(bt_sco_codec_of_match),
0110 },
0111 .probe = bt_sco_probe,
0112 .remove = bt_sco_remove,
0113 .id_table = bt_sco_driver_ids,
0114 };
0115
0116 module_platform_driver(bt_sco_driver);
0117
0118 MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
0119 MODULE_DESCRIPTION("ASoC generic bluetooth sco link driver");
0120 MODULE_LICENSE("GPL");