ad73311.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * ad73311.c -- ALSA Soc AD73311 codec support
  3. *
  4. * Copyright: Analog Device Inc.
  5. * Author: Cliff Cai <cliff.cai@analog.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation; either version 2 of the License, or (at your
  10. * option) any later version.
  11. */
  12. #include <linux/init.h>
  13. #include <linux/slab.h>
  14. #include <linux/module.h>
  15. #include <linux/kernel.h>
  16. #include <linux/device.h>
  17. #include <sound/core.h>
  18. #include <sound/pcm.h>
  19. #include <sound/ac97_codec.h>
  20. #include <sound/initval.h>
  21. #include <sound/soc.h>
  22. #include "ad73311.h"
  23. static struct snd_soc_dai_driver ad73311_dai = {
  24. .name = "ad73311-hifi",
  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. .capture = {
  32. .stream_name = "Capture",
  33. .channels_min = 1,
  34. .channels_max = 1,
  35. .rates = SNDRV_PCM_RATE_8000,
  36. .formats = SNDRV_PCM_FMTBIT_S16_LE, },
  37. };
  38. static struct snd_soc_codec_driver soc_codec_dev_ad73311;
  39. static int ad73311_probe(struct platform_device *pdev)
  40. {
  41. return snd_soc_register_codec(&pdev->dev,
  42. &soc_codec_dev_ad73311, &ad73311_dai, 1);
  43. }
  44. static int __devexit ad73311_remove(struct platform_device *pdev)
  45. {
  46. snd_soc_unregister_codec(&pdev->dev);
  47. return 0;
  48. }
  49. static struct platform_driver ad73311_codec_driver = {
  50. .driver = {
  51. .name = "ad73311",
  52. .owner = THIS_MODULE,
  53. },
  54. .probe = ad73311_probe,
  55. .remove = __devexit_p(ad73311_remove),
  56. };
  57. static int __init ad73311_init(void)
  58. {
  59. return platform_driver_register(&ad73311_codec_driver);
  60. }
  61. module_init(ad73311_init);
  62. static void __exit ad73311_exit(void)
  63. {
  64. platform_driver_unregister(&ad73311_codec_driver);
  65. }
  66. module_exit(ad73311_exit);
  67. MODULE_DESCRIPTION("ASoC ad73311 driver");
  68. MODULE_AUTHOR("Cliff Cai ");
  69. MODULE_LICENSE("GPL");