spdif_receiver.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * ALSA SoC SPDIF DIR (Digital Interface Reciever) driver
  3. *
  4. * Based on ALSA SoC SPDIF DIT driver
  5. *
  6. * This driver is used by controllers which can operate in DIR (SPDI/F) where
  7. * no codec is needed. This file provides stub codec that can be used
  8. * in these configurations. SPEAr SPDIF IN Audio controller uses this driver.
  9. *
  10. * Author: Vipin Kumar, <vipin.kumar@st.com>
  11. * Copyright: (C) 2012 ST Microelectronics
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License version 2 as
  15. * published by the Free Software Foundation.
  16. */
  17. #include <linux/module.h>
  18. #include <linux/moduleparam.h>
  19. #include <linux/slab.h>
  20. #include <sound/soc.h>
  21. #include <sound/pcm.h>
  22. #include <sound/initval.h>
  23. #define STUB_RATES SNDRV_PCM_RATE_8000_192000
  24. #define STUB_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \
  25. SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE)
  26. static struct snd_soc_codec_driver soc_codec_spdif_dir;
  27. static struct snd_soc_dai_driver dir_stub_dai = {
  28. .name = "dir-hifi",
  29. .capture = {
  30. .stream_name = "Capture",
  31. .channels_min = 1,
  32. .channels_max = 384,
  33. .rates = STUB_RATES,
  34. .formats = STUB_FORMATS,
  35. },
  36. };
  37. static int spdif_dir_probe(struct platform_device *pdev)
  38. {
  39. return snd_soc_register_codec(&pdev->dev, &soc_codec_spdif_dir,
  40. &dir_stub_dai, 1);
  41. }
  42. static int spdif_dir_remove(struct platform_device *pdev)
  43. {
  44. snd_soc_unregister_codec(&pdev->dev);
  45. return 0;
  46. }
  47. static struct platform_driver spdif_dir_driver = {
  48. .probe = spdif_dir_probe,
  49. .remove = spdif_dir_remove,
  50. .driver = {
  51. .name = "spdif-dir",
  52. .owner = THIS_MODULE,
  53. },
  54. };
  55. module_platform_driver(spdif_dir_driver);
  56. MODULE_DESCRIPTION("ASoC SPDIF DIR driver");
  57. MODULE_AUTHOR("Vipin Kumar <vipin.kumar@st.com>");
  58. MODULE_LICENSE("GPL");