efika-audio-fabric.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * Efika 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/stac9766.h"
  28. #define DRV_NAME "efika-audio-fabric"
  29. static struct snd_soc_dai_link efika_fabric_dai[] = {
  30. {
  31. .name = "AC97",
  32. .stream_name = "AC97 Analog",
  33. .codec_dai_name = "stac9766-hifi-analog",
  34. .cpu_dai_name = "mpc5200-psc-ac97.0",
  35. .platform_name = "mpc5200-pcm-audio",
  36. .codec_name = "stac9766-codec",
  37. },
  38. {
  39. .name = "AC97",
  40. .stream_name = "AC97 IEC958",
  41. .codec_dai_name = "stac9766-hifi-IEC958",
  42. .cpu_dai_name = "mpc5200-psc-ac97.1",
  43. .platform_name = "mpc5200-pcm-audio",
  44. .codec_name = "stac9766-codec",
  45. },
  46. };
  47. static struct snd_soc_card card = {
  48. .name = "Efika",
  49. .owner = THIS_MODULE,
  50. .dai_link = efika_fabric_dai,
  51. .num_links = ARRAY_SIZE(efika_fabric_dai),
  52. };
  53. static __init int efika_fabric_init(void)
  54. {
  55. struct platform_device *pdev;
  56. int rc;
  57. if (!of_machine_is_compatible("bplan,efika"))
  58. return -ENODEV;
  59. pdev = platform_device_alloc("soc-audio", 1);
  60. if (!pdev) {
  61. pr_err("efika_fabric_init: platform_device_alloc() failed\n");
  62. return -ENODEV;
  63. }
  64. platform_set_drvdata(pdev, &card);
  65. rc = platform_device_add(pdev);
  66. if (rc) {
  67. pr_err("efika_fabric_init: platform_device_add() failed\n");
  68. platform_device_put(pdev);
  69. return -ENODEV;
  70. }
  71. return 0;
  72. }
  73. module_init(efika_fabric_init);
  74. MODULE_AUTHOR("Jon Smirl <jonsmirl@gmail.com>");
  75. MODULE_DESCRIPTION(DRV_NAME ": mpc5200 Efika fabric driver");
  76. MODULE_LICENSE("GPL");