em-x270.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * em-x270.c -- SoC audio for EM-X270
  3. *
  4. * Copyright 2007 CompuLab, Ltd.
  5. *
  6. * Author: Mike Rapoport <mike@compulab.co.il>
  7. *
  8. * Copied from tosa.c:
  9. * Copyright 2005 Wolfson Microelectronics PLC.
  10. * Copyright 2005 Openedhand Ltd.
  11. *
  12. * Authors: Liam Girdwood <lrg@slimlogic.co.uk>
  13. * Richard Purdie <richard@openedhand.com>
  14. *
  15. * This program is free software; you can redistribute it and/or modify it
  16. * under the terms of the GNU General Public License as published by the
  17. * Free Software Foundation; either version 2 of the License, or (at your
  18. * option) any later version.
  19. *
  20. */
  21. #include <linux/module.h>
  22. #include <linux/moduleparam.h>
  23. #include <linux/device.h>
  24. #include <sound/driver.h>
  25. #include <sound/core.h>
  26. #include <sound/pcm.h>
  27. #include <sound/soc.h>
  28. #include <sound/soc-dapm.h>
  29. #include <asm/mach-types.h>
  30. #include <mach/pxa-regs.h>
  31. #include <mach/hardware.h>
  32. #include <mach/audio.h>
  33. #include "../codecs/wm9712.h"
  34. #include "pxa2xx-pcm.h"
  35. #include "pxa2xx-ac97.h"
  36. static struct snd_soc_dai_link em_x270_dai[] = {
  37. {
  38. .name = "AC97",
  39. .stream_name = "AC97 HiFi",
  40. .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_HIFI],
  41. .codec_dai = &wm9712_dai[WM9712_DAI_AC97_HIFI],
  42. },
  43. {
  44. .name = "AC97 Aux",
  45. .stream_name = "AC97 Aux",
  46. .cpu_dai = &pxa_ac97_dai[PXA2XX_DAI_AC97_AUX],
  47. .codec_dai = &wm9712_dai[WM9712_DAI_AC97_AUX],
  48. },
  49. };
  50. static struct snd_soc_machine em_x270 = {
  51. .name = "EM-X270",
  52. .dai_link = em_x270_dai,
  53. .num_links = ARRAY_SIZE(em_x270_dai),
  54. };
  55. static struct snd_soc_device em_x270_snd_devdata = {
  56. .machine = &em_x270,
  57. .platform = &pxa2xx_soc_platform,
  58. .codec_dev = &soc_codec_dev_wm9712,
  59. };
  60. static struct platform_device *em_x270_snd_device;
  61. static int __init em_x270_init(void)
  62. {
  63. int ret;
  64. if (!machine_is_em_x270())
  65. return -ENODEV;
  66. em_x270_snd_device = platform_device_alloc("soc-audio", -1);
  67. if (!em_x270_snd_device)
  68. return -ENOMEM;
  69. platform_set_drvdata(em_x270_snd_device, &em_x270_snd_devdata);
  70. em_x270_snd_devdata.dev = &em_x270_snd_device->dev;
  71. ret = platform_device_add(em_x270_snd_device);
  72. if (ret)
  73. platform_device_put(em_x270_snd_device);
  74. return ret;
  75. }
  76. static void __exit em_x270_exit(void)
  77. {
  78. platform_device_unregister(em_x270_snd_device);
  79. }
  80. module_init(em_x270_init);
  81. module_exit(em_x270_exit);
  82. /* Module information */
  83. MODULE_AUTHOR("Mike Rapoport");
  84. MODULE_DESCRIPTION("ALSA SoC EM-X270");
  85. MODULE_LICENSE("GPL");