phycore-ac97.c 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * phycore-ac97.c -- SoC audio for imx_phycore in AC97 mode
  3. *
  4. * Copyright 2009 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation; either version 2 of the License, or (at your
  9. * option) any later version.
  10. *
  11. */
  12. #include <linux/module.h>
  13. #include <linux/moduleparam.h>
  14. #include <linux/device.h>
  15. #include <linux/i2c.h>
  16. #include <sound/core.h>
  17. #include <sound/pcm.h>
  18. #include <sound/soc.h>
  19. #include <sound/soc-dapm.h>
  20. #include <asm/mach-types.h>
  21. #include "../codecs/wm9712.h"
  22. #include "imx-ssi.h"
  23. static struct snd_soc_card imx_phycore;
  24. static struct snd_soc_ops imx_phycore_hifi_ops = {
  25. };
  26. static struct snd_soc_dai_link imx_phycore_dai_ac97[] = {
  27. {
  28. .name = "HiFi",
  29. .stream_name = "HiFi",
  30. .codec_dai_name = "wm9712-hifi",
  31. .codec_name = "wm9712-codec",
  32. .cpu_dai_name = "imx-ssi.0",
  33. .platform_name = "imx-fiq-pcm-audio.0",
  34. .ops = &imx_phycore_hifi_ops,
  35. },
  36. };
  37. static struct snd_soc_card imx_phycore = {
  38. .name = "PhyCORE-audio",
  39. .dai_link = imx_phycore_dai_ac97,
  40. .num_links = ARRAY_SIZE(imx_phycore_dai_ac97),
  41. };
  42. static struct platform_device *imx_phycore_snd_device;
  43. static int __init imx_phycore_init(void)
  44. {
  45. int ret;
  46. if (!machine_is_pcm043() && !machine_is_pca100())
  47. /* return happy. We might run on a totally different machine */
  48. return 0;
  49. imx_phycore_snd_device = platform_device_alloc("soc-audio", -1);
  50. if (!imx_phycore_snd_device)
  51. return -ENOMEM;
  52. platform_set_drvdata(imx_phycore_snd_device, &imx_phycore);
  53. ret = platform_device_add(imx_phycore_snd_device);
  54. imx_phycore_snd_device = platform_device_alloc("wm9712-codec", -1);
  55. if (!imx_phycore_snd_device)
  56. return -ENOMEM;
  57. ret = platform_device_add(imx_phycore_snd_device);
  58. if (ret) {
  59. printk(KERN_ERR "ASoC: Platform device allocation failed\n");
  60. platform_device_put(imx_phycore_snd_device);
  61. }
  62. return ret;
  63. }
  64. static void __exit imx_phycore_exit(void)
  65. {
  66. platform_device_unregister(imx_phycore_snd_device);
  67. }
  68. late_initcall(imx_phycore_init);
  69. module_exit(imx_phycore_exit);
  70. MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>");
  71. MODULE_DESCRIPTION("PhyCORE ALSA SoC driver");
  72. MODULE_LICENSE("GPL");