wm8782.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * sound/soc/codecs/wm8782.c
  3. * simple, strap-pin configured 24bit 2ch ADC
  4. *
  5. * Copyright: 2011 Raumfeld GmbH
  6. * Author: Johannes Stezenbach <js@sig21.net>
  7. *
  8. * based on ad73311.c
  9. * Copyright: Analog Device Inc.
  10. * Author: Cliff Cai <cliff.cai@analog.com>
  11. *
  12. * This program is free software; you can redistribute it and/or modify it
  13. * under the terms of the GNU General Public License as published by the
  14. * Free Software Foundation; either version 2 of the License, or (at your
  15. * option) any later version.
  16. */
  17. #include <linux/init.h>
  18. #include <linux/slab.h>
  19. #include <linux/module.h>
  20. #include <linux/kernel.h>
  21. #include <linux/device.h>
  22. #include <sound/core.h>
  23. #include <sound/pcm.h>
  24. #include <sound/ac97_codec.h>
  25. #include <sound/initval.h>
  26. #include <sound/soc.h>
  27. static const struct snd_soc_dapm_widget wm8782_dapm_widgets[] = {
  28. SND_SOC_DAPM_INPUT("AINL"),
  29. SND_SOC_DAPM_INPUT("AINR"),
  30. };
  31. static const struct snd_soc_dapm_route wm8782_dapm_routes[] = {
  32. { "Capture", NULL, "AINL" },
  33. { "Capture", NULL, "AINR" },
  34. };
  35. static struct snd_soc_dai_driver wm8782_dai = {
  36. .name = "wm8782",
  37. .capture = {
  38. .stream_name = "Capture",
  39. .channels_min = 2,
  40. .channels_max = 2,
  41. /* For configurations with FSAMPEN=0 */
  42. .rates = SNDRV_PCM_RATE_8000_48000,
  43. .formats = SNDRV_PCM_FMTBIT_S16_LE |
  44. SNDRV_PCM_FMTBIT_S20_3LE |
  45. SNDRV_PCM_FMTBIT_S24_LE,
  46. },
  47. };
  48. static const struct snd_soc_codec_driver soc_codec_dev_wm8782 = {
  49. .component_driver = {
  50. .dapm_widgets = wm8782_dapm_widgets,
  51. .num_dapm_widgets = ARRAY_SIZE(wm8782_dapm_widgets),
  52. .dapm_routes = wm8782_dapm_routes,
  53. .num_dapm_routes = ARRAY_SIZE(wm8782_dapm_routes),
  54. },
  55. };
  56. static int wm8782_probe(struct platform_device *pdev)
  57. {
  58. return snd_soc_register_codec(&pdev->dev,
  59. &soc_codec_dev_wm8782, &wm8782_dai, 1);
  60. }
  61. static int wm8782_remove(struct platform_device *pdev)
  62. {
  63. snd_soc_unregister_codec(&pdev->dev);
  64. return 0;
  65. }
  66. static struct platform_driver wm8782_codec_driver = {
  67. .driver = {
  68. .name = "wm8782",
  69. },
  70. .probe = wm8782_probe,
  71. .remove = wm8782_remove,
  72. };
  73. module_platform_driver(wm8782_codec_driver);
  74. MODULE_DESCRIPTION("ASoC WM8782 driver");
  75. MODULE_AUTHOR("Johannes Stezenbach <js@sig21.net>");
  76. MODULE_LICENSE("GPL");