txx9aclc-generic.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Generic TXx9 ACLC machine driver
  3. *
  4. * Copyright (C) 2009 Atsushi Nemoto
  5. *
  6. * Based on RBTX49xx patch from CELF patch archive.
  7. * (C) Copyright TOSHIBA CORPORATION 2004-2006
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. *
  13. * This is a very generic AC97 sound machine driver for boards which
  14. * have (AC97) audio at ACLC (e.g. RBTX49XX boards).
  15. */
  16. #include <linux/module.h>
  17. #include <linux/platform_device.h>
  18. #include <sound/core.h>
  19. #include <sound/pcm.h>
  20. #include <sound/soc.h>
  21. #include "txx9aclc.h"
  22. static struct snd_soc_dai_link txx9aclc_generic_dai = {
  23. .name = "AC97",
  24. .stream_name = "AC97 HiFi",
  25. .cpu_dai_name = "txx9aclc-ac97",
  26. .codec_dai_name = "ac97-hifi",
  27. .platform_name = "txx9aclc-pcm-audio",
  28. .codec_name = "ac97-codec",
  29. };
  30. static struct snd_soc_card txx9aclc_generic_card = {
  31. .name = "Generic TXx9 ACLC Audio",
  32. .owner = THIS_MODULE,
  33. .dai_link = &txx9aclc_generic_dai,
  34. .num_links = 1,
  35. };
  36. static struct platform_device *soc_pdev;
  37. static int __init txx9aclc_generic_probe(struct platform_device *pdev)
  38. {
  39. int ret;
  40. soc_pdev = platform_device_alloc("soc-audio", -1);
  41. if (!soc_pdev)
  42. return -ENOMEM;
  43. platform_set_drvdata(soc_pdev, &txx9aclc_generic_card);
  44. ret = platform_device_add(soc_pdev);
  45. if (ret) {
  46. platform_device_put(soc_pdev);
  47. return ret;
  48. }
  49. return 0;
  50. }
  51. static int __exit txx9aclc_generic_remove(struct platform_device *pdev)
  52. {
  53. platform_device_unregister(soc_pdev);
  54. return 0;
  55. }
  56. static struct platform_driver txx9aclc_generic_driver = {
  57. .remove = __exit_p(txx9aclc_generic_remove),
  58. .driver = {
  59. .name = "txx9aclc-generic",
  60. },
  61. };
  62. static int __init txx9aclc_generic_init(void)
  63. {
  64. return platform_driver_probe(&txx9aclc_generic_driver,
  65. txx9aclc_generic_probe);
  66. }
  67. static void __exit txx9aclc_generic_exit(void)
  68. {
  69. platform_driver_unregister(&txx9aclc_generic_driver);
  70. }
  71. module_init(txx9aclc_generic_init);
  72. module_exit(txx9aclc_generic_exit);
  73. MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>");
  74. MODULE_DESCRIPTION("Generic TXx9 ACLC ALSA SoC audio driver");
  75. MODULE_LICENSE("GPL");
  76. MODULE_ALIAS("platform:txx9aclc-generic");