simone.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. .owner = THIS_MODULE,
  32. .dai_link = &simone_dai,
  33. .num_links = 1,
  34. };
  35. static struct platform_device *simone_snd_ac97_device;
  36. static int __devinit simone_probe(struct platform_device *pdev)
  37. {
  38. struct snd_soc_card *card = &snd_soc_simone;
  39. int ret;
  40. simone_snd_ac97_device = platform_device_register_simple("ac97-codec",
  41. -1, NULL, 0);
  42. if (IS_ERR(simone_snd_ac97_device))
  43. return PTR_ERR(simone_snd_ac97_device);
  44. card->dev = &pdev->dev;
  45. ret = snd_soc_register_card(card);
  46. if (ret) {
  47. dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
  48. ret);
  49. platform_device_unregister(simone_snd_ac97_device);
  50. }
  51. return ret;
  52. }
  53. static int __devexit simone_remove(struct platform_device *pdev)
  54. {
  55. struct snd_soc_card *card = platform_get_drvdata(pdev);
  56. snd_soc_unregister_card(card);
  57. platform_device_unregister(simone_snd_ac97_device);
  58. return 0;
  59. }
  60. static struct platform_driver simone_driver = {
  61. .driver = {
  62. .name = "simone-audio",
  63. .owner = THIS_MODULE,
  64. },
  65. .probe = simone_probe,
  66. .remove = __devexit_p(simone_remove),
  67. };
  68. module_platform_driver(simone_driver);
  69. MODULE_DESCRIPTION("ALSA SoC Simplemachines Sim.One");
  70. MODULE_AUTHOR("Mika Westerberg <mika.westerberg@iki.fi>");
  71. MODULE_LICENSE("GPL");
  72. MODULE_ALIAS("platform:simone-audio");