nuc900-audio.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. .dai_link = &nuc900evb_ac97_dai,
  31. .num_links = 1,
  32. };
  33. static struct platform_device *nuc900evb_asoc_dev;
  34. static int __init nuc900evb_audio_init(void)
  35. {
  36. int ret;
  37. ret = -ENOMEM;
  38. nuc900evb_asoc_dev = platform_device_alloc("soc-audio", -1);
  39. if (!nuc900evb_asoc_dev)
  40. goto out;
  41. /* nuc900 board audio device */
  42. platform_set_drvdata(nuc900evb_asoc_dev, &nuc900evb_audio_machine);
  43. ret = platform_device_add(nuc900evb_asoc_dev);
  44. if (ret) {
  45. platform_device_put(nuc900evb_asoc_dev);
  46. nuc900evb_asoc_dev = NULL;
  47. }
  48. out:
  49. return ret;
  50. }
  51. static void __exit nuc900evb_audio_exit(void)
  52. {
  53. platform_device_unregister(nuc900evb_asoc_dev);
  54. }
  55. module_init(nuc900evb_audio_init);
  56. module_exit(nuc900evb_audio_exit);
  57. MODULE_LICENSE("GPL");
  58. MODULE_DESCRIPTION("NUC900 Series ASoC audio support");
  59. MODULE_AUTHOR("Wan ZongShun");