pcm030-audio-fabric.c 2.2 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 <sound/soc-of-simple.h>
  26. #include "mpc5200_dma.h"
  27. #include "mpc5200_psc_ac97.h"
  28. #include "../codecs/wm9712.h"
  29. #define DRV_NAME "pcm030-audio-fabric"
  30. static struct snd_soc_device device;
  31. static struct snd_soc_card card;
  32. static struct snd_soc_dai_link pcm030_fabric_dai[] = {
  33. {
  34. .name = "AC97",
  35. .stream_name = "AC97 Analog",
  36. .codec_dai = &wm9712_dai[WM9712_DAI_AC97_HIFI],
  37. .cpu_dai = &psc_ac97_dai[MPC5200_AC97_NORMAL],
  38. },
  39. {
  40. .name = "AC97",
  41. .stream_name = "AC97 IEC958",
  42. .codec_dai = &wm9712_dai[WM9712_DAI_AC97_AUX],
  43. .cpu_dai = &psc_ac97_dai[MPC5200_AC97_SPDIF],
  44. },
  45. };
  46. static __init int pcm030_fabric_init(void)
  47. {
  48. struct platform_device *pdev;
  49. int rc;
  50. if (!machine_is_compatible("phytec,pcm030"))
  51. return -ENODEV;
  52. card.platform = &mpc5200_audio_dma_platform;
  53. card.name = "pcm030";
  54. card.dai_link = pcm030_fabric_dai;
  55. card.num_links = ARRAY_SIZE(pcm030_fabric_dai);
  56. device.card = &card;
  57. device.codec_dev = &soc_codec_dev_wm9712;
  58. pdev = platform_device_alloc("soc-audio", 1);
  59. if (!pdev) {
  60. pr_err("pcm030_fabric_init: platform_device_alloc() failed\n");
  61. return -ENODEV;
  62. }
  63. platform_set_drvdata(pdev, &device);
  64. device.dev = &pdev->dev;
  65. rc = platform_device_add(pdev);
  66. if (rc) {
  67. pr_err("pcm030_fabric_init: platform_device_add() failed\n");
  68. return -ENODEV;
  69. }
  70. return 0;
  71. }
  72. module_init(pcm030_fabric_init);
  73. MODULE_AUTHOR("Jon Smirl <jonsmirl@gmail.com>");
  74. MODULE_DESCRIPTION(DRV_NAME ": mpc5200 pcm030 fabric driver");
  75. MODULE_LICENSE("GPL");