simone.c 2.3 KB

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