txx9aclc-generic.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. .dai_link = &txx9aclc_generic_dai,
  33. .num_links = 1,
  34. };
  35. static struct platform_device *soc_pdev;
  36. static int __init txx9aclc_generic_probe(struct platform_device *pdev)
  37. {
  38. int ret;
  39. soc_pdev = platform_device_alloc("soc-audio", -1);
  40. if (!soc_pdev)
  41. return -ENOMEM;
  42. platform_set_drvdata(soc_pdev, &txx9aclc_generic_card);
  43. ret = platform_device_add(soc_pdev);
  44. if (ret) {
  45. platform_device_put(soc_pdev);
  46. return ret;
  47. }
  48. return 0;
  49. }
  50. static int __exit txx9aclc_generic_remove(struct platform_device *pdev)
  51. {
  52. platform_device_unregister(soc_pdev);
  53. return 0;
  54. }
  55. static struct platform_driver txx9aclc_generic_driver = {
  56. .remove = txx9aclc_generic_remove,
  57. .driver = {
  58. .name = "txx9aclc-generic",
  59. .owner = THIS_MODULE,
  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");