pcm030-audio-fabric.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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/interrupt.h>
  15. #include <linux/device.h>
  16. #include <linux/delay.h>
  17. #include <linux/of_device.h>
  18. #include <linux/of_platform.h>
  19. #include <linux/dma-mapping.h>
  20. #include <sound/core.h>
  21. #include <sound/pcm.h>
  22. #include <sound/pcm_params.h>
  23. #include <sound/initval.h>
  24. #include <sound/soc.h>
  25. #include "mpc5200_dma.h"
  26. #include "mpc5200_psc_ac97.h"
  27. #include "../codecs/wm9712.h"
  28. #define DRV_NAME "pcm030-audio-fabric"
  29. static struct snd_soc_card card;
  30. static struct snd_soc_dai_link pcm030_fabric_dai[] = {
  31. {
  32. .name = "AC97",
  33. .stream_name = "AC97 Analog",
  34. .codec_dai_name = "wm9712-hifi",
  35. .cpu_dai_name = "mpc5200-psc-ac97.0",
  36. .platform_name = "mpc5200-pcm-audio",
  37. .codec_name = "wm9712-codec",
  38. },
  39. {
  40. .name = "AC97",
  41. .stream_name = "AC97 IEC958",
  42. .codec_dai_name = "wm9712-aux",
  43. .cpu_dai_name = "mpc5200-psc-ac97.1",
  44. .platform_name = "mpc5200-pcm-audio",
  45. .codec_name = "wm9712-codec",
  46. },
  47. };
  48. static __init int pcm030_fabric_init(void)
  49. {
  50. struct platform_device *pdev;
  51. int rc;
  52. if (!of_machine_is_compatible("phytec,pcm030"))
  53. return -ENODEV;
  54. card.name = "pcm030";
  55. card.dai_link = pcm030_fabric_dai;
  56. card.num_links = ARRAY_SIZE(pcm030_fabric_dai);
  57. pdev = platform_device_alloc("soc-audio", 1);
  58. if (!pdev) {
  59. pr_err("pcm030_fabric_init: platform_device_alloc() failed\n");
  60. return -ENODEV;
  61. }
  62. platform_set_drvdata(pdev, &card);
  63. rc = platform_device_add(pdev);
  64. if (rc) {
  65. pr_err("pcm030_fabric_init: platform_device_add() failed\n");
  66. platform_device_put(pdev);
  67. return -ENODEV;
  68. }
  69. return 0;
  70. }
  71. module_init(pcm030_fabric_init);
  72. MODULE_AUTHOR("Jon Smirl <jonsmirl@gmail.com>");
  73. MODULE_DESCRIPTION(DRV_NAME ": mpc5200 pcm030 fabric driver");
  74. MODULE_LICENSE("GPL");