pcm030-audio-fabric.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Phytec pcm030 driver for the PSC of the Freescale MPC52xx
  3. * configured as AC97 interface
  4. *
  5. * Copyright 2008 Jon Smirl, Digispeaker
  6. * Author: Jon Smirl <jonsmirl@gmail.com>
  7. *
  8. * This file is licensed under the terms of the GNU General Public License
  9. * version 2. This program is licensed "as is" without any warranty of any
  10. * kind, whether express or implied.
  11. */
  12. #include <linux/init.h>
  13. #include <linux/module.h>
  14. #include <linux/device.h>
  15. #include <linux/of_device.h>
  16. #include <linux/of_platform.h>
  17. #include <sound/soc.h>
  18. #include "mpc5200_dma.h"
  19. #define DRV_NAME "pcm030-audio-fabric"
  20. static struct snd_soc_dai_link pcm030_fabric_dai[] = {
  21. {
  22. .name = "AC97",
  23. .stream_name = "AC97 Analog",
  24. .codec_dai_name = "wm9712-hifi",
  25. .cpu_dai_name = "mpc5200-psc-ac97.0",
  26. .platform_name = "mpc5200-pcm-audio",
  27. .codec_name = "wm9712-codec",
  28. },
  29. {
  30. .name = "AC97",
  31. .stream_name = "AC97 IEC958",
  32. .codec_dai_name = "wm9712-aux",
  33. .cpu_dai_name = "mpc5200-psc-ac97.1",
  34. .platform_name = "mpc5200-pcm-audio",
  35. .codec_name = "wm9712-codec",
  36. },
  37. };
  38. static struct snd_soc_card card = {
  39. .name = "pcm030",
  40. .owner = THIS_MODULE,
  41. .dai_link = pcm030_fabric_dai,
  42. .num_links = ARRAY_SIZE(pcm030_fabric_dai),
  43. };
  44. static __init int pcm030_fabric_init(void)
  45. {
  46. struct platform_device *pdev;
  47. int rc;
  48. if (!of_machine_is_compatible("phytec,pcm030"))
  49. return -ENODEV;
  50. pdev = platform_device_alloc("soc-audio", 1);
  51. if (!pdev) {
  52. pr_err("pcm030_fabric_init: platform_device_alloc() failed\n");
  53. return -ENODEV;
  54. }
  55. platform_set_drvdata(pdev, &card);
  56. rc = platform_device_add(pdev);
  57. if (rc) {
  58. pr_err("pcm030_fabric_init: platform_device_add() failed\n");
  59. platform_device_put(pdev);
  60. return -ENODEV;
  61. }
  62. return 0;
  63. }
  64. module_init(pcm030_fabric_init);
  65. MODULE_AUTHOR("Jon Smirl <jonsmirl@gmail.com>");
  66. MODULE_DESCRIPTION(DRV_NAME ": mpc5200 pcm030 fabric driver");
  67. MODULE_LICENSE("GPL");