nuc900-audio.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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 <sound/soc-dapm.h>
  20. #include "../codecs/ac97.h"
  21. #include "nuc900-audio.h"
  22. static struct snd_soc_dai_link nuc900evb_ac97_dai = {
  23. .name = "AC97",
  24. .stream_name = "AC97 HiFi",
  25. .cpu_dai = &nuc900_ac97_dai,
  26. .codec_dai = &ac97_dai,
  27. };
  28. static struct snd_soc_card nuc900evb_audio_machine = {
  29. .name = "NUC900EVB_AC97",
  30. .dai_link = &nuc900evb_ac97_dai,
  31. .num_links = 1,
  32. .platform = &nuc900_soc_platform,
  33. };
  34. static struct snd_soc_device nuc900evb_ac97_devdata = {
  35. .card = &nuc900evb_audio_machine,
  36. .codec_dev = &soc_codec_dev_ac97,
  37. };
  38. static struct platform_device *nuc900evb_asoc_dev;
  39. static int __init nuc900evb_audio_init(void)
  40. {
  41. int ret;
  42. ret = -ENOMEM;
  43. nuc900evb_asoc_dev = platform_device_alloc("soc-audio", -1);
  44. if (!nuc900evb_asoc_dev)
  45. goto out;
  46. /* nuc900 board audio device */
  47. platform_set_drvdata(nuc900evb_asoc_dev, &nuc900evb_ac97_devdata);
  48. nuc900evb_ac97_devdata.dev = &nuc900evb_asoc_dev->dev;
  49. ret = platform_device_add(nuc900evb_asoc_dev);
  50. if (ret) {
  51. platform_device_put(nuc900evb_asoc_dev);
  52. nuc900evb_asoc_dev = NULL;
  53. }
  54. out:
  55. return ret;
  56. }
  57. static void __exit nuc900evb_audio_exit(void)
  58. {
  59. platform_device_unregister(nuc900evb_asoc_dev);
  60. }
  61. module_init(nuc900evb_audio_init);
  62. module_exit(nuc900evb_audio_exit);
  63. MODULE_LICENSE("GPL");
  64. MODULE_DESCRIPTION("NUC900 Series ASoC audio support");
  65. MODULE_AUTHOR("Wan ZongShun");