wm8782.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 struct snd_soc_dai_driver wm8782_dai = {
  28. .name = "wm8782",
  29. .capture = {
  30. .stream_name = "Capture",
  31. .channels_min = 2,
  32. .channels_max = 2,
  33. /* For configurations with FSAMPEN=0 */
  34. .rates = SNDRV_PCM_RATE_8000_48000,
  35. .formats = SNDRV_PCM_FMTBIT_S16_LE |
  36. SNDRV_PCM_FMTBIT_S20_3LE |
  37. SNDRV_PCM_FMTBIT_S24_LE,
  38. },
  39. };
  40. static struct snd_soc_codec_driver soc_codec_dev_wm8782;
  41. static __devinit int wm8782_probe(struct platform_device *pdev)
  42. {
  43. return snd_soc_register_codec(&pdev->dev,
  44. &soc_codec_dev_wm8782, &wm8782_dai, 1);
  45. }
  46. static int __devexit wm8782_remove(struct platform_device *pdev)
  47. {
  48. snd_soc_unregister_codec(&pdev->dev);
  49. return 0;
  50. }
  51. static struct platform_driver wm8782_codec_driver = {
  52. .driver = {
  53. .name = "wm8782",
  54. .owner = THIS_MODULE,
  55. },
  56. .probe = wm8782_probe,
  57. .remove = __devexit_p(wm8782_remove),
  58. };
  59. module_platform_driver(wm8782_codec_driver);
  60. MODULE_DESCRIPTION("ASoC WM8782 driver");
  61. MODULE_AUTHOR("Johannes Stezenbach <js@sig21.net>");
  62. MODULE_LICENSE("GPL");