bt-sco.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Driver for generic Bluetooth SCO link
  3. * Copyright 2011 Lars-Peter Clausen <lars@metafoo.de>
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License as published by the
  7. * Free Software Foundation; either version 2 of the License, or (at your
  8. * option) any later version.
  9. *
  10. */
  11. #include <linux/init.h>
  12. #include <linux/module.h>
  13. #include <linux/platform_device.h>
  14. #include <sound/soc.h>
  15. static const struct snd_soc_dapm_widget bt_sco_widgets[] = {
  16. SND_SOC_DAPM_INPUT("RX"),
  17. SND_SOC_DAPM_OUTPUT("TX"),
  18. };
  19. static const struct snd_soc_dapm_route bt_sco_routes[] = {
  20. { "Capture", NULL, "RX" },
  21. { "TX", NULL, "Playback" },
  22. };
  23. static struct snd_soc_dai_driver bt_sco_dai = {
  24. .name = "bt-sco-pcm",
  25. .playback = {
  26. .stream_name = "Playback",
  27. .channels_min = 1,
  28. .channels_max = 1,
  29. .rates = SNDRV_PCM_RATE_8000,
  30. .formats = SNDRV_PCM_FMTBIT_S16_LE,
  31. },
  32. .capture = {
  33. .stream_name = "Capture",
  34. .channels_min = 1,
  35. .channels_max = 1,
  36. .rates = SNDRV_PCM_RATE_8000,
  37. .formats = SNDRV_PCM_FMTBIT_S16_LE,
  38. },
  39. };
  40. static struct snd_soc_codec_driver soc_codec_dev_bt_sco = {
  41. .dapm_widgets = bt_sco_widgets,
  42. .num_dapm_widgets = ARRAY_SIZE(bt_sco_widgets),
  43. .dapm_routes = bt_sco_routes,
  44. .num_dapm_routes = ARRAY_SIZE(bt_sco_routes),
  45. };
  46. static int bt_sco_probe(struct platform_device *pdev)
  47. {
  48. return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_bt_sco,
  49. &bt_sco_dai, 1);
  50. }
  51. static int bt_sco_remove(struct platform_device *pdev)
  52. {
  53. snd_soc_unregister_codec(&pdev->dev);
  54. return 0;
  55. }
  56. static struct platform_device_id bt_sco_driver_ids[] = {
  57. {
  58. .name = "dfbmcs320",
  59. },
  60. {
  61. .name = "bt-sco",
  62. },
  63. {},
  64. };
  65. MODULE_DEVICE_TABLE(platform, bt_sco_driver_ids);
  66. static struct platform_driver bt_sco_driver = {
  67. .driver = {
  68. .name = "bt-sco",
  69. .owner = THIS_MODULE,
  70. },
  71. .probe = bt_sco_probe,
  72. .remove = bt_sco_remove,
  73. .id_table = bt_sco_driver_ids,
  74. };
  75. module_platform_driver(bt_sco_driver);
  76. MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
  77. MODULE_DESCRIPTION("ASoC generic bluethooth sco link driver");
  78. MODULE_LICENSE("GPL");