simone.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * simone.c -- ASoC audio for Simplemachines Sim.One board
  3. *
  4. * Copyright (c) 2010 Mika Westerberg
  5. *
  6. * Based on snappercl15 machine driver by Ryan Mallon.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/init.h>
  13. #include <linux/module.h>
  14. #include <linux/platform_device.h>
  15. #include <sound/core.h>
  16. #include <sound/pcm.h>
  17. #include <sound/soc.h>
  18. #include <asm/mach-types.h>
  19. #include <mach/hardware.h>
  20. #include "ep93xx-pcm.h"
  21. static struct snd_soc_dai_link simone_dai = {
  22. .name = "AC97",
  23. .stream_name = "AC97 HiFi",
  24. .cpu_dai_name = "ep93xx-ac97",
  25. .codec_dai_name = "ac97-hifi",
  26. .codec_name = "ac97-codec",
  27. .platform_name = "ep93xx-pcm-audio",
  28. };
  29. static struct snd_soc_card snd_soc_simone = {
  30. .name = "Sim.One",
  31. .dai_link = &simone_dai,
  32. .num_links = 1,
  33. };
  34. static struct platform_device *simone_snd_ac97_device;
  35. static struct platform_device *simone_snd_device;
  36. static int __init simone_init(void)
  37. {
  38. int ret;
  39. if (!machine_is_sim_one())
  40. return -ENODEV;
  41. simone_snd_ac97_device = platform_device_alloc("ac97-codec", -1);
  42. if (!simone_snd_ac97_device)
  43. return -ENOMEM;
  44. ret = platform_device_add(simone_snd_ac97_device);
  45. if (ret)
  46. goto fail;
  47. simone_snd_device = platform_device_alloc("soc-audio", -1);
  48. if (!simone_snd_device) {
  49. ret = -ENOMEM;
  50. goto fail;
  51. }
  52. platform_set_drvdata(simone_snd_device, &snd_soc_simone);
  53. ret = platform_device_add(simone_snd_device);
  54. if (ret) {
  55. platform_device_put(simone_snd_device);
  56. goto fail;
  57. }
  58. return ret;
  59. fail:
  60. platform_device_put(simone_snd_ac97_device);
  61. return ret;
  62. }
  63. module_init(simone_init);
  64. static void __exit simone_exit(void)
  65. {
  66. platform_device_unregister(simone_snd_device);
  67. platform_device_unregister(simone_snd_ac97_device);
  68. }
  69. module_exit(simone_exit);
  70. MODULE_DESCRIPTION("ALSA SoC Simplemachines Sim.One");
  71. MODULE_AUTHOR("Mika Westerberg <mika.westerberg@iki.fi>");
  72. MODULE_LICENSE("GPL");