pcm030-audio-fabric.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 <sound/soc-of-simple.h>
  26. #include "mpc5200_dma.h"
  27. #include "mpc5200_psc_ac97.h"
  28. #include "../codecs/wm9712.h"
  29. static struct snd_soc_device device;
  30. static struct snd_soc_card card;
  31. static struct snd_soc_dai_link pcm030_fabric_dai[] = {
  32. {
  33. .name = "AC97",
  34. .stream_name = "AC97 Analog",
  35. .codec_dai = &wm9712_dai[WM9712_DAI_AC97_HIFI],
  36. .cpu_dai = &psc_ac97_dai[MPC5200_AC97_NORMAL],
  37. },
  38. {
  39. .name = "AC97",
  40. .stream_name = "AC97 IEC958",
  41. .codec_dai = &wm9712_dai[WM9712_DAI_AC97_AUX],
  42. .cpu_dai = &psc_ac97_dai[MPC5200_AC97_SPDIF],
  43. },
  44. };
  45. static __init int pcm030_fabric_init(void)
  46. {
  47. struct platform_device *pdev;
  48. int rc;
  49. if (!machine_is_compatible("phytec,pcm030"))
  50. return -ENODEV;
  51. card.platform = &mpc5200_audio_dma_platform;
  52. card.name = "pcm030";
  53. card.dai_link = pcm030_fabric_dai;
  54. card.num_links = ARRAY_SIZE(pcm030_fabric_dai);
  55. device.card = &card;
  56. device.codec_dev = &soc_codec_dev_wm9712;
  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, &device);
  63. device.dev = &pdev->dev;
  64. rc = platform_device_add(pdev);
  65. if (rc) {
  66. pr_err("pcm030_fabric_init: platform_device_add() failed\n");
  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");