nuc900-audio.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright (c) 2010 Nuvoton technology corporation.
  3. *
  4. * Wan ZongShun <mcuos.com@gmail.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation;version 2 of the License.
  9. *
  10. */
  11. #include <linux/module.h>
  12. #include <linux/moduleparam.h>
  13. #include <linux/timer.h>
  14. #include <linux/interrupt.h>
  15. #include <linux/platform_device.h>
  16. #include <sound/core.h>
  17. #include <sound/pcm.h>
  18. #include <sound/soc.h>
  19. #include "nuc900-audio.h"
  20. static struct snd_soc_dai_link nuc900evb_ac97_dai = {
  21. .name = "AC97",
  22. .stream_name = "AC97 HiFi",
  23. .cpu_dai_name = "nuc900-ac97",
  24. .codec_dai_name = "ac97-hifi",
  25. .codec_name = "ac97-codec",
  26. .platform_name = "nuc900-pcm-audio",
  27. };
  28. static struct snd_soc_card nuc900evb_audio_machine = {
  29. .name = "NUC900EVB_AC97",
  30. .owner = THIS_MODULE,
  31. .dai_link = &nuc900evb_ac97_dai,
  32. .num_links = 1,
  33. };
  34. static struct platform_device *nuc900evb_asoc_dev;
  35. static int __init nuc900evb_audio_init(void)
  36. {
  37. int ret;
  38. ret = -ENOMEM;
  39. nuc900evb_asoc_dev = platform_device_alloc("soc-audio", -1);
  40. if (!nuc900evb_asoc_dev)
  41. goto out;
  42. /* nuc900 board audio device */
  43. platform_set_drvdata(nuc900evb_asoc_dev, &nuc900evb_audio_machine);
  44. ret = platform_device_add(nuc900evb_asoc_dev);
  45. if (ret) {
  46. platform_device_put(nuc900evb_asoc_dev);
  47. nuc900evb_asoc_dev = NULL;
  48. }
  49. out:
  50. return ret;
  51. }
  52. static void __exit nuc900evb_audio_exit(void)
  53. {
  54. platform_device_unregister(nuc900evb_asoc_dev);
  55. }
  56. module_init(nuc900evb_audio_init);
  57. module_exit(nuc900evb_audio_exit);
  58. MODULE_LICENSE("GPL");
  59. MODULE_DESCRIPTION("NUC900 Series ASoC audio support");
  60. MODULE_AUTHOR("Wan ZongShun");