phycore-ac97.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. static struct snd_soc_card imx_phycore;
  22. static struct snd_soc_ops imx_phycore_hifi_ops = {
  23. };
  24. static struct snd_soc_dai_link imx_phycore_dai_ac97[] = {
  25. {
  26. .name = "HiFi",
  27. .stream_name = "HiFi",
  28. .codec_dai_name = "wm9712-hifi",
  29. .codec_name = "wm9712-codec",
  30. .cpu_dai_name = "imx-ssi.0",
  31. .platform_name = "imx-fiq-pcm-audio.0",
  32. .ops = &imx_phycore_hifi_ops,
  33. },
  34. };
  35. static struct snd_soc_card imx_phycore = {
  36. .name = "PhyCORE-audio",
  37. .dai_link = imx_phycore_dai_ac97,
  38. .num_links = ARRAY_SIZE(imx_phycore_dai_ac97),
  39. };
  40. static struct platform_device *imx_phycore_snd_device;
  41. static int __init imx_phycore_init(void)
  42. {
  43. int ret;
  44. if (!machine_is_pcm043() && !machine_is_pca100())
  45. /* return happy. We might run on a totally different machine */
  46. return 0;
  47. imx_phycore_snd_device = platform_device_alloc("soc-audio", -1);
  48. if (!imx_phycore_snd_device)
  49. return -ENOMEM;
  50. platform_set_drvdata(imx_phycore_snd_device, &imx_phycore);
  51. ret = platform_device_add(imx_phycore_snd_device);
  52. imx_phycore_snd_device = platform_device_alloc("wm9712-codec", -1);
  53. if (!imx_phycore_snd_device)
  54. return -ENOMEM;
  55. ret = platform_device_add(imx_phycore_snd_device);
  56. if (ret) {
  57. printk(KERN_ERR "ASoC: Platform device allocation failed\n");
  58. platform_device_put(imx_phycore_snd_device);
  59. }
  60. return ret;
  61. }
  62. static void __exit imx_phycore_exit(void)
  63. {
  64. platform_device_unregister(imx_phycore_snd_device);
  65. }
  66. late_initcall(imx_phycore_init);
  67. module_exit(imx_phycore_exit);
  68. MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>");
  69. MODULE_DESCRIPTION("PhyCORE ALSA SoC driver");
  70. MODULE_LICENSE("GPL");